What I want to do is to use enum to specify different draw modes easily. So far this is what I've got:
class Grid {
enum drawMode { GRID, EROSION, RIVERS, HUMIDITY, ATMOSPHERE }
drawMode activeDraw;
void draw() {
switch(activeDraw) {
case GRID:
drawGrid();
break;
case EROSION:
drawErosion();
break;
// etc..
}
void keyPressed(int key) {
switch(key) {
case ' ':
// Cycle activeDraw to next drawMode
}
}
So if user hits spacebar the activeDraw will change to next value from enum. So if the current activeDraw is GRID after hitting space it will change to EROSION and if activeDraw is ATMOSPHERE it will change to GRID.
Is there a simple solution to this? Thanks.
Aucun commentaire:
Enregistrer un commentaire