コード例 #1
0
ファイル: MenuScreen.cpp プロジェクト: jcarvajal288/RLEngine
    /*--------------------------------------------------------------------------------
        Function    : InventoryScreen::eventLoop
        Description : Event loop for the inventory screen.
        Inputs      : None
        Outputs     : Results of the player's actions in the inventory.
        Return      : bool (whether the action costs a turn)
    --------------------------------------------------------------------------------*/
    bool InventoryScreen::eventLoop()
    {
        EventHandler eventHandler;
        EventType event;

        do
        {
            update();
            event = eventHandler.getPlayerInput();
            interpretEvent(event);
        }
        while(keepRunning);

        return false;
    }
コード例 #2
0
ファイル: MenuScreen.cpp プロジェクト: jcarvajal288/RLEngine
    /*--------------------------------------------------------------------------------
        Function    : MenuScreen::eventLoop
        Description : Governs the actions that the player can perform while viewing 
                      this menu screen.  In this base class, this is just a boiler
                      plate 'hello world' function, just to make sure that menu
                      screens work correctly.
        Inputs      : None
        Outputs     : Actions of the menu screen
        Return      : bool (whether the action performed in the menu screen consumes 
                      a turn)
    --------------------------------------------------------------------------------*/
    bool MenuScreen::eventLoop()
    {
        EventHandler eventHandler;

        do
        {
            screen.clear();
            display->refresh();
            refresh();

            // now draw the screen on the playfield
            display->playfield()->blit(&screen, 0, 0, 
                                       screen.getWidth(), 
                                       screen.getHeight(),
                                       display->playfield().get(), 
                                       0, 0, 1.0f, 0.7f);

            display->draw();
            TCODConsole::flush();
        }
        while(eventHandler.getPlayerInput() != CANCEL);

        return false;
    }