void optionsmenu() { const char *items[2] = {"Fullscreen", "Line Drawing"}; draw_options_box(); options_menu(items, 2, op_handler, 3, 9); clearbox(1, 7, 0, 11); }
void optionsmenu() { const char *items[2] = {"Term BG", "Line Drawing"}; int n = 1+!(textgfx_flags & CYGWIN); draw_options_box(); options_menu(items, n, op_handler, 3, 9); setcurs(0, 7); wclrtobot(window); }
int main_menu(WINDOW* screen) { int max_x, max_y; getmaxyx(screen, max_y, max_x); char* title_menu_l[4] = {"Play!", "Options", "Help", "Quit"}; struct Menu* title_menu = new_menu(max_x / 8, 8, 4, title_menu_l, BLUE_ON_BLACK, GREEN_ON_BLACK); //For the moving background... struct Ball* ball = make_ball(max_x / 2, max_y / 4, HARD_BALL_VX, HARD_BALL_VY); struct Paddle* paddle = make_paddle(0, max_y / 2, 5, 2); Timer* timer = sgl_timer_new(); //Default settings... int difficulty = EASY; int sound = SOUND_OFF; char* random_name = ai_names[randint(ai_names_c)]; struct Game* game = make_game(max_x, max_y, difficulty, sound, PADDLE_SENSITIVITY, random_name, getenv("USER"), 1, 0, DEFAULT_SCORE); int key; while (key != 'q'){ switch (key = getch()){ case KEY_DOWN: move_selected(title_menu, DOWN); break; case KEY_UP: move_selected(title_menu, UP); break; case KEY_RIGHT: case KEY_ENTER: switch (title_menu->selected){ case 0: //Play game play_game(game); break; case 1: //Options game = options_menu(screen, game, ball, paddle, max_x, max_y); clear(); break; case 2: //Help help_menu(screen, ball, paddle, max_x, max_y); break; case 3: //Quit return 0; break; } break; } //Render the background if (sgl_timer_elapsed_milliseconds(timer) > 20){ sgl_timer_reset(timer); update_background(ball, paddle, max_x, max_y); draw_background(screen, ball, paddle); refresh(); } draw_strings(screen, 1, max_x / 2 - strlen(game_title[0]), game_title, 6); draw_menu(title_menu); wrefresh(title_menu->win); } clear(); refresh(); return 0; }