示例#1
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_key_down(UINT keysym)
{
#ifndef DISABLE_LIBSIGC
    Globals g;

    if (keysym == SDLK_ESCAPE)
    {
        if(mb_grab_key)
        {
            mb_grab_key = false;
            g.sound().play(g.soundlist().get_random_sound(SND_MENU_MOVE));
        }
        else
        {
            g.sound().play(g.soundlist().get_random_sound(SND_MENU_EXIT));
            input().set_ok();
            next_state();
        }
        return;
    }

    if (!mb_grab_key)
    {
        if (keysym == SDLK_DOWN)
        {
            g.sound().play(g.soundlist().get_random_sound(SND_MENU_MOVE));
            m_con_active.on_key_down(SDLK_TAB);
            return;
        }
        else
        {
            if (keysym == SDLK_UP)
            {
                g.sound().play(g.soundlist().get_random_sound(SND_MENU_MOVE));
                m_con_active.tab_backward();
                return;
            }
            else
            {
                if (keysym == SDLK_LEFT || keysym == SDLK_RIGHT)
                {
                    for (int i = 0; i < 6; ++i)
                    {
                        m_con_active.on_key_down(SDLK_TAB);
                    }
                    g.sound().play(g.soundlist().get_random_sound(SND_MENU_MOVE));
                    return;
                }
            }
        }

        g.sound().play(g.soundlist().get_random_sound(SND_MENU_MOVE));
        m_con_active.on_key_down(keysym);
    }
    else
    {
        g.sound().play(g.soundlist().get_random_sound(SND_MENU_EXIT));
        mb_grab_key = false;
        mp_keyconfig->player_keys_change(m_which_player).set_key(m_player_keys, keysym);
    }
#endif // DISABLE_LIBSIGC
}