#include <guifader.h>
Inheritance diagram for GuiFader:
Public Types | |
typedef bool(*) | FadeFunction (Uint32 time, Uint32 *r, Uint32 *g, Uint32 *b) |
Public Member Functions | |
DECLSPEC | GuiFader (BasicObject *parent, const char *name, Uint32 normal=0xFFFF) |
DECLSPEC | GuiFader (TiXmlElement *el, BasicObject *parent) |
virtual const char * | getClassName () |
void | setToNormal () |
DECLSPEC bool | setGamma (Uint32 intensity) |
DECLSPEC bool | setGamma (Uint32 r, Uint32 g, Uint32 b) |
DECLSPEC bool | setGammaInverted (Uint32 intensity) |
DECLSPEC void | fadeOut (Uint32 ms) |
DECLSPEC void | fadeIn (Uint32 ms) |
DECLSPEC void | fade (Uint32 ms, Uint32 end) |
DECLSPEC void | fadeByFunction (FadeFunction func) |
Static Public Member Functions | |
static DECLSPEC GuiFader * | getThe () |
Public Attributes | |
Uint32 | nNormal |
the normal gamma value | |
Static Public Attributes | |
static GuiFader * | the |
Protected Member Functions | |
virtual DECLSPEC Uint32 | onFrame () |
Friends | |
class | GuiManager |
Required header file:
#include <guifader.h>
Use this class for manipulating the colors, visible on the display. Flashes, fadings, ... are easily possible.
There is only one variable of this type allowed at a time. Do not initialize it more than once.
typedef bool(*) GuiFader::FadeFunction(Uint32 time, Uint32 *r, Uint32 *g, Uint32 *b) |
use this function prototype to make individual fadings, the fade will endure until false is returned. The intensity value has to be assigned to the params r, g and b or can be left unassigned, if the normal value should be used.
time | the time in msecs since the fade started | |
r | the intensity of the red part of the colors | |
g | the intensity of the green part of the colors | |
b | the intensity of the blue part of the colors |
GuiFader::GuiFader | ( | BasicObject * | parent, | |
const char * | name, | |||
Uint32 | normal = 0xFFFF | |||
) |
Constructor. After creating this class once, the onFrame() event is called once per frame from GuiManager.
normal | the gamma value to use usually (i.e. after fading in) |
GuiFader::GuiFader | ( | TiXmlElement * | el, | |
BasicObject * | parent | |||
) |
Constructor. Used for initalisation by XML data. The XML element has to contain an attribute "Name" and an attribute "Normal" (with an integer value)
el | the XML data | |
parent | pointer to the parent element |
virtual const char* GuiFader::getClassName | ( | ) | [inline, virtual] |
This function should be overriden in every sub-class of BasicObject!
Reimplemented from UiObject.
void GuiFader::setToNormal | ( | ) | [inline] |
Sets the gamma value to the normal value.
bool GuiFader::setGamma | ( | Uint32 | intensity | ) |
Sets the gamma intensity of all colors (red, green and blue) to the given value.
intensity | the new gamma value, if the most significant bit is set, then setGammaInverted is called with the value (see GAMMA_INVERT) |
bool GuiFader::setGamma | ( | Uint32 | r, | |
Uint32 | g, | |||
Uint32 | b | |||
) |
Sets the gamma intensity individually for the colors red, green and blue.
r | the new gamma value for the red part of a color | |
g | the new gamma value for the green part of a color | |
b | the new gamma value for the blue part of a color |
bool GuiFader::setGammaInverted | ( | Uint32 | intensity | ) |
Sets the gamma intensity of all colors (red, green and blue) to the given value.
intensity | the new gamma value; GAMMA_INVERT makes no sense here |
void GuiFader::fadeOut | ( | Uint32 | ms | ) |
Turns the colors darker until all is black (after ms msecs).
ms | the duration of the fade in msecs |
void GuiFader::fadeIn | ( | Uint32 | ms | ) |
Turns the colors to normal until the intensity is normal (after ms msecs).
ms | the duration of the fade in msecs |
void GuiFader::fade | ( | Uint32 | ms, | |
Uint32 | end | |||
) |
Turns the colors to "end" until the intensity equals "end" (after ms msecs).
ms | the duration of the fade in msecs | |
end | the intensity at the end of the fade |
void GuiFader::fadeByFunction | ( | FadeFunction | func | ) |
Sets the gamma values as set by the fade function.
func | the function, that gives the values |
GuiFader * GuiFader::getThe | ( | ) | [static] |
Uint32 GuiFader::onFrame | ( | ) | [protected, virtual] |
This event is called when graphics should be updated. It does not call the children's onFrame() function!
Reimplemented from UiObject.
GuiFader * GuiFader::the [static] |
only accessible in Linux, and equals the result of getThe()