Back to index

extremetuxracer  0.5beta
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes
ConfigMode Class Reference

#include <configmode.h>

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

List of all members.

Public Member Functions

 ConfigMode ()
 ~ConfigMode ()
void loop (float timeStep)
void drawTextandWidgets ()
bool keyPressEvent (SDLKey key)
void cancel ()
virtual void customLoop (float timeStep)
virtual void setWidgetPositions ()=0
virtual void apply ()=0
virtual bool keyboardEvent (SDLKey key, bool release)
virtual bool keyReleaseEvent (SDLKey key)
virtual bool mouseButtonEvent (int button, int x, int y, bool pressed)
virtual bool mouseButtonPressEvent (int button, int x, int y)
virtual bool mouseButtonReleaseEvent (int button, int x, int y)

Static Public Attributes

static GameModecurrentMode = NULL
static game_mode_t mode
static game_mode_t prevmode

Protected Member Functions

void setTitle (const char *title)
void drawSnow (float timeStep, bool windy=false)
 custom function for drawing snow in the ui

Protected Attributes

pp::Buttonmp_cancelBtn
pp::Buttonmp_applyBtn
pp::Labelmp_titleLbl
std::string m_title

Detailed Description

Definition at line 31 of file configmode.h.


Constructor & Destructor Documentation

Definition at line 23 of file configmode.cpp.

{
       pp::Vec2d pos(0,0);
              
       mp_titleLbl = new pp::Label(pos,
                                   "heading", "");
       mp_titleLbl->alignment.center();
       mp_titleLbl->alignment.middle();
                                                        
       
       mp_cancelBtn = new pp::Button(pos,
                                 pp::Vec2d(300, 40),
                                 "button_label",
                                 _("Cancel") );
    mp_cancelBtn->setHilitFontBinding( "button_label_hilit" );
    mp_cancelBtn->signalClicked.Connect(pp::CreateSlot(this,&ConfigMode::cancel));
   
       mp_applyBtn = new pp::Button(pos,
                                 pp::Vec2d(300, 40), 
                                 "button_label", 
                                 _("Ok") );
    mp_applyBtn->setHilitFontBinding( "button_label_hilit" );
    mp_applyBtn->signalClicked.Connect(pp::CreateSlot(this,&ConfigMode::apply));
}

Here is the call graph for this function:

Definition at line 48 of file configmode.cpp.

{
       delete mp_cancelBtn;
       delete mp_applyBtn;
       delete mp_titleLbl;
}

Member Function Documentation

virtual void ConfigMode::apply ( ) [pure virtual]

Implemented in JoystickConfig, VideoConfig, KeyboardConfig, AudioConfig, and GraphicsConfig.

Here is the caller graph for this function:

Definition at line 112 of file configmode.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void ConfigMode::customLoop ( float  timeStep) [inline, virtual]

Definition at line 53 of file configmode.h.

{};

Here is the caller graph for this function:

void GameMode::drawSnow ( float  timeStep,
bool  windy = false 
) [protected, inherited]

custom function for drawing snow in the ui

Definition at line 203 of file loop.cpp.

{
       // check wether ui snow is 
       if(getparam_ui_snow()){
              // update and draw snow
              update_ui_snow( timeStep, windy );
              draw_ui_snow();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 86 of file configmode.cpp.

{
       int w = getparam_x_resolution();
    int h = getparam_y_resolution();

       mp_cancelBtn->setPosition(pp::Vec2d(w/2-300,h/2-240));
       mp_applyBtn->setPosition(pp::Vec2d(w/2,h/2-240));
       mp_titleLbl->setPosition(pp::Vec2d(w/2,h/2+200));
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool GameMode::keyboardEvent ( SDLKey  key,
bool  release 
) [inline, virtual, inherited]

Reimplemented in Racing.

Definition at line 90 of file loop.h.

{return false;};
bool ConfigMode::keyPressEvent ( SDLKey  key) [virtual]

Reimplemented from GameMode.

Definition at line 97 of file configmode.cpp.

{
       switch (key){
              case SDLK_ESCAPE:
                     cancel();
              return true;
              case SDLK_RETURN:
                     apply();
              return true;
              default:
                     return false;
       }
}

Here is the call graph for this function:

virtual bool GameMode::keyReleaseEvent ( SDLKey  key) [inline, virtual, inherited]

Reimplemented in HighscoreShow, and SplashScreen.

Definition at line 92 of file loop.h.

{return false;};
void ConfigMode::loop ( float  timeStep) [virtual]

Implements GameMode.

Definition at line 56 of file configmode.cpp.

{
       update_audio();
    set_gl_options( GUI );
    clear_rendering_context();
    UIMgr.setupDisplay();
       
       drawTextandWidgets();
       
       // forces the config mode to update it's widget positions
       // perhaps we should call this only when the screen size changes
       setWidgetPositions();
       
       // calls the custom loop of the derived class (if it exists)
       customLoop( timeStep );
       
       // draw snow if enabled
       drawSnow( timeStep );
       
       theme.drawMenuDecorations();
       
       // draw ui widgets
    UIMgr.draw();
       
       
    reshape( getparam_x_resolution(), getparam_y_resolution() );
    winsys_swap_buffers();
}

Here is the call graph for this function:

virtual bool GameMode::mouseButtonEvent ( int  button,
int  x,
int  y,
bool  pressed 
) [inline, virtual, inherited]

Reimplemented in GameOver.

Definition at line 94 of file loop.h.

{return false;};
virtual bool GameMode::mouseButtonPressEvent ( int  button,
int  x,
int  y 
) [inline, virtual, inherited]

Definition at line 95 of file loop.h.

{return false;};
virtual bool GameMode::mouseButtonReleaseEvent ( int  button,
int  x,
int  y 
) [inline, virtual, inherited]

Reimplemented in CreditsTrans, and SplashScreen.

Definition at line 96 of file loop.h.

{return false;};
void ConfigMode::setTitle ( const char *  title) [protected]

Definition at line 119 of file configmode.cpp.

{
       mp_titleLbl->setText(title);
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void ConfigMode::setWidgetPositions ( ) [pure virtual]

Implemented in JoystickConfig, VideoConfig, KeyboardConfig, AudioConfig, and GraphicsConfig.

Here is the caller graph for this function:


Member Data Documentation

GameMode * GameMode::currentMode = NULL [static, inherited]

Definition at line 96 of file loop.h.

std::string ConfigMode::m_title [protected]

Definition at line 38 of file configmode.h.

game_mode_t GameMode::mode [static, inherited]

Definition at line 99 of file loop.h.

Definition at line 35 of file configmode.h.

Definition at line 34 of file configmode.h.

Definition at line 36 of file configmode.h.

game_mode_t GameMode::prevmode [static, inherited]

Definition at line 100 of file loop.h.


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