Show pausefader.h syntax highlighted
#ifndef PAUSEFADER_H_INCLUDED
#define PAUSEFADER_H_INCLUDED
/**
* Used to darken the screen when the game is paused.
*
* \todo Should put a "Paused" text on screen.
*/
class PauseFader {
protected:
/**
* Are we currently fading the screen? Are we fading out or in?
*/
enum {FADED_IN, FADED_OUT, FADING_IN, FADING_OUT} type;
/**
* when did we start to fade? used to
* make the fade uniform over time, even if doStep() is called in
* non-uniform intervals
*/
int start;
/**
* how many sdl ticks do we want to spend on the fade?
*/
const int max;
/**
* how much do we want to fade out? [0-255]
*/
const int duration;
public:
/**
* ctor, just sets up the internal variables
*
* \param m Max fade level (255 = black).
* \param t Time to take (ms).
*/
PauseFader(int m = 128, int t = 1000);
/**
* call this in regular intervals, as often as possible (in the main
* loop. it will fade in/out or just return. shouldn't cost much if it
* does nothing */
void doStep();
/**
* call this whenever the game is set into pause mode
*/
void pause();
/**
* call when the game leaves pause mode
*/
void unPause();
};
#endif
See more files for this project here