예제 #1
0
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);
            }
        }
    }
}
예제 #2
0
파일: st_all.c 프로젝트: senquack/neverball
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;
}
예제 #3
0
파일: hud.c 프로젝트: drodin/neverball
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);
    }
}
예제 #4
0
파일: st_all.c 프로젝트: Aeggy/neverball
static int next_enter(struct state *st, struct state *prev)
{
    int id, jd;
    char str[MAXSTR];

    sprintf(str, _("Hole %02d"), curr_hole());

    if ((id = gui_vstack(0)))
    {
        gui_label(id, str, GUI_MED, 0, 0);
        gui_space(id);

        if ((jd = gui_vstack(id)))
        {
            gui_label(jd, _("Player"), GUI_SML, 0, 0);

            switch (curr_player())
            {
            case 1:
                gui_label(jd, "1", GUI_LRG, gui_red, gui_wht);
                if (curr_party() > 1) audio_play(AUD_PLAYER1, 1.f);
                break;
            case 2:
                gui_label(jd, "2", GUI_LRG, gui_grn, gui_wht);
                if (curr_party() > 1) audio_play(AUD_PLAYER2, 1.f);
                break;
            case 3:
                gui_label(jd, "3", GUI_LRG, gui_blu, gui_wht);
                if (curr_party() > 1) audio_play(AUD_PLAYER3, 1.f);
                break;
            case 4:
                gui_label(jd, "4", GUI_LRG, gui_yel, gui_wht);
                if (curr_party() > 1) audio_play(AUD_PLAYER4, 1.f);
                break;
            }

            gui_set_rect(jd, GUI_ALL);
        }
        gui_layout(id, 0, 0);
    }

    hud_init();
    game_set_fly(1.f);

    if (paused)
        paused = 0;

    return id;
}
예제 #5
0
static int goal_gui(void)
{
    const char *s1 = _("New Record");
    const char *s2 = _("GOAL");

    int id, jd, kd, ld, md;

    int high = progress_lvl_high();

    if ((id = gui_vstack(0)))
    {
        int gid = 0;

        if (curr_mode() == MODE_CHALLENGE)
        {
            int coins, score, balls;
            int i;

            /* Reverse-engineer initial score and balls. */

            if (resume)
            {
                coins = 0;
                score = curr_score();
                balls = curr_balls();
            }
            else
            {
                coins = curr_coins();
                score = curr_score() - coins;
                balls = curr_balls();

                for (i = curr_score(); i > score; i--)
                    if (progress_reward_ball(i))
                        balls--;
            }

            /*if ((jd = gui_hstack(id)))
            {
                gui_filler(jd);*/

                if ((kd = gui_vstack(id)))
                {
                    if ((ld = video.device_w < video.device_h ? gui_vstack(kd) : gui_hstack(kd)))
                    {
                        if ((md = gui_harray(ld)))
                        {
                            balls_id = gui_count(md, 100, GUI_MED);
                            gui_label(md, _("Balls"), GUI_MED,
                                      gui_wht, gui_wht);
                        }
                        if ((md = gui_harray(ld)))
                        {
                            score_id = gui_count(md, 1000, GUI_MED);
                            gui_label(md, _("Score"), GUI_MED,
                                      gui_wht, gui_wht);
                        }
                        if ((md = gui_harray(ld)))
                        {
                            coins_id = gui_count(md, 100, GUI_MED);
                            gui_label(md, _("Coins"), GUI_MED,
                                      gui_wht, gui_wht);
                        }

                        gui_set_count(balls_id, balls);
                        gui_set_count(score_id, score);
                        gui_set_count(coins_id, coins);
                    }

                    if ((ld = gui_harray(kd)))
                    {
                        const struct level *l;

                        gui_label(ld, "", GUI_SML, 0, 0);

                        for (i = MAXLVL - 1; i >= 0; i--)
                            if ((l = get_level(i)) && level_bonus(l))
                            {
                                const GLubyte *c = (level_opened(l) ?
                                                    gui_grn : gui_gry);

                                gui_label(ld, level_name(l), GUI_SML, c, c);
                            }

                        gui_label(ld, "", GUI_SML, 0, 0);
                    }

                    gui_set_rect(kd, GUI_ALL);
                }

                /*gui_filler(jd);
            }*/

            gui_space(id);
        }
        else
        {
            gid = gui_label(id, high ? s1 : s2, GUI_LRG, gui_blu, gui_grn);
            gui_space(id);

            balls_id = score_id = coins_id = 0;
        }

        gui_score_board(id, (GUI_SCORE_COIN |
                             GUI_SCORE_TIME |
                             GUI_SCORE_GOAL |
                             GUI_SCORE_SAVE), 1, high);

        gui_space(id);

        if ((jd = gui_harray(id)))
        {
            if      (progress_done())
                gui_start(jd, _("Finish"), GUI_MED, GOAL_DONE, 0);
            else if (progress_last())
                gui_start(jd, _("Finish"), GUI_MED, GOAL_LAST, 0);

            if (progress_next_avail())
                gui_start(jd, _("Next"),  GUI_MED, GOAL_NEXT, 0);

            if (progress_same_avail())
                gui_start(jd, _("Retry"), GUI_MED, GOAL_SAME, 0);

            if (!progress_done() && !progress_last())
                gui_start(jd, _("Quit"), GUI_MED, GOAL_DONE, 0);
            //if (demo_saved())
            //    gui_state(jd, _("Save Replay"), GUI_SML, GOAL_SAVE, 0);
        }

        if (!resume && gid)
            gui_pulse(gid, 1.2f);

        gui_layout(id, 0, 0);

    }

    set_score_board(level_score(curr_level(), SCORE_COIN), progress_coin_rank(),
                    level_score(curr_level(), SCORE_TIME), progress_time_rank(),
                    level_score(curr_level(), SCORE_GOAL), progress_goal_rank());

    return id;
}
예제 #6
0
파일: st_all.c 프로젝트: Aeggy/neverball
static int score_card(const char  *title,
                      const GLubyte *c0,
                      const GLubyte *c1)
{
    int id, jd, kd, ld;

    int p1 = (curr_party() >= 1) ? 1 : 0;
    int p2 = (curr_party() >= 2) ? 1 : 0;
    int p3 = (curr_party() >= 3) ? 1 : 0;
    int p4 = (curr_party() >= 4) ? 1 : 0;

    int i;
    int n = curr_count() - 1;
    int m = curr_count() / 2;

    if ((id = gui_vstack(0)))
    {
        gui_label(id, title, GUI_MED, c0, c1);
        gui_space(id);

        if ((jd = gui_hstack(id)))
        {
            if ((kd = gui_varray(jd)))
            {
                if (p1) gui_label(kd, _("O"),      0, 0, 0);
                if (p1) gui_label(kd, hole_out(0), 0, gui_wht, gui_wht);
                if (p1) gui_label(kd, hole_out(1), 0, gui_red, gui_wht);
                if (p2) gui_label(kd, hole_out(2), 0, gui_grn, gui_wht);
                if (p3) gui_label(kd, hole_out(3), 0, gui_blu, gui_wht);
                if (p4) gui_label(kd, hole_out(4), 0, gui_yel, gui_wht);

                gui_set_rect(kd, GUI_RGT);
            }

            if ((kd = gui_harray(jd)))
            {
                for (i = m; i > 0; i--)
                    if ((ld = gui_varray(kd)))
                    {
                        if (p1) gui_label(ld, number(i), 0, 0, 0);
                        if (p1) gui_label(ld, hole_score(i, 0), 0, gui_wht, gui_wht);
                        if (p1) gui_label(ld, hole_score(i, 1), 0, gui_red, gui_wht);
                        if (p2) gui_label(ld, hole_score(i, 2), 0, gui_grn, gui_wht);
                        if (p3) gui_label(ld, hole_score(i, 3), 0, gui_blu, gui_wht);
                        if (p4) gui_label(ld, hole_score(i, 4), 0, gui_yel, gui_wht);
                    }

                gui_set_rect(kd, GUI_LFT);
            }

            if ((kd = gui_vstack(jd)))
            {
                gui_space(kd);

                if ((ld = gui_varray(kd)))
                {
                    if (p1) gui_label(ld, _("Par"), 0, gui_wht, gui_wht);
                    if (p1) gui_label(ld, _("P1"),  0, gui_red, gui_wht);
                    if (p2) gui_label(ld, _("P2"),  0, gui_grn, gui_wht);
                    if (p3) gui_label(ld, _("P3"),  0, gui_blu, gui_wht);
                    if (p4) gui_label(ld, _("P4"),  0, gui_yel, gui_wht);

                    gui_set_rect(ld, GUI_ALL);
                }
            }
        }

        gui_space(id);

        if ((jd = gui_hstack(id)))
        {
            if ((kd = gui_varray(jd)))
            {
                if (p1) gui_label(kd, _("Tot"),    0, 0, 0);
                if (p1) gui_label(kd, hole_tot(0), 0, gui_wht, gui_wht);
                if (p1) gui_label(kd, hole_tot(1), 0, gui_red, gui_wht);
                if (p2) gui_label(kd, hole_tot(2), 0, gui_grn, gui_wht);
                if (p3) gui_label(kd, hole_tot(3), 0, gui_blu, gui_wht);
                if (p4) gui_label(kd, hole_tot(4), 0, gui_yel, gui_wht);

                gui_set_rect(kd, GUI_ALL);
            }

            if ((kd = gui_varray(jd)))
            {
                if (p1) gui_label(kd, _("I"),     0, 0, 0);
                if (p1) gui_label(kd, hole_in(0), 0, gui_wht, gui_wht);
                if (p1) gui_label(kd, hole_in(1), 0, gui_red, gui_wht);
                if (p2) gui_label(kd, hole_in(2), 0, gui_grn, gui_wht);
                if (p3) gui_label(kd, hole_in(3), 0, gui_blu, gui_wht);
                if (p4) gui_label(kd, hole_in(4), 0, gui_yel, gui_wht);

                gui_set_rect(kd, GUI_RGT);
            }

            if ((kd = gui_harray(jd)))
            {
                for (i = n; i > m; i--)
                    if ((ld = gui_varray(kd)))
                    {
                        if (p1) gui_label(ld, number(i), 0, 0, 0);
                        if (p1) gui_label(ld, hole_score(i, 0), 0, gui_wht, gui_wht);
                        if (p1) gui_label(ld, hole_score(i, 1), 0, gui_red, gui_wht);
                        if (p2) gui_label(ld, hole_score(i, 2), 0, gui_grn, gui_wht);
                        if (p3) gui_label(ld, hole_score(i, 3), 0, gui_blu, gui_wht);
                        if (p4) gui_label(ld, hole_score(i, 4), 0, gui_yel, gui_wht);
                    }

                gui_set_rect(kd, GUI_LFT);
            }

            if ((kd = gui_vstack(jd)))
            {
                gui_space(kd);

                if ((ld = gui_varray(kd)))
                {
                    if (p1) gui_label(ld, _("Par"), 0, gui_wht, gui_wht);
                    if (p1) gui_label(ld, _("P1"),  0, gui_red, gui_wht);
                    if (p2) gui_label(ld, _("P2"),  0, gui_grn, gui_wht);
                    if (p3) gui_label(ld, _("P3"),  0, gui_blu, gui_wht);
                    if (p4) gui_label(ld, _("P4"),  0, gui_yel, gui_wht);

                    gui_set_rect(ld, GUI_ALL);
                }
            }
        }

        gui_layout(id, 0, 0);
    }

    return id;
}
예제 #7
0
static int gui_demo_status(int id)
{
    const char *status;
    int jd, kd, ld;
    int s;

    /* Find the longest status string. */

    for (status = "", s = GAME_NONE; s < GAME_MAX; s++)
        if (strlen(status_to_str(s)) > strlen(status))
            status = status_to_str(s);

    /* Build info bar with dummy values. */

    if ((jd = gui_hstack(id)))
    {
        gui_filler(jd);

        if ((kd = gui_hstack(jd)))
        {
            if ((ld = gui_vstack(kd)))
            {
                gui_filler(ld);

                time_id   = gui_clock(ld, 35000,  GUI_SML);
                coin_id   = gui_count(ld, 100,    GUI_SML);
                status_id = gui_label(ld, status, GUI_SML, gui_red, gui_red);

                gui_filler(ld);
            }

            if ((ld = gui_vstack(kd)))
            {
                gui_filler(ld);

                gui_label(ld, _("Time"),   GUI_SML, gui_wht, gui_wht);
                gui_label(ld, _("Coins"),  GUI_SML, gui_wht, gui_wht);
                gui_label(ld, _("Status"), GUI_SML, gui_wht, gui_wht);

                gui_filler(ld);
            }

            gui_set_rect(kd, GUI_ALL);
        }

        gui_space(jd);

        if ((kd = gui_hstack(jd)))
        {
            if ((ld = gui_vstack(kd)))
            {
                gui_filler(ld);

                name_id   = gui_label(ld, " ", GUI_SML, 0, 0);
                player_id = gui_label(ld, " ", GUI_SML, 0, 0);
                date_id   = gui_label(ld, date_to_str(time(NULL)),
                                      GUI_SML, 0, 0);

                gui_filler(ld);

                gui_set_trunc(name_id,   TRUNC_TAIL);
                gui_set_trunc(player_id, TRUNC_TAIL);
            }

            if ((ld = gui_vstack(kd)))
            {
                gui_filler(ld);

                gui_label(ld, _("Replay"), GUI_SML, gui_wht, gui_wht);
                gui_label(ld, _("Player"), GUI_SML, gui_wht, gui_wht);
                gui_label(ld, _("Date"),   GUI_SML, gui_wht, gui_wht);

                gui_filler(ld);
            }

            gui_set_rect(kd, GUI_ALL);
        }

        gui_filler(jd);
    }

    return jd;
}