Back to index

supertuxkart  0.5+dfsg1
Public Member Functions | Protected Attributes | Private Attributes
ChallengesMenu Class Reference

#include <challenges_menu.hpp>

Inheritance diagram for ChallengesMenu:
Inheritance graph
[legend]
Collaboration diagram for ChallengesMenu:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ChallengesMenu ()
 ~ChallengesMenu ()
void select ()
void update (float dt)
virtual void handle (GameAction, int)
virtual void inputKeyboard (SDLKey, int)
virtual void countdown ()
void inputPointer (int x, int y)
void lockInput ()
void unlockInput ()
void TimeToString (const double time, char *s)

Protected Attributes

bool m_locked
int m_menu_id

Private Attributes

std::vector< const Challenge * > m_all_challenges

Detailed Description

Definition at line 27 of file challenges_menu.hpp.


Constructor & Destructor Documentation

Definition at line 34 of file challenges_menu.cpp.

{
    widget_manager->addTitleWgt( WTOK_TITLE, 60, 10, _("Active Challenges"));
    widget_manager->breakLine();

    m_all_challenges=unlock_manager->getActiveChallenges();
    for(int i=0; i<(int)m_all_challenges.size(); i++)
    {
        widget_manager->addTextButtonWgt(WTOK_CHALLENGES+i, 60, 10,
            _(m_all_challenges[i]->getName().c_str()) );
        widget_manager->breakLine();
    }

    widget_manager->addTextButtonWgt( WTOK_DESCRIPTION, 60, 30, "");
    widget_manager->breakLine();

    widget_manager->addTextButtonWgt(WTOK_BACK, 50, 7,
        _("Go back to the main menu"));

    widget_manager->layout(WGT_AREA_ALL);
}   // ChallengesMenu

Here is the call graph for this function:

Definition at line 57 of file challenges_menu.cpp.

{
    widget_manager->reset();
}   // ~ChallengesMenu

Here is the call graph for this function:


Member Function Documentation

void BaseGUI::countdown ( ) [virtual, inherited]

Reimplemented in DisplayResConfirm.

Definition at line 147 of file base_gui.cpp.

{
}
void BaseGUI::handle ( GameAction  action,
int  value 
) [virtual, inherited]

Reimplemented in RaceGUI, LeaderResult, PlayerControls, RaceResultsGUI, DisplayResConfirm, MainMenu, Options, and RaceMenu.

Definition at line 43 of file base_gui.cpp.

{
    if( m_locked ) return;

    // Skip on keypress, act on keyrelease only.
    if (value) return;

       int previous = widget_manager->getSelectedWgt();

    switch ( action )
    {
    case GA_CURSOR_LEFT:
              animateWidget(previous,
                                     widget_manager->handleLeft());

              break;
    case GA_CURSOR_RIGHT:
              animateWidget(previous,
                                     widget_manager->handleRight());
              break;
    case GA_CURSOR_UP:
              animateWidget(previous,
                                     widget_manager->handleUp());
              break;
    case GA_CURSOR_DOWN:
              animateWidget(previous,
                                     widget_manager->handleDown());
              break;
       case GA_INC_SCROLL_SPEED:
              widget_manager->increaseScrollSpeed();
              break;
       case GA_INC_SCROLL_SPEED_FAST:
              widget_manager->increaseScrollSpeed(true);
              break;
       case GA_DEC_SCROLL_SPEED:
              widget_manager->decreaseScrollSpeed();
              break;
       case GA_DEC_SCROLL_SPEED_FAST:
              widget_manager->decreaseScrollSpeed(true);
              break;
    case GA_ENTER:
        select();
        break;
    case GA_LEAVE:
        if (menu_manager->getMenuStackSize() > 1)
        {
           if(menu_manager->isCurrentMenu(MENUID_RACEMENU))
             world->unpause();

           menu_manager->popMenu();
        }
        break;

    default:
        break;
    }   // switch
}   // handle

Here is the call graph for this function:

Here is the caller graph for this function:

void BaseGUI::inputKeyboard ( SDLKey  ,
int   
) [virtual, inherited]

Reimplemented in PlayerControls.

Definition at line 139 of file base_gui.cpp.

{
       // This method is not supposed to be called since BaseGUI does not
       // handle low-level keyboard input.
       assert(false);
}

Here is the caller graph for this function:

void BaseGUI::inputPointer ( int  x,
int  y 
) [inherited]

Definition at line 102 of file base_gui.cpp.

{
    if( m_locked ) return;

    const int PREV_SELECTED_WGT = widget_manager->getSelectedWgt();
    const int SELECTED_WGT = widget_manager->handlePointer( x, y );

    if( SELECTED_WGT != WidgetManager::WGT_NONE )
    {
        if( PREV_SELECTED_WGT != WidgetManager::WGT_NONE )
        {
            widget_manager->darkenWgtColor( PREV_SELECTED_WGT );
        }

        widget_manager->lightenWgtColor( SELECTED_WGT );
        widget_manager->pulseWgt( SELECTED_WGT );
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void BaseGUI::lockInput ( ) [inline, inherited]

Definition at line 49 of file base_gui.hpp.

{ m_locked = true; }
void ChallengesMenu::select ( ) [virtual]

Implements BaseGUI.

Definition at line 75 of file challenges_menu.cpp.

Here is the call graph for this function:

void BaseGUI::TimeToString ( const double  time,
char *  s 
) [inherited]

Definition at line 130 of file base_gui.cpp.

{
    int min     = (int) floor ( TIME / 60.0 ) ;
    int sec     = (int) floor ( TIME - (double) ( 60 * min ) ) ;
    int tenths  = (int) floor ( 10.0f * (TIME - (double)(sec + 60* min)));
    sprintf ( s, "%d:%02d:%d", min,  sec,  tenths ) ;
}   // TimeToString

Here is the caller graph for this function:

void BaseGUI::unlockInput ( ) [inline, inherited]

Definition at line 50 of file base_gui.hpp.

{ m_locked = false; }
void ChallengesMenu::update ( float  dt) [virtual]

Reimplemented from BaseGUI.

Definition at line 63 of file challenges_menu.cpp.

{
    const int challenge= widget_manager->getSelectedWgt() - WTOK_CHALLENGES;
    if(challenge>=0 && challenge<(int)m_all_challenges.size())
    {
        widget_manager->setWgtText(WTOK_DESCRIPTION,
            m_all_challenges[challenge]->getChallengeDescription());
    }
    widget_manager->update(dt);
}   // update

Here is the call graph for this function:


Member Data Documentation

std::vector<const Challenge*> ChallengesMenu::m_all_challenges [private]

Definition at line 30 of file challenges_menu.hpp.

bool BaseGUI::m_locked [protected, inherited]

Definition at line 55 of file base_gui.hpp.

int BaseGUI::m_menu_id [protected, inherited]

Definition at line 56 of file base_gui.hpp.


The documentation for this class was generated from the following files: