I'm getting towards the final(ish) stages of the development of my first Smartphone game and have a question regarding the handling of key presses.
In my game loop I have a number of different game states. In the game loop I have a switch statement which determines what is drawn in each state (eg. MAINMENU, GAMESTATE_A, GAMESTATE_B). This I assume is a reasonably sensible way of doing things, but any other suggestions would be welcome)
My question is this - in the KeyDown function I currently have a switch statement for all the game states and within each case I have another switch statement for the behaviour of each key that is relevant. Is this sensible or should I have a switch statement for each Key, and within each case have another switch statement for each gamestate? Will changing it round make any difference at all and are there any general rules for switch statements within switch statements?
Any help would be greatly appreciated!
In my game loop I have a number of different game states. In the game loop I have a switch statement which determines what is drawn in each state (eg. MAINMENU, GAMESTATE_A, GAMESTATE_B). This I assume is a reasonably sensible way of doing things, but any other suggestions would be welcome)
My question is this - in the KeyDown function I currently have a switch statement for all the game states and within each case I have another switch statement for the behaviour of each key that is relevant. Is this sensible or should I have a switch statement for each Key, and within each case have another switch statement for each gamestate? Will changing it round make any difference at all and are there any general rules for switch statements within switch statements?
Any help would be greatly appreciated!