2
在處理語言中有一些問題,它說表達式必須是常量,但我可以發誓他們是。我不知道我在這裏做錯了什麼。任何人都有一些提示?Case表達式必須是常量表達式
int gameState;
static int MENU = 0;
static int GAME = 1;
static int OPTIONS = 2;
void setup() {
screenSizex = 960;
screenSizey = 640;
size(screenSizex, screenSizey);
gameState = MENU;
}
void draw(){
switch(gameState) {
case MENU:
//does menu stuff
break;
case OPTIONS:
//does options stuff
break;
case GAME:
//does game stuff
break;
default:
break;
}
}
void mousePressed() {
if (//over some object) {
gameState = GAME;
}
else if (//over some object) {
gameState = OPTIONS;
}
else if (//over some object) {
exit();
}
}