Back to index

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

#include <credits.h>

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

List of all members.

Public Member Functions

 CreditsTrans ()
 ~CreditsTrans ()
void loop (float timeStep)
bool mouseButtonReleaseEvent (int button, int x, int y)
bool keyPressEvent (SDLKey key)
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)

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

Detailed Description

Definition at line 44 of file credits.h.


Constructor & Destructor Documentation

Definition at line 58 of file credits_trans.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" );
}

Here is the call graph for this function:

Definition at line 69 of file credits_trans.cpp.

{      
}

Member Function Documentation

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 CreditsTrans::drawText ( float  timeStep) [private]

Definition at line 104 of file credits_trans.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 CreditsTrans::keyPressEvent ( SDLKey  key) [virtual]

Reimplemented from GameMode.

Definition at line 187 of file credits_trans.cpp.

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

Implements GameMode.

Definition at line 74 of file credits_trans.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;};
bool CreditsTrans::mouseButtonReleaseEvent ( int  button,
int  x,
int  y 
) [virtual]

Reimplemented from GameMode.

Definition at line 179 of file credits_trans.cpp.

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.

double CreditsTrans::m_yOffset [private]

Definition at line 46 of file credits.h.

game_mode_t GameMode::mode [static, inherited]

Definition at line 99 of file loop.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: