Simple Menu problem....
ok, i am trying to make a simple menu...the user presses a number to access different sections of the menu...now the problem i am having is with my ''key'' presses...i have a section of code that when the enter key is pressed it is supposed to display the next part of the menu....but when i press the enter key it just flashes the next section...or if i hold it down it displays it...what would i need to do to have the enter key pressed once..and the next section of menu be displayed permenently...in a way....?
thanks
Hey,
With menus you need to check Keydown and also the keyup processes. Also you don''t need speed or high performance input on menus so its perfectly alright not to use input API like Direct Input here. Lastly you need to use some kind of FSM so that nothing except menu is rendered while the game is in menu state and you would also need a lot of sub states for sub parts of the menu. Hope I answered your question.
Its not really an OpenGL question though. More of a game programming question.
With menus you need to check Keydown and also the keyup processes. Also you don''t need speed or high performance input on menus so its perfectly alright not to use input API like Direct Input here. Lastly you need to use some kind of FSM so that nothing except menu is rendered while the game is in menu state and you would also need a lot of sub states for sub parts of the menu. Hope I answered your question.
Its not really an OpenGL question though. More of a game programming question.
Easy problem to solve.. take a look at this code.. (you could make it oop if you want.. )
#define MENU_MAIN 1#define MENU_OPTIONS 2#define MENU_NEWGAME 3///////////////////#define MENU_BACK 4int current_menu = MENU_MAIN;int current_selection = MENU_NEWGAME;if( enter_pressed() ){switch( current_menu ){case MENU_MAIN: switch( current_selection) { case MENU_NEWGAME: current_menu = MENU_NEWGAME; break; } break;}....Render(){swtich( current_menu ) {case MENU_MAIN: DrawMainMenu(); break;case MENU_NEWGAME: DrawNewGameMenu(); break;}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement