Loading menu.c +12 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,12 @@ int menu_prompt(const menu_item *items, unsigned int num_menu_items, const char } } while (selected_action == UNSELECTED); // clean up menu by erasing all lines for (unsigned int i = 0; i < num_menu_items + 1; i++) { // +1 to include the menu title printf("\033[A"); // move cursor up one line printf("\033[2K"); // clear entire line } return selected_action; } Loading Loading @@ -134,6 +140,12 @@ void menu_prompt_multi_select(menu_item *items, unsigned int num_menu_items, con break; } } while (!user_done_selecting); // clean up menu by erasing all lines for (unsigned int i = 0; i < num_menu_items + 2; i++) { // +2 to include the menu title and extra space printf("\033[A"); // move cursor up one line printf("\033[2K"); // clear entire line } } MENU_DIRECTION get_direction(void) { Loading yaht.c +10 −0 Original line number Diff line number Diff line Loading @@ -164,4 +164,14 @@ void do_demo_dice_rolls(game_context *ctx, unsigned int num_dice) { void show_rules() { // todo write show_rules() printf("⚠\uFE0F under construction ⚠\uFE0F\n"); // const char *rules[] = { // "" // }; // const unsigned int rules_line_count = sizeof(rules) / sizeof(char*); // // for (int i = 0; i < rules_line_count; i++) { // printf("%s\n", rules[i]); // } // printf("\n"); // } Loading
menu.c +12 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,12 @@ int menu_prompt(const menu_item *items, unsigned int num_menu_items, const char } } while (selected_action == UNSELECTED); // clean up menu by erasing all lines for (unsigned int i = 0; i < num_menu_items + 1; i++) { // +1 to include the menu title printf("\033[A"); // move cursor up one line printf("\033[2K"); // clear entire line } return selected_action; } Loading Loading @@ -134,6 +140,12 @@ void menu_prompt_multi_select(menu_item *items, unsigned int num_menu_items, con break; } } while (!user_done_selecting); // clean up menu by erasing all lines for (unsigned int i = 0; i < num_menu_items + 2; i++) { // +2 to include the menu title and extra space printf("\033[A"); // move cursor up one line printf("\033[2K"); // clear entire line } } MENU_DIRECTION get_direction(void) { Loading
yaht.c +10 −0 Original line number Diff line number Diff line Loading @@ -164,4 +164,14 @@ void do_demo_dice_rolls(game_context *ctx, unsigned int num_dice) { void show_rules() { // todo write show_rules() printf("⚠\uFE0F under construction ⚠\uFE0F\n"); // const char *rules[] = { // "" // }; // const unsigned int rules_line_count = sizeof(rules) / sizeof(char*); // // for (int i = 0; i < rules_line_count; i++) { // printf("%s\n", rules[i]); // } // printf("\n"); // }