GP2HANOI::options Class Reference
[GP2Hanoi: Tower of Hanoi puzzle game]

options dialog box More...

#include <options.h>


Public Member Functions

void ask (unsigned int lvl=8, bool snd=true) throw (std::string const &)
 ask for user entry
unsigned int getLevel (void) const
 Returns selected game level.
unsigned int getSound (void) const
 Returns selected sound option.
 options (SDL_Surface *scr, SDL_Surface *spr, Mix_Chunk *click)
 Default Constructor.
 ~options ()
 Destructor.

Private Member Functions

void show (unsigned int option) throw (std::string const &)
 Shows the dialog box on the destination surface.

Private Attributes

Mix_Chunk * clickSFX
 Click sound effect.
unsigned int level
 Container for the game level.
SDL_Surface * screen
 Destination surface.
bool sound
 Container for the game level.
SDL_Surface * sprite
 Sprites surface.


Detailed Description

options dialog box

Author:
Kombo Morongo
Date:
08/04/2006
Shows a dialog box with game options and waits for user entry.


Constructor & Destructor Documentation

GP2HANOI::options::options SDL_Surface *  scr,
SDL_Surface *  spr,
Mix_Chunk *  click
 

Default Constructor.

Parameters:
scr Pointer to the surface where to draw the dialog box
spr Pointer to the surface containing the dialog sprites
click pointer to the sound effect to play when a key is pressed.

GP2HANOI::options::~options  ) 
 

Destructor.


Member Function Documentation

void GP2HANOI::options::ask unsigned int  lvl = 8,
bool  snd = true
throw (std::string const &)
 

ask for user entry

Parameters:
lvl Default game level.
snd Default sound option (on/off).
Description
Draws the dialog box, navigates through options and waits for user response.
Exceptions:
std::string const & In case of error, this exception details what has failed.

unsigned int GP2HANOI::options::getLevel void   )  const
 

Returns selected game level.

Returns:
game level selected by the user the last time that ask() was invoked.

unsigned int GP2HANOI::options::getSound void   )  const
 

Returns selected sound option.

Returns:
sound play option selected by the user the last time that ask() was invoked.

void GP2HANOI::options::show unsigned int  option  )  throw (std::string const &) [private]
 

Shows the dialog box on the destination surface.

Parameters:
option indicates the option number that is currently being edited by the user.
Exceptions:
std::string const & In case of error, this exception details what has failed.


Field Documentation

Mix_Chunk* GP2HANOI::options::clickSFX [private]
 

Click sound effect.

Description
Pointer to the sound effect to play whenever a button is pressed.

unsigned int GP2HANOI::options::level [private]
 

Container for the game level.

Description
The property holds the game level selected by the user the last time that ask() was invoked.

SDL_Surface* GP2HANOI::options::screen [private]
 

Destination surface.

Description
Pointer to the surface where the dialog box will be desplayed.

bool GP2HANOI::options::sound [private]
 

Container for the game level.

Description
The property holds the sound preference (on or off) selected by the user the last time that ask() was invoked.

SDL_Surface* GP2HANOI::options::sprite [private]
 

Sprites surface.

Description
Pointer to the surface containing the sprites for the dialog box. The contents of the sprites file is of 21 sprites of the same width vertically aligned and with the following format:
  • 1 sprite 35 pixels heigth for the dialog header.
  • 7 sprites 25 pixels heigth continaining the different game levels (normal).
  • 7 sprites 25 pixels heigth continaining the different game levels (highlighted).
  • 2 sprites 25 pixels heigth with sound on/off options (normal).
  • 2 sprites 25 pixels heigth with sound on/off options (highlighted).
  • 1 sprite 35 pixels heigth for the dialog footer (normal).
  • 1 sprite 35 pixels heigth for the dialog footer (highlighted).


The documentation for this class was generated from the following files: This project is hosted by SourceForge.net Logo