示例#1
0
    void
    Outro::on_draw()
    {
        if (m_snd_game_exit != NULL)
        {
            if (timer_elapsed() > static_cast<unsigned int>(m_snd_game_exit->length_in_ms) + 100)
            {
                next_state();
            }
        }

        Globals g;

        g.render().DrawTile(0,0, g.values().res_w(), g.values().res_h(), m_img_mainmenu);

        string text1 = g.snd2txt().text();
        string text2 = "";

        if (text1.length() >= 25)
        {
            text2 = text1;
            text1.erase(25, string::npos);
            text2.erase(0, 25);
        }
        g.render().DrawText(500, 400, 1.0, 1.0, 1.0, text1);
        g.render().DrawText(500, 450, 1.0, 1.0, 1.0, text2);
    }
示例#2
0
    void
    Outro::on_enter()
    {
        Globals g;

        string snd = g.soundlist().get_random_sound(SND_GAME_EXIT);
        m_snd_game_exit = g.sound().load(snd);
        m_img_mainmenu = g.render().LoadTexture(g.images().mainmenu());
        timer_reset();
        timer_start();

        g.sound().play(m_snd_game_exit);
        g.snd2txt().lookup(snd);

        g.render().SetTextSizes(32, 32);
    }
void
ConfigureKeys::on_draw()
{
#ifndef DISABLE_LIBSIGC
    Globals g;

    // background image
    g.render().DrawTile(0, 0, g.values().res_w(), g.values().res_h(), m_bg);

    int width  = g.values().res_w();
    int half   = width / 2;
    int quarter= width / 4;

    SDL_Rect top = {quarter - 220, 80, width - 2*(quarter-220), 80};
    SDL_Rect rl  = {quarter - 220, 170, half - 50, 500};
    SDL_Rect rr  = {half + (half -(quarter - 220 + (half - 50))), 170, half - 50, 500};

    g.render().FillRect(top,.0, .0, .0, 0.5f);
    g.render().FillRect(rl ,.0, .0, .0, 0.5f);
    g.render().FillRect(rr ,.0, .0, .0, 0.5f);

    m_con_active.draw_all();
    m_con_passive.draw_all();

    draw_player_keys();

    m_anim_bomb.Update();

    if (mb_grab_key)
    {
        draw_grab_key();
        m_anim_bomb.Draw(quarter - 185, 740, 50, 50);
        m_anim_bomb.Draw(quarter - 220 + (width - 2*(quarter-220)) - 45, 740, 50, 50);
    }
    else
    {
        int index = m_con_active.current_focused();
        m_anim_bomb.Draw(quarter-145 + 512*(index>5?1:0), 142 + 75*((index>5?(index-6):index)+1), 50, 50);
    }
#endif // DISABLE_LIBSIGC
}
void
ConfigureKeys::on_exit()
{
#ifndef DISABLE_LIBSIGC
    Globals g;

    g.render().DeleteTexture(m_bg);
    SDL_EnableKeyRepeat(0, 0); // 0,0 disables key-repeat

    m_con_active.clear();
    m_con_passive.clear();
#endif // DISABLE_LIBSIGC
}
void
ConfigureKeys::draw_grab_key()
{
    Globals g;
    int width  = g.values().res_w();
    int height = g.values().res_h();
    int quarter= width / 4;

    SDL_Rect r = {quarter - 220, 680, width - 2*(quarter-220), 70};

    g.render().FillRect(r, .0, .0, .0, .5f);

    string str = "Press a key for ";

    switch (m_which_player)
    {
        case 0: str += "Player 1!"; break;
        case 1: str += "Player 2!"; break;
    }

    g.render().SetTextSizes(24, 24);
    g.render().DrawText(r, 255, 255, 255, str);
}
void
ConfigureKeys::on_enter()
{
#ifndef DISABLE_LIBSIGC
    Globals g;

    SDL_EnableKeyRepeat(g.values().get(VAL_MENU_KEYREPEAT_DELAY), g.values().get(VAL_MENU_KEYREPEAT_INTERVAL));

    create_key_map();
    create_gui();

    mb_grab_key = false;
    m_which_player = 0;

    m_bg = g.render().LoadTexture(g.images().background_random());

    m_anim_bomb.SetAnimation(ANI_BOMB);
    m_anim_bomb.Start();

    mp_keyconfig    = &g.keycfg();

    g.render().SetTextSizes(16, 16);
#endif // DISABLE_LIBSIGC
}
void
ConfigureKeys::draw_player_keys()
{
    int d = 75;
    Globals g;
    g.render().SetTextSizes(16, 16);

    g.render().DrawText(380, 112 + 1*d, 255, 255, 255, m_map_keys[mp_keyconfig->player_keys(0).key(KEY_UP)]);
    g.render().DrawText(380, 112 + 2*d, 255, 255, 255, m_map_keys[mp_keyconfig->player_keys(0).key(KEY_DOWN)]);
    g.render().DrawText(380, 112 + 3*d, 255, 255, 255, m_map_keys[mp_keyconfig->player_keys(0).key(KEY_LEFT)]);
    g.render().DrawText(380, 112 + 4*d, 255, 255, 255, m_map_keys[mp_keyconfig->player_keys(0).key(KEY_RIGHT)]);
    g.render().DrawText(380, 112 + 5*d, 255, 255, 255, m_map_keys[mp_keyconfig->player_keys(0).key(KEY_BOMB)]);
    g.render().DrawText(380, 112 + 6*d, 255, 255, 255, m_map_keys[mp_keyconfig->player_keys(0).key(KEY_SPECIAL)]);

    g.render().DrawText(890, 112 + 1*d, 255, 255, 255, m_map_keys[mp_keyconfig->player_keys(1).key(KEY_UP)]);
    g.render().DrawText(890, 112 + 2*d, 255, 255, 255, m_map_keys[mp_keyconfig->player_keys(1).key(KEY_DOWN)]);
    g.render().DrawText(890, 112 + 3*d, 255, 255, 255, m_map_keys[mp_keyconfig->player_keys(1).key(KEY_LEFT)]);
    g.render().DrawText(890, 112 + 4*d, 255, 255, 255, m_map_keys[mp_keyconfig->player_keys(1).key(KEY_RIGHT)]);
    g.render().DrawText(890, 112 + 5*d, 255, 255, 255, m_map_keys[mp_keyconfig->player_keys(1).key(KEY_BOMB)]);
    g.render().DrawText(890, 112 + 6*d, 255, 255, 255, m_map_keys[mp_keyconfig->player_keys(1).key(KEY_SPECIAL)]);
}