Hi,
I'm trying to do something like menu. my goal is to make it work using only w/s/up/down. But first i have to face some problems with "jumping" between screens.
My entire menu is a function, and i created 3 different "skins". "Player" must click for example "s" on keyboard(without confirmation) and the skin will jump to another one. here starts my problem. First i'd like to just allow it jump. here's my code:
It compiles but it doesn't work. The program quits after i hit "s". But it shouldn't. it should jump down to second "screen"(where help is between >> <<) and after another click it should jump to last "screen".Code:void menu(void)
{
system("cls");//to clear previous screen
printf("=========================== 1.>>NEW GAME<< ===================================\n");
printf("=========================== 2. HELP ===================================\n");
printf("=========================== 3. QUIT ===================================\n");
char c;
c=getch();
if((int)c==83) //asci number for s
{fflush(stdin); //it should clear previous choice
printf("=========================== 1. NEW GAME ===================================\n");
printf("=========================== 2. >>HELP<< ===================================\n");
printf("=========================== 3. QUIT ===================================\n");
c=getch();
if((int)c==83)
{printf("=========================== 1. NEW GAME ===================================\n");
printf("=========================== 2. HELP ===================================\n");
printf("=========================== 3. >>QUIT<< ===================================\n");}}
}
I'm also not sure what should i use to work it forever. Loop or goto: ?
Any help would be highly appreciated.