Hi, I"m developing my first game right now and I have an in-game menu which is drawn onto the screen, my question is that when the menu is displaying, the UP key for example will have a different functionality then when playing the actual game, is there a better way for doing this than the following?
private class KeyInputHandler extends KeyAdapter {
public void keyPressed(KeyEvent e) {
if(showMenu) {
if(e.getKeyCode() == KeyEvent.VK_DOWN) {
changeSelectedItem(1);
}
// ...
} else if(gameRunning){
if(e.getKeyCode() == KeyEvent.VK_RIGHT) {
cycleAircrafts(1);
}
// ...
}
}
}
Thanks.