Compare commits
3 Commits
626c0115ec
...
a4a4caebdf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4a4caebdf | ||
|
|
eb15c82cde | ||
|
|
605bd4785d |
18
Equipe.pde
18
Equipe.pde
@@ -22,8 +22,8 @@ class Equipe {
|
|||||||
|
|
||||||
void update() {
|
void update() {
|
||||||
// affichage de l'emplacement d'équipe, qui restera toujours fixe
|
// affichage de l'emplacement d'équipe, qui restera toujours fixe
|
||||||
color bgColor = color(235, 112, 71, 0.8);
|
color bgColor = color(255, 255, 255, 120);
|
||||||
color textColor = color(200);
|
color textColor = color(0,0,0);
|
||||||
fill(bgColor);
|
fill(bgColor);
|
||||||
stroke(bgColor);
|
stroke(bgColor);
|
||||||
strokeWeight(0.5);
|
strokeWeight(0.5);
|
||||||
@@ -35,6 +35,16 @@ class Equipe {
|
|||||||
float pos_x = this.id<9? this.posX-radius/5: this.posX-radius/3;
|
float pos_x = this.id<9? this.posX-radius/5: this.posX-radius/3;
|
||||||
text(this.id+1, pos_x, this.posY+radius/5);
|
text(this.id+1, pos_x, this.posY+radius/5);
|
||||||
|
|
||||||
|
// affichage des tours
|
||||||
|
if (this.tour>0) {
|
||||||
|
color tourColor = color(255, 255, 255, 200);
|
||||||
|
fill(tourColor);
|
||||||
|
textSize(textSize);
|
||||||
|
float pos_y = this.posY+radius/5+30;
|
||||||
|
if (this.tour>=10) pos_x = pos_x - 6;
|
||||||
|
text(this.tour, pos_x, pos_y);
|
||||||
|
}
|
||||||
|
|
||||||
// mise à jour du pion
|
// mise à jour du pion
|
||||||
this.pion.draw();
|
this.pion.draw();
|
||||||
}
|
}
|
||||||
@@ -42,8 +52,8 @@ class Equipe {
|
|||||||
void setScore(int score) {
|
void setScore(int score) {
|
||||||
if (this.score==score) return;
|
if (this.score==score) return;
|
||||||
int oldScore = this.score;
|
int oldScore = this.score;
|
||||||
this.incTour();
|
//this.incTour();
|
||||||
println("Equipe", this.id+1, "setScore from", oldScore, "to", score, "turn updated to", this.tour);
|
println("Equipe", this.id+1, "setScore from", oldScore, "to", score);
|
||||||
this.score = score;
|
this.score = score;
|
||||||
this.update();
|
this.update();
|
||||||
Scoreboard.applyScore(this.id, this.score, this.tour);
|
Scoreboard.applyScore(this.id, this.score, this.tour);
|
||||||
|
|||||||
4
Pion.pde
4
Pion.pde
@@ -7,9 +7,9 @@ class Pion extends Position {
|
|||||||
Pion(int id) {
|
Pion(int id) {
|
||||||
super(id);
|
super(id);
|
||||||
this.bgColor = color(0, 0, 0);
|
this.bgColor = color(0, 0, 0);
|
||||||
this.textColor = color(255, 255, 255);
|
this.textColor = color(240, 240, 80);
|
||||||
this.posX = floor((displayWidth-margin*2)/nombreEquipes)*id+radius/2+margin;
|
this.posX = floor((displayWidth-margin*2)/nombreEquipes)*id+radius/2+margin;
|
||||||
this.posY = displayHeight-28;
|
this.posY = displayHeight-46;
|
||||||
this.radius = 30;
|
this.radius = 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
23
Plateau.pde
23
Plateau.pde
@@ -129,6 +129,13 @@ void mousePressed() {
|
|||||||
Scoreboard.toggleDisplay();
|
Scoreboard.toggleDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Equipe clicked = findClosestEquipeFromMouse();
|
||||||
|
//if (!clicked.pion.dragged) {
|
||||||
|
clicked.incTour();
|
||||||
|
Scoreboard.save();
|
||||||
|
println("Clicked on Equipe", clicked.id+1, "set tour to ", clicked.tour);
|
||||||
|
//}
|
||||||
|
|
||||||
if (!EDITING) return;
|
if (!EDITING) return;
|
||||||
for (int i = 0 ; i < positions.length; i++) {
|
for (int i = 0 ; i < positions.length; i++) {
|
||||||
Position p = positions[i];
|
Position p = positions[i];
|
||||||
@@ -240,6 +247,22 @@ Position findClosestPositionFrom(Pion pion) {
|
|||||||
return closest;
|
return closest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// renvoie l'emplacement d'équipe le plus proche de la souris
|
||||||
|
Equipe findClosestEquipeFromMouse() {
|
||||||
|
Equipe closest = equipes[0];
|
||||||
|
|
||||||
|
for (int i = 0 ; i < equipes.length; i++) {
|
||||||
|
Equipe equipe = equipes[i];
|
||||||
|
|
||||||
|
float distPion = dist(mouseX, mouseY, equipe.posX, equipe.posY);
|
||||||
|
float distClosest = dist(mouseX, mouseY, closest.posX, closest.posY);
|
||||||
|
|
||||||
|
if (distPion<=distClosest) closest = equipes[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return closest;
|
||||||
|
}
|
||||||
|
|
||||||
boolean fileExists(String filename) {
|
boolean fileExists(String filename) {
|
||||||
File f = dataFile(filename);
|
File f = dataFile(filename);
|
||||||
return f.isFile();
|
return f.isFile();
|
||||||
|
|||||||
@@ -153,7 +153,9 @@ class Scoreboard {
|
|||||||
if (teams.size()==0) continue;
|
if (teams.size()==0) continue;
|
||||||
|
|
||||||
// affichage du score
|
// affichage du score
|
||||||
fill(color(0, 0, 0));
|
fill(color(0,0,0));
|
||||||
|
rect(offsetX-66, offsetY+20, 55, 50);
|
||||||
|
fill(color(240, 240, 80));
|
||||||
stroke(color(0, 0, 0));
|
stroke(color(0, 0, 0));
|
||||||
strokeWeight(1);
|
strokeWeight(1);
|
||||||
textFont(quicksandFont, 40);
|
textFont(quicksandFont, 40);
|
||||||
@@ -168,9 +170,9 @@ class Scoreboard {
|
|||||||
for(int j=0; j<teams.size(); j++) {
|
for(int j=0; j<teams.size(); j++) {
|
||||||
float subLocalMarginX = (int(teams.get(j))<=9)? margin-10: (int(teams.get(j))>=40)? margin+4: margin;
|
float subLocalMarginX = (int(teams.get(j))<=9)? margin-10: (int(teams.get(j))>=40)? margin+4: margin;
|
||||||
subLocalMarginX -=4;
|
subLocalMarginX -=4;
|
||||||
fill(color(0, 0, 0));
|
fill(color(240, 240, 80));
|
||||||
circle(offsetX-(margin*(j+1))+20, offsetY+(margin*2)-12, 50);
|
circle(offsetX-(margin*(j+1))+20, offsetY+(margin*2)-12, 50);
|
||||||
fill(color(255, 255,255));
|
fill(color(0, 0, 0));
|
||||||
textFont(quicksandFont, 32);
|
textFont(quicksandFont, 32);
|
||||||
//text(teams.get(j), offsetX-(margin*(j+1)), offsetY+(margin*2));
|
//text(teams.get(j), offsetX-(margin*(j+1)), offsetY+(margin*2));
|
||||||
//fill(color(0, 250, 0));
|
//fill(color(0, 250, 0));
|
||||||
|
|||||||
Reference in New Issue
Block a user