Example #1
0
static void demo_stick(int id, int a, float v, int bump)
{
    int jd = shared_stick_basic(id, a, v, bump);

    if (jd && gui_token(jd) == DEMO_SELECT)
        gui_demo_update_status(gui_value(jd));
}
Example #2
0
static void demo_point(int id, int x, int y, int dx, int dy)
{
    int jd = shared_point_basic(id, x, y);

    if (jd && gui_token(jd) == DEMO_SELECT)
        gui_demo_update_status(gui_value(jd));
}
Example #3
0
int common_click(int b, int d)
{
    if (gui_click(b, d))
    {
        int active = gui_active();
        return common_action(gui_token(active), gui_value(active));
    }
    return 1;
}
Example #4
0
static int resol_click(int b, int d)
{
    if (gui_click(b, d))
    {
        int active = gui_active();

        return resol_action(gui_token(active), gui_value(active));
    }
    return 1;
}
Example #5
0
static void goal_timer(int id, float dt)
{
    if (!resume)
    {
        static float t = 0.0f;

        t += dt;

        if (time_state() < 1.f)
        {
            game_server_step(dt);
            game_client_sync(demo_fp);
            game_client_blend(game_server_blend());
        }
        else if (t > 0.05f && coins_id)
        {
            int coins = gui_value(coins_id);

            if (coins > 0)
            {
                int score = gui_value(score_id);
                int balls = gui_value(balls_id);

                gui_set_count(coins_id, coins - 1);
                gui_pulse(coins_id, 1.1f);

                gui_set_count(score_id, score + 1);
                gui_pulse(score_id, 1.1f);

                if (progress_reward_ball(score + 1))
                {
                    gui_set_count(balls_id, balls + 1);
                    gui_pulse(balls_id, 2.0f);
                    audio_play(AUD_BALL, 1.0f);
                }
            }
            t = 0.0f;
        }
    }

    gui_timer(id, dt);
}
Example #6
0
static int goal_buttn(int b, int d)
{
    if (d)
    {
        int active = gui_active();

        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
            return goal_action(gui_token(active), gui_value(active));
        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_B, b))
            return goal_action(GUI_BACK, 0);
    }
    return 1;
}
Example #7
0
static int title_buttn(int b, int d)
{
    if (d)
    {
        int active = gui_active();

        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
            return title_action(gui_token(active), gui_value(active));
        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
            return 0;
    }
    return 1;
}
Example #8
0
static int demo_del_buttn(int b, int d)
{
    if (d)
    {
        int active = gui_active();

        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
            return demo_del_action(gui_token(active), gui_value(active));
        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_B, b))
            return demo_del_action(DEMO_KEEP, 0);
    }
    return 1;
}
Example #9
0
static int pause_buttn(int b, int d)
{
    if (d)
    {
        int active = gui_active();

        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
            return pause_action(gui_token(active), gui_value(active));

        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_B, b) ||
            config_tst_d(CONFIG_JOYSTICK_BUTTON_START, b))
            return pause_action(PAUSE_CONTINUE, 0);
    }
    return 1;
}
Example #10
0
void hud_timer(float dt)
{
    const int clock = curr_clock();
    const int balls = curr_balls();
    const int coins = curr_coins();
    const int score = curr_score();
    const int goal  = curr_goal();

    if (gui_value(time_id) != clock) gui_set_clock(time_id, clock);
    if (gui_value(ball_id) != balls) gui_set_count(ball_id, balls);
    if (gui_value(scor_id) != score) gui_set_count(scor_id, score);
    if (gui_value(coin_id) != coins) gui_set_count(coin_id, coins);
    if (gui_value(goal_id) != goal)  gui_set_count(goal_id, goal);

    if (config_get_d(CONFIG_FPS))
        hud_fps();

    view_timer -= dt;

    gui_timer(Rhud_id, dt);
    gui_timer(Lhud_id, dt);
    gui_timer(time_id, dt);
    gui_timer(view_id, dt);
}
Example #11
0
static int name_buttn(int b, int d)
{
    if (d)
    {
        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
        {
            int tok = gui_token(gui_active());
            int val = gui_value(gui_active());

            return name_action(tok, (tok == GUI_CHAR ?
                                     gui_keyboard_char(val) :
                                     val));
        }
        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_B, b))
            name_action(GUI_BACK, 0);
    }
    return 1;
}
Example #12
0
static void start_over(int id, int pulse)
{
    if (id)
    {
        if (pulse)
            gui_pulse(id, 1.2f);

        if (gui_token(id) == START_LEVEL)
        {
            start_over_level(gui_value(id));
        }
        else
        {
            gui_set_image(shot_id, set_shot(curr_set()));

            set_score_board(set_score(curr_set(), SCORE_COIN), -1,
                            set_score(curr_set(), SCORE_TIME), -1,
                            NULL, -1);
        }
    }
}
Example #13
0
static int demo_end_buttn(int b, int d)
{
    if (d)
    {
        int active = gui_active();

        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
            return demo_end_action(gui_token(active), gui_value(active));

        if (demo_paused)
        {
            if (config_tst_d(CONFIG_JOYSTICK_BUTTON_B, b) ||
                config_tst_d(CONFIG_JOYSTICK_BUTTON_START, b))
                return demo_end_action(DEMO_CONTINUE, 0);
        }
        else
        {
            if (config_tst_d(CONFIG_JOYSTICK_BUTTON_B, b))
                return demo_end_action(standalone ? DEMO_QUIT : DEMO_KEEP, 0);
        }
    }
    return 1;
}