static int name_gui(void) { int id, jd; if ((id = gui_vstack(0))) { gui_label(id, _("Player Name"), GUI_MED, 0, 0); gui_space(id); name_id = gui_label(id, " ", GUI_MED, gui_yel, gui_yel); gui_space(id); gui_keyboard(id); gui_space(id); if ((jd = gui_harray(id))) { enter_id = gui_start(jd, _("OK"), GUI_SML, NAME_OK, 0); gui_space(jd); gui_state(jd, _("Cancel"), GUI_SML, GUI_BACK, 0); } gui_layout(id, 0, 0); gui_set_trunc(name_id, TRUNC_HEAD); gui_set_label(name_id, text_input); } return id; }
static int save_gui(void) { int id, jd; if ((id = gui_vstack(0))) { gui_label(id, _("Replay Name"), GUI_MED, 0, 0); gui_space(id); file_id = gui_label(id, " ", GUI_MED, gui_yel, gui_yel); gui_space(id); gui_keyboard(id); gui_space(id); if ((jd = gui_harray(id))) { enter_id = gui_start(jd, _("Save"), GUI_SML, SAVE_SAVE, 0); gui_space(jd); gui_state(jd, _("Cancel"), GUI_SML, GUI_BACK, 0); } gui_layout(id, 0, 0); gui_set_trunc(file_id, TRUNC_HEAD); gui_set_label(file_id, text_input); } return id; }
static void gui_level(int id, int i) { struct level *l = get_level(i); const GLubyte *fore = 0; const GLubyte *back = 0; int jd; if (!l) { gui_label(id, " ", GUI_SML, gui_blk, gui_blk); return; } if (level_opened(l)) { fore = level_bonus(l) ? gui_grn : gui_wht; back = level_completed(l) ? fore : gui_yel; } jd = gui_label(id, level_name(l), GUI_SML, back, fore); if (level_opened(l) || config_cheat()) gui_set_state(jd, START_LEVEL, i); }
static int clobber_gui(void) { int id, jd, kd; int file_id; if ((id = gui_vstack(0))) { kd = gui_label(id, _("Overwrite?"), GUI_MED, gui_red, gui_red); file_id = gui_label(id, "MMMMMMMM", GUI_MED, gui_yel, gui_yel); if ((jd = gui_harray(id))) { gui_start(jd, _("Cancel"), GUI_SML, GUI_BACK, 0); gui_state(jd, _("Overwrite"), GUI_SML, SAVE_SAVE, 0); } gui_pulse(kd, 1.2f); gui_layout(id, 0, 0); gui_set_trunc(file_id, TRUNC_TAIL); gui_set_label(file_id, text_input); } return id; }
static int demo_end_gui(void) { int id, jd, kd; if ((id = gui_vstack(0))) { if (demo_paused) kd = gui_label(id, _("Replay Paused"), GUI_LRG, gui_gry, gui_red); else kd = gui_label(id, _("Replay Ends"), GUI_LRG, gui_gry, gui_red); if ((jd = gui_harray(id))) { if (standalone) { gui_start(jd, _("Quit"), GUI_SML, DEMO_QUIT, 0); } else { gui_start(jd, _("Keep"), GUI_SML, DEMO_KEEP, 0); gui_state(jd, _("Delete"), GUI_SML, DEMO_DEL, 0); } if (demo_paused) gui_start(jd, _("Continue"), GUI_SML, DEMO_CONTINUE, 0); else gui_state(jd, _("Repeat"), GUI_SML, DEMO_REPLAY, 0); } gui_pulse(kd, 1.2f); gui_layout(id, 0, 0); } return id; }
static void gui_level(int id, char *text, int i) { int o = level_opened(i); int e = level_exists(i); if (o) gui_state(id, text, GUI_SML, i, 0); else if (e) gui_label(id, text, GUI_SML, GUI_ALL, gui_yel, gui_red); else gui_label(id, text, GUI_SML, GUI_ALL, gui_blk, gui_blk); }
static int lang_gui(void) { const int step = (first == 0 ? LANG_STEP - 1 : LANG_STEP); int id, jd; int i; if ((id = gui_vstack(0))) { if ((jd = gui_hstack(id))) { gui_label(jd, _("Language"), GUI_SML, 0, 0); gui_space(jd); gui_space(jd); gui_navig(jd, array_len(langs), first, LANG_STEP); } gui_space(id); if (step < LANG_STEP) { int default_id; default_id = gui_state(id, _("Default"), GUI_SML, LANG_DEFAULT, 0); gui_set_hilite(default_id, !*config_get_s(CONFIG_LANGUAGE)); } for (i = first; i < first + step; i++) { if (i < array_len(langs)) { struct lang_desc *desc = LANG_GET(langs, i); int lang_id; lang_id = gui_state(id, lang_name(desc), GUI_SML, LANG_SELECT, i); gui_set_hilite(lang_id, (strcmp(config_get_s(CONFIG_LANGUAGE), desc->code) == 0)); } else { gui_label(id, " ", GUI_SML, 0, 0); } } gui_layout(id, 0, 0); } return id; }
static void gui_scores(int id, int e) { const char *s = "1234567"; int j, jd, kd, ld; score_extra_row = e; if ((jd = gui_vstack(id))) { if ((kd = gui_vstack(jd))) { score_label = gui_label(kd, _("Unavailable"), GUI_MED, 0, 0); for (j = RANK_HARD; j < RANK_LAST; j++) if ((ld = gui_hstack(kd))) { score_coin[j] = gui_count(ld, 1000, GUI_MED); score_name[j] = gui_label(ld, s, GUI_MED, gui_yel, gui_wht); score_time[j] = gui_clock(ld, 359999, GUI_MED); gui_set_trunc(score_name[j], TRUNC_TAIL); gui_set_fill (score_name[j]); } gui_set_rect(kd, GUI_ALL); } if (e) { gui_space(jd); if ((kd = gui_hstack(jd))) { j = RANK_LAST; score_coin[j] = gui_count(kd, 1000, GUI_MED); score_name[j] = gui_label(kd, s, GUI_MED, gui_yel, gui_wht); score_time[j] = gui_clock(kd, 359999, GUI_MED); gui_set_trunc(score_name[j], TRUNC_TAIL); gui_set_fill (score_name[j]); gui_set_rect(kd, GUI_ALL); } } } }
static void gui_set(int id, int i) { if (set_exists(i)) gui_state(id, set_name(i), GUI_SML, i, 0); else gui_label(id, "", GUI_SML, GUI_ALL, 0, 0); }
static int pause_gui(void) { int id, jd, title_id; /* Build the pause GUI. */ if ((id = gui_vstack(0))) { title_id = gui_label(id, _("Paused"), GUI_LRG, 0, 0); gui_space(id); if ((jd = gui_harray(id))) { gui_state(jd, _("Quit"), GUI_SML, PAUSE_EXIT, 0); if (progress_same_avail()) gui_state(jd, _("Restart"), GUI_SML, PAUSE_RESTART, 0); gui_start(jd, _("Continue"), GUI_SML, PAUSE_CONTINUE, 0); } gui_pulse(title_id, 1.2f); gui_layout(id, 0, 0); } return id; }
static int title_enter(void) { int id, jd, kd; /* Build the title GUI. */ if ((id = gui_vstack(0))) { gui_label(id, "Neverputt", GUI_LRG, GUI_ALL, 0, 0); gui_space(id); if ((jd = gui_harray(id))) { gui_filler(jd); if ((kd = gui_varray(jd))) { gui_start(kd, sgettext("menu^Play"), GUI_MED, TITLE_PLAY, 1); gui_state(kd, sgettext("menu^Options"), GUI_MED, TITLE_CONF, 0); gui_state(kd, sgettext("menu^Exit"), GUI_MED, TITLE_EXIT, 0); } gui_filler(jd); } gui_layout(id, 0, 0); } course_init(); course_rand(); return id; }
static int resol_gui(void) { int id, jd; if ((id = gui_vstack(0))) { if ((jd = gui_harray(id))) { gui_label(jd, _("Resolution"), GUI_SML, 0, 0); gui_space(jd); gui_start(jd, _("Back"), GUI_SML, RESOL_BACK, 0); } gui_space(id); if (modes) { int i; for (i = 0; fill_row(gui_harray(id), modes, i, 4); i += 4); } gui_layout(id, 0, 0); } return id; }
static int title_enter(struct state *st, struct state *prev) { int id, jd, kd; /* Build the title GUI. */ if ((id = gui_vstack(0))) { #ifdef GCWZERO jd = gui_label(id, "Neverputt", GUI_LRG, 0, 0); if (jd) { gui_set_fill(jd); gui_set_rect(jd, GUI_TOP); } int credit_label; if ((credit_label = gui_label(id, "GCW Zero port by Senquack", GUI_SML, gui_wht, gui_wht))) { gui_set_rect(credit_label, GUI_BOT); } #else gui_label(id, "Neverputt", GUI_LRG, 0, 0); #endif //GCWZERO gui_space(id); if ((jd = gui_harray(id))) { gui_filler(jd); if ((kd = gui_varray(jd))) { gui_start(kd, gt_prefix("menu^Play"), GUI_MED, TITLE_PLAY, 1); gui_state(kd, gt_prefix("menu^Options"), GUI_MED, TITLE_CONF, 0); gui_state(kd, gt_prefix("menu^Exit"), GUI_MED, TITLE_EXIT, 0); } gui_filler(jd); } gui_layout(id, 0, 0); } course_init(); course_rand(); return id; }
static int demo_end_enter(void) { int id, jd, kd; if ((id = gui_vstack(0))) { if (demo_paused) kd = gui_label(id, _("Replay Paused"), GUI_LRG, GUI_ALL, gui_gry, gui_red); else kd = gui_label(id, _("Replay Ends"), GUI_LRG, GUI_ALL, gui_gry, gui_red); if ((jd = gui_harray(id))) { int start_id = 0; if (standalone) { start_id = gui_start(jd, _("Quit"), GUI_SML, DEMO_QUIT, 1); } else { start_id = gui_start(jd, _("Keep"), GUI_SML, DEMO_KEEP, 1); gui_state(jd, _("Delete"), GUI_SML, DEMO_DEL, 0); } if (demo_paused) { gui_start(jd, _("Continue"), GUI_SML, DEMO_CONTINUE, 1); gui_toggle(start_id); } else gui_state(jd, _("Repeat"), GUI_SML, DEMO_REPLAY, 0); } gui_pulse(kd, 1.2f); gui_layout(id, 0, 0); } audio_music_fade_out(demo_paused ? 0.2f : 2.0f); return id; }
void hud_init(void) { int id; if ((Rhud_id = gui_hstack(0))) { if ((id = gui_vstack(Rhud_id))) { gui_label(id, "Coins", GUI_SML, 0, gui_wht, gui_wht); gui_label(id, "Goal", GUI_SML, 0, gui_wht, gui_wht); } if ((id = gui_vstack(Rhud_id))) { coin_id = gui_count(id, 100, GUI_SML, GUI_NW); goal_id = gui_count(id, 10, GUI_SML, 0); } gui_layout(Rhud_id, +1, -1); } if ((Lhud_id = gui_hstack(0))) { if ((id = gui_vstack(Lhud_id))) { ball_id = gui_count(id, 10, GUI_SML, GUI_NE); scor_id = gui_count(id, 1000, GUI_SML, 0); } if ((id = gui_vstack(Lhud_id))) { gui_label(id, "Balls", GUI_SML, 0, gui_wht, gui_wht); gui_label(id, "Score", GUI_SML, 0, gui_wht, gui_wht); } gui_layout(Lhud_id, -1, -1); } if ((time_id = gui_clock(0, 59999, GUI_MED, GUI_TOP))) gui_layout(time_id, 0, -1); if ((view_id = gui_label(0, STR_VIEW2, GUI_SML, GUI_SW, gui_wht, gui_wht))) gui_layout(view_id, 1, 1); if ((fps_id = gui_count(0, 1000, GUI_SML, GUI_SE))) gui_layout(fps_id, -1, 1); }
static int demo_gui(void) { int id, jd; id = gui_vstack(0); if (total) { if (video.device_w < video.device_h && total > DEMO_STEP) { if ((jd = gui_vstack(id))) { gui_navig(jd, total, first, DEMO_STEP); gui_space(jd); gui_filler(jd); gui_label(jd, _("Select Replay"), GUI_MED, 0,0); } } else if ((jd = gui_hstack(id))) { gui_label(jd, _("Select Replay"), GUI_MED, 0,0); gui_space(jd); gui_filler(jd); gui_navig(jd, total, first, DEMO_STEP); } gui_demo_thumbs(id); //gui_space(id); //gui_demo_status(id); gui_layout(id, 0, 0); gui_demo_update_thumbs(); //gui_demo_update_status(last_viewed); } else { gui_label(id, _("No Replays"), GUI_MED, 0, 0); gui_space(id); gui_state(id, _("Back"), GUI_MED, GUI_BACK, 0); gui_layout(id, 0, 0); } return id; }
static int demo_enter(void) { int id, jd; if (items) demo_dir_free(items); items = demo_dir_scan(); total = array_len(items); id = gui_vstack(0); if (total) { if ((jd = gui_hstack(id))) { gui_label(jd, _("Select Replay"), GUI_SML, GUI_ALL, 0,0); gui_filler(jd); gui_navig(jd, first > 0, first + DEMO_STEP < total); } gui_demo_thumbs(id); gui_filler(id); gui_demo_status(id); gui_layout(id, 0, 0); gui_demo_update_thumbs(); gui_demo_update_status(last_viewed); } else { gui_label(id, _("No Replays"), GUI_MED, GUI_ALL, 0, 0); gui_layout(id, 0, 0); } audio_music_fade_to(0.5f, "bgm/inter.ogg"); return id; }
static int play_ready_gui(void) { int id; if ((id = gui_label(0, _("Ready?"), GUI_LRG, 0, 0))) { gui_layout(id, 0, 0); gui_pulse(id, 1.2f); } return id; }
static int play_loop_gui(void) { int id; if ((id = gui_label(0, _("GO!"), GUI_LRG, gui_blu, gui_grn))) { gui_layout(id, 0, 0); gui_pulse(id, 1.2f); } return id; }
static int over_gui(void) { int id; if ((id = gui_label(0, _("GAME OVER"), GUI_LRG, gui_gry, gui_red))) { gui_layout(id, 0, 0); gui_pulse(id, 1.2f); } return id; }
int conf_state(int id, const char *label, const char *text, int token) { int jd, kd, rd = 0; if ((jd = gui_harray(id)) && (kd = gui_harray(jd))) { rd = gui_state(kd, text, GUI_SML, token, 0); gui_label(jd, label, GUI_SML, 0, 0); } return rd; }
static int demo_play_gui(void) { int id; if ((id = gui_vstack(0))) { gui_label(id, _("Replay"), GUI_LRG, gui_blu, gui_grn); gui_layout(id, 0, 0); gui_pulse(id, 1.2f); } return id; }
void hud_init(void) { static const GLubyte *color[5] = { gui_wht, gui_red, gui_grn, gui_blu, gui_yel }; int i = curr_player(); #ifdef __MOBILE__ if ((Shud_id = gui_vstack(0))) { gui_label(Shud_id, _(" S "), GUI_SML, gui_wht, gui_wht); gui_label(Shud_id, _(" W "), GUI_SML, gui_wht, gui_wht); gui_label(Shud_id, _(" I "), GUI_SML, gui_wht, gui_wht); gui_label(Shud_id, _(" N "), GUI_SML, gui_wht, gui_wht); gui_label(Shud_id, _(" G "), GUI_SML, gui_wht, gui_wht); gui_set_rect(Shud_id, GUI_RGT); gui_layout(Shud_id, -1, 0); } #endif if ((Lhud_id = gui_hstack(0))) { gui_label(Lhud_id, curr_scr(), GUI_MED, color[i], gui_wht); gui_label(Lhud_id, _("Shot"), GUI_SML, gui_wht, gui_wht); gui_set_rect(Lhud_id, GUI_NE); gui_layout(Lhud_id, -1, -1); } if ((Rhud_id = gui_hstack(0))) { gui_label(Rhud_id, curr_par(), GUI_MED, color[i], gui_wht); gui_label(Rhud_id, _("Par"), GUI_SML, gui_wht, gui_wht); gui_set_rect(Rhud_id, GUI_NW); gui_layout(Rhud_id, +1, -1); } if ((fps_id = gui_count(0, 1000, GUI_SML))) { gui_set_rect(fps_id, GUI_SE); gui_layout(fps_id, -1, +1); } }
void conf_header(int id, const char *text, int token) { int jd; if ((jd = gui_harray(id))) { gui_label(jd, text, GUI_SML, 0, 0); gui_space(jd); gui_start(jd, _("Back"), GUI_SML, token, 0); } gui_space(id); }
static int gui_demo_thumbs(int id) { int w = video.device_w; int h = video.device_h; int jd, kd, ld; int i, j; int row = w < h ? DEMO_LINEP : DEMO_LINEL; int iw = (w - 160) / row; int ih = iw * 3 / 4; struct thumb *thumb; if ((jd = gui_varray(id))) for (i = first; i < first + DEMO_STEP; i += row) if ((kd = gui_harray(jd))) { for (j = i + row - 1; j >= i; j--) { thumb = &thumbs[j % DEMO_STEP]; thumb->item = j; if (j < total) { if ((ld = gui_vstack(kd))) { gui_space(ld); thumb->shot = gui_image(ld, " ", iw, ih); thumb->name = gui_label(ld, " ", GUI_SML, gui_wht, gui_wht); gui_set_trunc(thumb->name, TRUNC_TAIL); gui_set_state(ld, DEMO_SELECT, j); } } else { gui_space(kd); thumb->shot = 0; thumb->name = 0; } } } return jd; }
static int set_enter(void) { int w = config_get_d(CONFIG_WIDTH); int h = config_get_d(CONFIG_HEIGHT); int id, jd, kd; int i; if (do_init) { total = set_init(); first = MIN(first, (total - 1) - ((total - 1) % SET_STEP)); audio_music_fade_to(0.5f, "bgm/inter.ogg"); audio_play(AUD_START, 1.f); } else do_init = 1; if ((id = gui_vstack(0))) { if ((jd = gui_hstack(id))) { gui_label(jd, _("Level Set"), GUI_SML, GUI_ALL, gui_yel, gui_red); gui_filler(jd); gui_navig(jd, first > 0, first + SET_STEP < total); } gui_space(id); if ((jd = gui_harray(id))) { shot_id = gui_image(jd, set_shot(first), 7 * w / 16, 7 * h / 16); if ((kd = gui_varray(jd))) { for (i = first; i < first + SET_STEP; i++) gui_set(kd, i); } } gui_space(id); desc_id = gui_multi(id, " \\ \\ \\ \\ \\", GUI_SML, GUI_ALL, gui_yel, gui_wht); gui_layout(id, 0, 0); } return id; }
static int done_gui(void) { const char *s1 = _("New Set Record"); const char *s2 = _("Set Complete"); int id; int high = progress_set_high(); if ((id = gui_vstack(0))) { int gid; if (high) gid = gui_label(id, s1, GUI_MED, gui_grn, gui_grn); else gid = gui_label(id, s2, GUI_MED, gui_blu, gui_grn); gui_space(id); gui_score_board(id, GUI_SCORE_COIN | GUI_SCORE_TIME, 1, high); gui_space(id); gui_start(id, _("Select Level"), GUI_SML, GUI_BACK, 0); if (!resume) gui_pulse(gid, 1.2f); gui_layout(id, 0, 0); } set_score_board(set_score(curr_set(), SCORE_COIN), progress_score_rank(), set_score(curr_set(), SCORE_TIME), progress_times_rank(), NULL, -1); return id; }
static int goal_enter(void) { int id; if ((id = gui_label(0, _("It's In!"), GUI_MED, GUI_ALL, gui_grn, gui_grn))) gui_layout(id, 0, 0); if (paused) paused = 0; else hole_goal(); hud_init(); return id; }
static int goal_enter(struct state *st, struct state *prev) { int id; if ((id = gui_label(0, _("It's In!"), GUI_MED, gui_grn, gui_grn))) gui_layout(id, 0, 0); if (paused) paused = 0; else hole_goal(); hud_init(); return id; }
static int gui_demo_thumbs(int id) { int w = config_get_d(CONFIG_WIDTH); int h = config_get_d(CONFIG_HEIGHT); int jd, kd, ld; int i, j; struct thumb *thumb; if ((jd = gui_varray(id))) for (i = first; i < first + DEMO_STEP; i += DEMO_LINE) if ((kd = gui_harray(jd))) { for (j = i + DEMO_LINE - 1; j >= i; j--) { thumb = &thumbs[j % DEMO_STEP]; thumb->item = j; if (j < total) { if ((ld = gui_vstack(kd))) { gui_space(ld); thumb->shot = gui_image(ld, " ", w / 6, h / 6); thumb->name = gui_label(ld, " ", GUI_SML, gui_wht, gui_wht); gui_set_trunc(thumb->name, TRUNC_TAIL); gui_set_state(ld, DEMO_SELECT, j); } } else { gui_space(kd); thumb->shot = 0; thumb->name = 0; } } } return jd; }