Public feed
#381775
void get_main_menu_choice()
{
int choice = 0;
while (1) {
draw_main_menu(choice);
if (key[KEY_UP] && choice != 0) {
choice--;
}
else if (key[KEY_DOWN] && choice < NUM_CHOICES-1) {
choice++;
}
if (key[KEY_ENTER]) {
return choice;
}
}
}
int get_options_menu_choice()
{
int choice = 0;
while (1) {
draw_options_menu(choice);
if (key[KEY_UP] && choice != 0) {
choice--;
}
else if (key[KEY_DOWN] && choice < NUM_CHOICES-1) {
choice++;
}
if (key[KEY_ENTER]) {
return choice;
}
}
}
void do_options_menu()
{
while (1) {
int choice = get_options_menu_choice();
switch (choice) {
case EXIT:
return;
/* ... */
}
}
}
void do_main_menu()
{
while (1) {
int choice = get_main_menu_choice();
switch (choice) {
case OPTIONS_MENU:
do_options_menu();
break;
case EXIT:
return;
/* ... */
}
}
}
int main()
{
do_main_menu();
}