Back to index

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

#include <graphicsconfig.h>

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

List of all members.

Public Member Functions

 GraphicsConfig ()
 ~GraphicsConfig ()
void setWidgetPositions ()
void apply ()
void loop (float timeStep)
void drawTextandWidgets ()
bool keyPressEvent (SDLKey key)
void cancel ()
virtual void customLoop (float timeStep)
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

Private Attributes

pp::CheckBoxmp_uiSnowBox
pp::CheckBoxmp_fpsBox
pp::CheckBoxmp_coursePercentageBox
pp::CheckBoxmp_fogBox
pp::CheckBoxmp_reflectionsBox
pp::CheckBoxmp_shadowsBox
pp::CheckBoxmp_backgroundBox
pp::Listbox< model_t > * mp_modelListBox
std::list< model_tm_modelList

Detailed Description

Definition at line 30 of file graphicsconfig.h.


Constructor & Destructor Documentation

Definition at line 28 of file graphicsconfig.cpp.

{
       setTitle(_("Graphics Configuration"));    
       
       pp::Vec2d pos(0,0);

       m_modelList = ModelHndl->l_models;
       std::list<model_t>::iterator modelit=m_modelList.begin();

       /*m_langList=translation.LanguageList();
       std::list<language_t>::iterator langit,iter;
       
       bool found=false;

       for (iter=m_langList.begin();iter != m_langList.end(); ++iter) {
              if ((*iter).language==getparam_ui_language()) {
                     langit=iter;
                     found=true;
              }
       }
              
       if(!found) langit = m_langList.begin();*/
     
     for(int i=0;i<ModelHndl->cur_model;i++) {
       modelit++;
     }
     
//     mp_modelListBox = new pp::Listbox<model_t>( pos, pp::Vec2d(240, 32), "listbox_item", m_modelList);
//     mp_modelListBox->setCurrentItem( modelit );
 
//     mp_langListBox = new pp::Listbox<language_t>( pos, pp::Vec2d(240, 32), "listbox_item", m_langList);
//     mp_langListBox->setCurrentItem( langit );
           
       
       mp_uiSnowBox = new pp::CheckBox(pos, pp::Vec2d(32, 32) );
       mp_uiSnowBox->setState( getparam_ui_snow() );

       mp_fpsBox = new pp::CheckBox(pos, pp::Vec2d(32, 32) );
       mp_fpsBox->setState( getparam_display_fps() );

       mp_coursePercentageBox = new pp::CheckBox(pos, pp::Vec2d(32, 32) );
       mp_coursePercentageBox->setState( getparam_display_course_percentage() );
       
       mp_fogBox = new pp::CheckBox(pos, pp::Vec2d(32, 32) );
       mp_fogBox->setState( !getparam_disable_fog() );

       mp_reflectionsBox = new pp::CheckBox(pos, pp::Vec2d(32, 32) );
       mp_reflectionsBox->setState( getparam_terrain_envmap() );

       mp_shadowsBox = new pp::CheckBox(pos, pp::Vec2d(32, 32) );
       mp_shadowsBox->setState( getparam_draw_tux_shadow() );

       mp_backgroundBox = new pp::CheckBox(pos, pp::Vec2d(32, 32) );
       mp_backgroundBox->setState( !getparam_disable_background() );
}

Here is the call graph for this function:

Definition at line 84 of file graphicsconfig.cpp.

{
//     delete mp_modelListBox;
//     delete mp_langListBox;
       delete mp_uiSnowBox;
       delete mp_fpsBox;
       delete mp_coursePercentageBox;
       delete mp_fogBox;
       delete mp_reflectionsBox;
       delete mp_shadowsBox;
       delete mp_backgroundBox;
}

Member Function Documentation

void GraphicsConfig::apply ( ) [virtual]

Implements ConfigMode.

Definition at line 146 of file graphicsconfig.cpp.

{
//     std::list<language_t>::iterator langit = mp_langListBox->getCurrentItem();
//     translation.load((*langit).language.c_str());    
//     std::list<model_t>::iterator modelit = mp_modelListBox->getCurrentItem();
//     ModelHndl->load_model((*modelit).id);     
//     setparam_ui_language((char*)(*langit).language.c_str());
       setparam_ui_snow(bool( mp_uiSnowBox->getState() ));
       setparam_display_fps(bool( mp_fpsBox->getState() ));
       setparam_display_course_percentage(bool( mp_coursePercentageBox->getState() ));
       setparam_disable_fog(!bool( mp_fogBox->getState() ));
       setparam_terrain_envmap(bool( mp_reflectionsBox->getState() ));
       setparam_draw_tux_shadow(bool( mp_shadowsBox->getState() ));
       setparam_disable_background(!bool( mp_backgroundBox->getState() )); 
       
       write_config_file();
       set_game_mode( GameMode::prevmode );
    UIMgr.setDirty();       
}

Here is the call graph for this function:

void ConfigMode::cancel ( ) [inherited]

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, inherited]

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:

void ConfigMode::drawTextandWidgets ( ) [inherited]

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, inherited]

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, inherited]

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, inherited]

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:

Implements ConfigMode.

Definition at line 98 of file graphicsconfig.cpp.

{
       int width = 550;
       int height = 280;
              
       pp::Vec2d pos(getparam_x_resolution()/2 - width/2,
                              getparam_y_resolution()/2 + height/2);
       
       pp::Font* font = pp::Font::get("button_label");

//     font->draw(_("Model:"),pos);
//     mp_modelListBox->setPosition(pp::Vec2d(pos.x+width-204,pos.y));

       pos.y-=40;    

//     font->draw(_("Language:"),pos);
//     mp_langListBox->setPosition(pp::Vec2d(pos.x+width-204,pos.y));

       pos.y-=40;    
       font->draw(_("Show UI Snow:"),pos);
       mp_uiSnowBox->setPosition(pp::Vec2d(pos.x+width-32,pos.y));
       
       pos.y-=40;
       font->draw(_("Display FPS:"),pos);
       mp_fpsBox->setPosition(pp::Vec2d(pos.x+width-32,pos.y));
       
       pos.y-=40;
       font->draw(_("Display Progress Bar:"),pos);
       mp_coursePercentageBox->setPosition(pp::Vec2d(pos.x+width-32,pos.y));
       
       pos.y-=40;
       font->draw(_("Draw Fog:"),pos);
       mp_fogBox->setPosition(pp::Vec2d(pos.x+width-32,pos.y));
       
       pos.y-=40;
       font->draw(_("Reflections:"),pos);
       mp_reflectionsBox->setPosition(pp::Vec2d(pos.x+width-32,pos.y));
       
       pos.y-=40;
       font->draw(_("Shadows:"),pos);
       mp_shadowsBox->setPosition(pp::Vec2d(pos.x+width-32,pos.y));

       pos.y-=40;
       font->draw(_("Draw Background:"),pos);
       mp_backgroundBox->setPosition(pp::Vec2d(pos.x+width-32,pos.y));
}

Here is the call graph for this function:


Member Data Documentation

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

Definition at line 96 of file loop.h.

std::list<model_t> GraphicsConfig::m_modelList [private]

Definition at line 44 of file graphicsconfig.h.

std::string ConfigMode::m_title [protected, inherited]

Definition at line 38 of file configmode.h.

game_mode_t GameMode::mode [static, inherited]

Definition at line 99 of file loop.h.

pp::Button* ConfigMode::mp_applyBtn [protected, inherited]

Definition at line 35 of file configmode.h.

Definition at line 38 of file graphicsconfig.h.

pp::Button* ConfigMode::mp_cancelBtn [protected, inherited]

Definition at line 34 of file configmode.h.

Definition at line 34 of file graphicsconfig.h.

Definition at line 35 of file graphicsconfig.h.

Definition at line 33 of file graphicsconfig.h.

Definition at line 41 of file graphicsconfig.h.

Definition at line 36 of file graphicsconfig.h.

Definition at line 37 of file graphicsconfig.h.

pp::Label* ConfigMode::mp_titleLbl [protected, inherited]

Definition at line 36 of file configmode.h.

Definition at line 32 of file graphicsconfig.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: