Back to index

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

#include <credits.h>

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

List of all members.

Public Member Functions

 Credits ()
 ~Credits ()
void loop (float timeStep)
bool keyPressEvent (SDLKey key)
void Trans ()
void CredBack ()
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 drawText (float timeStep)

Private Attributes

double m_yOffset
pp::Buttonmp_creditstransBtn
pp::Buttonmp_backBtn

Detailed Description

Definition at line 26 of file credits.h.


Constructor & Destructor Documentation

Definition at line 136 of file credits.cpp.

 : m_yOffset(0.0)
{
       for (unsigned int i=0; i<sizeof( credit_lines ) / sizeof( credit_lines[0] ); i++) {
              credit_lines[i].font = pp::Font::get(credit_lines[i].binding);        
       }
       
  play_music( "credits_screen" );


       pp::Vec2d pos(0,0);
       mp_backBtn = new pp::Button(pos,
                              pp::Vec2d(50, 40),
                              "button_label",
                              _("Back") );
       mp_backBtn->setHilitFontBinding( "button_label_hilit" );
       mp_backBtn->signalClicked.Connect(pp::CreateSlot(this,&Credits::CredBack)); 
       mp_backBtn->setPosition( pp::Vec2d(100,0) );


mp_creditstransBtn = new pp::Button(pos,
                              pp::Vec2d(120, 40),
                              "button_label",
                              _("Translators") );
       mp_creditstransBtn->setHilitFontBinding( "button_label_hilit" );
       mp_creditstransBtn->signalClicked.Connect(pp::CreateSlot(this,&Credits::Trans)); 
       mp_creditstransBtn->setPosition( pp::Vec2d(700,0) );

}

Here is the call graph for this function:

Definition at line 167 of file credits.cpp.

{      
delete mp_creditstransBtn;
delete mp_backBtn;
}

Member Function Documentation

Definition at line 297 of file credits.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:

void Credits::drawText ( float  timeStep) [private]

Definition at line 204 of file credits.cpp.

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

    m_yOffset += timeStep * 30;
    y = CREDITS_MIN_Y + m_yOffset;

       //loop through all credit lines
       for (unsigned int i=0; i<sizeof( credit_lines ) / sizeof( credit_lines[0] ); i++) {
           credit_line_t line = credit_lines[i];

              //get the font and sizes for the binding
              //pp::Font *font = pp::Font::get(line.binding);
        
              float width = line.font->advance(_(line.text));
              float desc = line.font->descender();
              float asc = line.font->ascender();
              
              //draw the line on the screen
              line.font->draw(_(line.text), w/2 - width/2, y);

              //calculate the y value for the next line
              y-=asc-desc;
       }

       //if the last string reaches the top, reset the y offset
    if ( y > h+CREDITS_MAX_Y ) {
              m_yOffset = 0;
    }

    // Draw strips at the top and bottom to clip out text 
    glDisable( GL_TEXTURE_2D );

    glColor4dv( (double*)&theme.background );

    glRectf( 0, 0, w, CREDITS_MIN_Y );

    glBegin( GL_QUADS );
    {
       glVertex2f( 0, CREDITS_MIN_Y );
       glVertex2f( w, CREDITS_MIN_Y );
       glColor4f( theme.background.r, 
                 theme.background.g,
                 theme.background.b,
                 0 );
       glVertex2f( w, CREDITS_MIN_Y + 30 );
       glVertex2f( 0, CREDITS_MIN_Y + 30 );
    }
    glEnd();

    glColor4dv( (double*)&theme.background );

    glRectf( 0, h+CREDITS_MAX_Y, w, h );

    glBegin( GL_QUADS );
    {
       glVertex2f( w, h+CREDITS_MAX_Y );
       glVertex2f( 0, h+CREDITS_MAX_Y );
       glColor4f( theme.background.r, 
                 theme.background.g,
                 theme.background.b,
                 0 );
       glVertex2f( 0, h+CREDITS_MAX_Y - 30 );
       glVertex2f( w, h+CREDITS_MAX_Y - 30 );
    }
    glEnd();

    glColor4f( 1, 1, 1, 1 );

    glEnable( GL_TEXTURE_2D );
}

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

Reimplemented from GameMode.

Definition at line 281 of file credits.cpp.

{
       if (key == SDLK_t) { set_game_mode( CREDITS_TRANS ); return true; }
       set_game_mode( GAME_TYPE_SELECT );
    winsys_post_redisplay();
       return true;
}

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 Credits::loop ( float  timeStep) [virtual]

Implements GameMode.

Definition at line 174 of file credits.cpp.

{
       int width, height;

  width = getparam_x_resolution();
  height = getparam_y_resolution();

  update_audio();

  clear_rendering_context();

  set_gl_options( GUI );

  UIMgr.setupDisplay();

  drawText( timeStep );

       drawSnow(timeStep);

       theme.drawMenuDecorations();

  UIMgr.draw();

  reshape( width, height );

  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 Credits::Trans ( )

Definition at line 290 of file credits.cpp.

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.

double Credits::m_yOffset [private]

Definition at line 28 of file credits.h.

game_mode_t GameMode::mode [static, inherited]

Definition at line 99 of file loop.h.

Definition at line 32 of file credits.h.

Definition at line 31 of file credits.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: