Back to index

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

#include <game_type_select.h>

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

List of all members.

Public Member Functions

 GameTypeSelect ()
 ~GameTypeSelect ()
void loop (float timeStep)
bool keyPressEvent (SDLKey key)
void eventSelect ()
void credits ()
void practice ()
void highscore ()
void configuration ()
void quit ()
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 drawSnow (float timeStep, bool windy=false)
 custom function for drawing snow in the ui

Private Member Functions

void setWidgetPositions ()

Private Attributes

pp::Buttonmp_enterEventBtn
pp::Buttonmp_practiceBtn
pp::Buttonmp_configureBtn
pp::Buttonmp_creditsBtn
pp::Buttonmp_quitBtn
pp::Buttonmp_highscoreBtn

Detailed Description

Definition at line 27 of file game_type_select.h.


Constructor & Destructor Documentation

Definition at line 29 of file game_type_select.cpp.

{
       pp::Vec2d pos(0,0);

    mp_enterEventBtn = new pp::Button(pos,
                                 pp::Vec2d(300, 40), 
                                 "button_label", 
                                 _("Enter a campaign") );
    mp_enterEventBtn->setHilitFontBinding( "button_label_hilit" );
    mp_enterEventBtn->signalClicked.Connect(pp::CreateSlot(this,&GameTypeSelect::eventSelect));

    mp_practiceBtn = new pp::Button(pos,
                              pp::Vec2d(300, 40),
                              "button_label",
                              _("Practice")      );
    mp_practiceBtn->setHilitFontBinding( "button_label_hilit" );
    mp_practiceBtn->signalClicked.Connect(pp::CreateSlot(this,&GameTypeSelect::practice));

    mp_highscoreBtn = new pp::Button(pos,
                              pp::Vec2d(300, 40),
                              "button_label",
                              _("Highscore")     );
    mp_highscoreBtn->setHilitFontBinding( "button_label_hilit" );
    mp_highscoreBtn->signalClicked.Connect(pp::CreateSlot(this,&GameTypeSelect::highscore));

       mp_configureBtn = new pp::Button(pos,
                              pp::Vec2d(300, 40),
                              "button_label",
                              _("Configuration") );
    mp_configureBtn->setHilitFontBinding( "button_label_hilit" );
    mp_configureBtn->signalClicked.Connect(pp::CreateSlot(this,&GameTypeSelect::configuration));

       mp_creditsBtn = new pp::Button(pos,
                              pp::Vec2d(300, 40),
                              "button_label",
                              _("Credits") );
    mp_creditsBtn->setHilitFontBinding( "button_label_hilit" );
       mp_creditsBtn->signalClicked.Connect(pp::CreateSlot(this,&GameTypeSelect::credits));

       mp_quitBtn = new pp::Button(pos,
                           pp::Vec2d(300, 40),
                           "button_label",
                           _("Quit") );

       mp_quitBtn->setHilitFontBinding( "button_label_hilit" );
    mp_quitBtn->signalClicked.Connect(pp::CreateSlot(this,&GameTypeSelect::quit));

    play_music( "start_screen" );  
}

Here is the call graph for this function:

Definition at line 79 of file game_type_select.cpp.

{
       delete mp_enterEventBtn;
       delete mp_practiceBtn;
       delete mp_highscoreBtn;
       delete mp_configureBtn;
       delete mp_creditsBtn;
       delete mp_quitBtn;   
}

Member Function Documentation

Definition at line 221 of file game_type_select.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 198 of file game_type_select.cpp.

Here is the call graph for this function:

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 189 of file game_type_select.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 214 of file game_type_select.cpp.

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 GameTypeSelect::keyPressEvent ( SDLKey  key) [virtual]

Reimplemented from GameMode.

Definition at line 166 of file game_type_select.cpp.

{
       switch (key){
              case 'q':
              case 27: // Esc 
                     winsys_exit(0);
              return true;;
              case 'e':
              case 13: // Enter
                     mp_enterEventBtn->simulateMouseClick();
              return true;
              case 'p':
                     mp_practiceBtn->simulateMouseClick();
                     return true;
              case 'c':
                     mp_creditsBtn->simulateMouseClick();
                     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 GameTypeSelect::loop ( float  timeStep) [virtual]

Implements GameMode.

Definition at line 90 of file game_type_select.cpp.

{
       update_audio();

    set_gl_options( GUI );

    clear_rendering_context();

    setWidgetPositions();

    UIMgr.setupDisplay();

       drawSnow(timeStep);

    theme.drawMenuDecorations();

    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;};

Definition at line 205 of file game_type_select.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 228 of file game_type_select.cpp.

{
       winsys_exit( 0 );
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 115 of file game_type_select.cpp.

{
    pp::Button* button_list[] = { mp_enterEventBtn,
                              mp_practiceBtn,
                              mp_highscoreBtn,
                              mp_configureBtn,
                              mp_creditsBtn,
                              mp_quitBtn };
    int w = getparam_x_resolution();
    int h = getparam_y_resolution();
    int box_height;
    int box_max_y;
    int top_y;
    int bottom_y;
    int num_buttons = sizeof( button_list ) / sizeof( button_list[0] );
    int i;
    int tot_button_height = 0;
    int button_sep =0;
    int cur_y_pos;

    box_height = 210;
    box_max_y = h - 128;

    bottom_y = int(0.4*h - box_height/2);

    if ( bottom_y + box_height > box_max_y ) {
       bottom_y = box_max_y - box_height;
    }

    top_y = bottom_y + box_height;

    for (i=0; i<num_buttons; i++) {
              tot_button_height += int(button_list[i]->getHeight());
    }

    if ( num_buttons > 1 ) {
       button_sep = ( top_y - bottom_y - tot_button_height ) / 
           ( num_buttons - 1 );
       button_sep = MAX( 0, button_sep );
    }

    cur_y_pos = top_y;
    for (i=0; i<num_buttons; i++) {
       cur_y_pos -= int(button_list[i]->getHeight());
       button_list[i]->setPosition(pp::Vec2d( w/2.0 - button_list[i]->getWidth()/2.0,
                       cur_y_pos ) );
       cur_y_pos -= button_sep;
    }
}

Here is the call graph for this function:

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.

game_mode_t GameMode::mode [static, inherited]

Definition at line 99 of file loop.h.

Definition at line 31 of file game_type_select.h.

Definition at line 32 of file game_type_select.h.

Definition at line 29 of file game_type_select.h.

Definition at line 34 of file game_type_select.h.

Definition at line 30 of file game_type_select.h.

Definition at line 33 of file game_type_select.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: