#include <game.h>
Collaboration diagram for GP2HANOI::game:
Public Types | |
typedef std::list< unsigned int > | diskHeap |
Container for discs heaps. | |
Public Member Functions | |
game (SDL_Surface *scr) | |
Deafult constructor. | |
void | init (std::string const &bgName, std::string const &clkSFXName, std::string const &errSFXName) throw (std::string const &) |
Resource initialization. | |
void | play (void) throw (std::string const &) |
Plays the game. | |
~game () | |
Destructor. | |
Static Public Attributes | |
static int const | MAXLVL = 8 |
Max levels (max discs in a peg). | |
Private Member Functions | |
void | blitCounter (void) throw (std::string const &) |
Blits the counter on the board. | |
SDL_Surface * | createOptimizedImage (char **xpmData) throw (std::string const &) |
Creates and optimizes an image for blittering. | |
unsigned int | getActivePeg (void) const |
Returns the active peg. | |
unsigned int | getNumPegs (void) const |
Returns the number of pegs of the board. | |
SDL_Surface * | loadOptimizedImage (std::string const &imgName) throw (std::string const &) |
Loads and optimizes an image for blittering. | |
Mix_Chunk * | loadSoundEffect (std::string const &sfxName) throw (std::string const &) |
Loads a sound effect. | |
bool | release (bool sound=true) throw (std::string const &) |
Drops a disk in the active peg. | |
void | setActivePeg (unsigned int stick, bool sound=true) throw (std::string const &) |
Changes the active peg. | |
void | show (void) throw (std::string const &) |
Shows the board on the destination surface. | |
bool | take (bool sound=true) throw (std::string const &) |
Takes the disk on the top of the heap. | |
bool | tokenTaken (void) const |
Returns true if a disc has been taken. | |
Private Attributes | |
SDL_Surface * | abandonSpr |
sprites for the abandon game dialog box. | |
unsigned int | activePeg |
Active Pegs. | |
SDL_Surface * | background |
Background image. | |
SDL_Surface * | base |
Board base sprite. | |
Mix_Chunk * | clickSFX |
Click sound effect. | |
unsigned int | counter |
Movements counter. | |
SDL_Surface * | countSpr |
sprites for the movements counter. | |
SDL_Surface * | discs |
discs sprites. | |
Mix_Chunk * | errorSFX |
Invalid move sound effect. | |
std::vector< diskHeap > | heap |
Vector of heaps. | |
SDL_Surface * | optSpr |
sprites for the options dialog box. | |
SDL_Surface * | pegs |
peg sprites. | |
SDL_Surface * | quitSpr |
sprites for the quit dialog box. | |
SDL_Surface * | screen |
Destination surface. | |
unsigned int | top |
Disk raised. |
|
Container for discs heaps.
|
|
Deafult constructor.
|
|
Destructor.
|
|
Blits the counter on the board.
|
|
Creates and optimizes an image for blittering.
|
|
Returns the active peg.
|
|
Returns the number of pegs of the board.
|
|
Resource initialization.
|
|
Loads and optimizes an image for blittering.
|
|
Loads a sound effect.
|
|
Plays the game.
|
|
Drops a disk in the active peg.
|
|
Changes the active peg.
|
|
Shows the board on the destination surface.
|
|
Takes the disk on the top of the heap.
|
|
Returns true if a disc has been taken.
|
|
sprites for the abandon game dialog box.
|
|
Active Pegs.
|
|
Background image.
|
|
Board base sprite.
|
|
Click sound effect.
|
|
Movements counter.
|
|
sprites for the movements counter.
|
|
discs sprites.
|
|
Invalid move sound effect.
|
|
Vector of heaps.
|
|
Max levels (max discs in a peg).
|
|
sprites for the options dialog box.
|
|
peg sprites.
|
|
sprites for the quit dialog box.
|
|
Destination surface.
|
|
Disk raised.
|