Back to index

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

#include <highscore.h>

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

List of all members.

Public Member Functions

 HighscoreShow ()
 ~HighscoreShow ()
void loop (float timeStep)
bool keyReleaseEvent (SDLKey key)
void back ()
void updateStatus ()
virtual bool keyboardEvent (SDLKey key, bool release)
virtual bool keyPressEvent (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 Attributes

pp::Listbox< HighscoreData > * mp_raceListBox
std::list< HighscoreDatam_raceList
pp::Labelmp_titleLbl
pp::Labelmp_post [10]
pp::Buttonmp_backBtn

Detailed Description

Definition at line 98 of file highscore.h.


Constructor & Destructor Documentation

Definition at line 340 of file highscore.cpp.

 {
 /*
  : m_titleLbl(_("Highscore"),"heading"),
 m_raceListBox(450,36),
 m_backBtn(_("Back"))
 */
       pp::Vec2d pos( getparam_x_resolution()/2,
                               getparam_y_resolution()/2+130);
       
       mp_titleLbl = new pp::Label(pos,"heading",_("Highscore"));
       mp_titleLbl->alignment.center();
       
       if(Highscore->level_hs_length>0) {
              std::list<std::string> courses=Highscore->getCourseList();
              m_raceList = Highscore->getCourseList_hd();
              
              pos.y-=60;
              
              mp_raceListBox = new pp::Listbox<HighscoreData>(pp::Vec2d(pos.x-200,pos.y),
                                      pp::Vec2d(450,36),
                                      "listbox_item",
                                      m_raceList);
              
              mp_raceListBox->alignment.center();
              mp_raceListBox->signalChange.Connect(pp::CreateSlot(this,&HighscoreShow::updateStatus));
              
              curCourse=Highscore->posFromString((*courses.begin()));
              
              
              //curCourse=0;
              pos.y-=20;
              

           
            for(int i=0;i<10;i++) {
                 pos.y-=30;
                 char buff[50];
                 sprintf(buff, "%s - %s",highscore::posToStr(i+1).c_str(),Highscore->level_hs[curCourse].post[i].toString().c_str());
              mp_post[i] = new pp::Label(pos,"menu_label",buff);
                     mp_post[i]->alignment.center();
            }
     } else {
       //No records stored
              pos.y-=60;
              m_raceList = Highscore->getCourseList_hd();
              mp_raceListBox = new pp::Listbox<HighscoreData>(pp::Vec2d(pos.x-200,pos.y),
                                      pp::Vec2d(450,36),
                                      "listbox_item",
                                      m_raceList);
              
              mp_raceListBox->alignment.center();
              
              
              
              //curCourse=0;
              pos.y-=20;
              

           
            for(int i=0;i<10;i++) {
                 pos.y-=30;
                 char buff[50];
                 sprintf(buff, "");
              mp_post[i] = new pp::Label(pos,"menu_label",buff);
                     mp_post[i]->alignment.center();
            }
     }
     pos.y-=50;
     
     mp_backBtn = new pp::Button( pp::Vec2d(pos.x-50,pos.y),
                           pp::Vec2d(100, 40), 
                           "button_label", 
                           _("Back") );
       mp_backBtn->setHilitFontBinding( "button_label_hilit" );
       mp_backBtn->alignment.center();
     mp_backBtn->signalClicked.Connect(pp::CreateSlot(this,&HighscoreShow::back));
     
 }

Here is the call graph for this function:

Definition at line 469 of file highscore.cpp.

                              {
       delete mp_titleLbl;
       delete mp_raceListBox;
       delete mp_backBtn;
       for(int i=0;i<10;i++) {
              delete mp_post[i];
       }
}

Member Function Documentation

Definition at line 434 of file highscore.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:

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

Reimplemented in Racing.

Definition at line 90 of file loop.h.

{return false;};
virtual bool GameMode::keyPressEvent ( SDLKey  key) [inline, virtual, inherited]

Reimplemented in EventSelect, EventRaceSelect, RaceSelect, GameOver, CreditsTrans, ConfigMode, Racing, GameTypeSelect, Paused, Credits, and Intro.

Definition at line 91 of file loop.h.

{return false;};
bool HighscoreShow::keyReleaseEvent ( SDLKey  key) [virtual]

Reimplemented from GameMode.

Definition at line 421 of file highscore.cpp.

{
       switch (key){
              case SDLK_ESCAPE:
              case 'q':
                     back();
              return true;
              default:
                     return false;
       }      
}
void HighscoreShow::loop ( float  timeStep) [virtual]

Implements GameMode.

Definition at line 442 of file highscore.cpp.

{
    update_audio();
    set_gl_options( GUI );
    clear_rendering_context();
    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 456 of file highscore.cpp.

{      
       HighscoreData tmp2=(*mp_raceListBox->getCurrentItem());
       std::string tmp= tmp2.name;
       //std::cout<<"Selected "<<tmp<<std::endl;
       curCourse=Highscore->posFromString(tmp);
     for(int i=0;i<10;i++) {
       char buff[50];
       sprintf(buff,"%s - %s",highscore::posToStr(i+1).c_str(),Highscore->level_hs[curCourse].post[i].toString().c_str());
       mp_post[i]->setText(buff);
     } 
}

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.

Definition at line 102 of file highscore.h.

game_mode_t GameMode::mode [static, inherited]

Definition at line 99 of file loop.h.

Definition at line 106 of file highscore.h.

Definition at line 105 of file highscore.h.

Definition at line 101 of file highscore.h.

Definition at line 104 of file highscore.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: