Skip to content
Snippets Groups Projects
Commit 216410f8 authored by Lucas Philippe's avatar Lucas Philippe
Browse files

ajout etape 6

parent 6e708748
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,21 @@ class City {
}
fill(hue, 100, 100, alpha);
ellipse(x, y, radius, radius);
// Draw city name
if (isHighlighted) {
textSize(16);
textAlign(LEFT, CENTER);
float textWidth = textWidth(name);
float rectWidth = textWidth + 10;
float rectHeight = 20;
fill(255);
rect(x + radius/2 + 5, y - rectHeight/2, rectWidth, rectHeight, 5);
fill(0);
text(name, x + radius/2 + 10, y - 2);
setBasePen();
}
}
boolean contains(int px, int py){
......
float getColorForAltitude(float altitude) {
return map(altitude, 0, 100, 230, -50);
}
void setBasePen() {
fill(0);
textSize(12);
}
......@@ -32,7 +32,7 @@ void draw(){
textSize(20);
textAlign(CENTER,CENTER);
text("Afficher les populations supérieures à " + minPopulationToDisplay, width/2, 20);
textSize(12);
setBasePen();
for (int i = 0 ; i < totalCount; ++i) {
// draw a point at the coordinates of the city
......@@ -153,7 +153,7 @@ void mouseMoved() {
lastCitySelected.isHighlighted = false;
}
lastCitySelected = city;
println(city.name);
//println(city.name);
lastCitySelected.isHighlighted = true;
redraw();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment