I am attempting at making an interactive menu using arrow keys for a game I also attempting to create. I have already figured out how to "detect" arrow keys with in the console. using
#define ESC 27
#define UP 72
#define LEFT 75
#define RIGHT 77
#define DOWN 80
#define ENTER 13
void clr();
void first(constchar *prompt)
{
string A = "x";
puts(prompt);
for ( ;; )
{
int ch = _getch();
switch(ch)
{
case EOF:
case ESC: return;
case UP: A = "+"; cout << A; puts("UP"); system("pause"); clr(); break;
//case LEFT: puts("LEFT"); system("pause"); clr(); break;
//case RIGHT: puts("RIGHT"); system("pause"); clr(); break;
case DOWN: A = "-"; cout << A; puts("DOWN"); system("pause"); clr(); break;
case ENTER: puts("ENTER"); system("pause"); clr(); break;
default: if(isprint(ch)) putchar(ch); break;
}
}
}
int main(void)
{
first("press a key to test, <esc> to exit");
return 0;
}
Ignore some of that BS in there, also ignore the system(), it is temporary. I need some help on getting a menu looking something sort of like this:
-----------
*New Game
Load Game
Options
-----------
On arrow key down I want the asterisk to move downwards, but for the life of me I have not the slightest clue of what I am doing to make this successful whatsoever. If you have some advice or a link, it would be greatly appreciated. Thank you for anything.
p.s. If I am missing anything, please give me a heads up.
We are not picking on you, or dismissing your questions when we say that using the console for Game Development is a PITA. I tried to get this to work my self and it is just not worth it. You will honestly spend more time trying to figure out how to mash all of your functions together then it will take to learn SDL.
So it's not worth it? I really want to try haha. Is it possible to use the above in an IF statement instead of a switch? Also what is SDL, (noob question)?