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

Confirmation dialog box. More...

#include <confirm.h>


Public Member Functions

bool ask (bool initial=false, bool sound=true) throw (std::string const &)
 ask for user confirmation
 confirm (SDL_Surface *scr, SDL_Surface *spr, Mix_Chunk *click=0)
 Default Constructor.
 ~confirm ()
 Destructor.

Private Member Functions

void show (bool status) throw (std::string const &)
 Shows the dialog box on the destination surface.

Private Attributes

Mix_Chunk * clickSFX
 Click sound effect.
SDL_Surface * screen
 Destination surface.
SDL_Surface * sprite
 Sprites surface.


Detailed Description

Confirmation dialog box.

Author:
Kombo Morongo
Date:
02/04/2006
Shows a dialog box with a yes/no question and waits for user confirmation.


Constructor & Destructor Documentation

GP2HANOI::confirm::confirm SDL_Surface *  scr,
SDL_Surface *  spr,
Mix_Chunk *  click = 0
 

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

GP2HANOI::confirm::~confirm  ) 
 

Destructor.


Member Function Documentation

bool GP2HANOI::confirm::ask bool  initial = false,
bool  sound = true
throw (std::string const &)
 

ask for user confirmation

Parameters:
initial Default answer (true for yes and false for no).
sound Flag to play click sound on keys pressed.
Description
Draws the dialog box and waits for user response.
Returns:
true if the question has been answered as yes by the user.
Exceptions:
std::string const & In case of error, this exception details what has failed.

void GP2HANOI::confirm::show bool  status  )  throw (std::string const &) [private]
 

Shows the dialog box on the destination surface.

Parameters:
status Flag that show the affirmative sprite if it is true and the negative sprite if it is false.
Exceptions:
std::string const & In case of error, this exception details what has failed.


Field Documentation

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

Click sound effect.

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

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

Destination surface.

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

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

Sprites surface.

Description
Pointer to the surface containing the sprites for the dialog box. This surface contains two sprites of the same dimensions one above the other. The upper sprite contains the image to show when the affirmative option is active and the lower sprite contains the image to show when the negative option is active.


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