Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
PImage carte;
Table table;
Table tableDoubles;
int lignes;
PImage iconKorok;
PImage iconKorokDouble;
int baseKorokHeight = 7 * 4;
int baseKorokWidth = 7 * 4;
int baseKorokDoubleWidth = 9 * 4;
int baseKorokDoubleHeight = 7 * 4;
PFont font;
KorokGroup[] korokGroups;
void setup() {
size(1200, 1000);
frameRate(30);
carte = loadImage("totk_map.jpg");
carte.resize(1200, 1000);
iconKorok = loadImage("korogu_simple.png");
iconKorokDouble = loadImage("korogu_double.png");
iconKorokDouble.resize(9 * 4, 7 * 4);
table = loadTable("korogus.csv");
tableDoubles = loadTable("korogus_duos.csv");
font = loadFont("Rockwell-16.vlw");
textFont(font);
textAlign(CENTER);
int minX = -4000;
int maxX = 4000;
int minY = -4000;
int maxY = 4000;
int divisions = 10;
KorokGroup[] korokGroups;
for (TableRow row : table.rows()) {
korokGroups
}
}
void draw() {
background(255);
image(carte, 0, 0);
smooth();
fill(192, 0, 0);
noStroke();
image(carte, 0, 0);
for (TableRow row : table.rows()) {
drawIcon(row, iconKorok, baseKorokWidth, baseKorokHeight);
}
for (TableRow row : tableDoubles.rows()) {
drawIcon(row, iconKorokDouble, baseKorokDoubleWidth, baseKorokDoubleHeight);
}
}
void drawIcon(TableRow row, PImage icon, float baseWidth, float baseHeight) {
float iconWidth = baseWidth;
float iconHeight = baseHeight;
float x = (row.getFloat(0) + 6000) / 10;
float y = (row.getFloat(2) + 5000) / 10;
if(mouseX > x - iconWidth / 2 &&
mouseX < x + iconWidth / 2 &&
mouseY > y - iconHeight/ 2 &&
mouseY < y + iconHeight/ 2
) {
iconHeight = iconHeight * 1.5;
iconWidth = iconWidth * 1.5;
fill(255);
text((int)row.getFloat(0) + ", " + (int)row.getFloat(1) + ", " + (int)row.getFloat(2), x, y - iconHeight / 2 - 10);
}
x = x - iconWidth / 2;
y = y - iconHeight / 2;
image(icon, x, y, iconWidth, iconHeight);
}