GuiFader Class Reference
[2D graphical user interfaceSingle inited classes]

The class to use for manipulating color appearance. More...

#include <guifader.h>

Inheritance diagram for GuiFader:

Inheritance graph
[legend]
Collaboration diagram for GuiFader:

Collaboration graph
[legend]
List of all members.

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 GuiFadergetThe ()

Public Attributes

Uint32 nNormal
 the normal gamma value

Static Public Attributes

static GuiFaderthe

Protected Member Functions

virtual DECLSPEC Uint32 onFrame ()

Friends

class GuiManager

Detailed Description

The class to use for manipulating color appearance.

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.


Member Typedef Documentation

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.

Parameters:
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
Returns:
false, if the fade ends; true, if it continues


Constructor & Destructor Documentation

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.

Parameters:
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)

Parameters:
el the XML data
parent pointer to the parent element


Member Function Documentation

virtual const char* GuiFader::getClassName (  )  [inline, virtual]

This function should be overriden in every sub-class of BasicObject!

Returns:
the name of the class.

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.

Parameters:
intensity the new gamma value, if the most significant bit is set, then setGammaInverted is called with the value (see GAMMA_INVERT)
Returns:
true, if successful; false if not

bool GuiFader::setGamma ( Uint32  r,
Uint32  g,
Uint32  b 
)

Sets the gamma intensity individually for the colors red, green and blue.

Parameters:
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
Returns:
true, if successful; false if not
Todo:
enable inverted colors

bool GuiFader::setGammaInverted ( Uint32  intensity  ) 

Sets the gamma intensity of all colors (red, green and blue) to the given value.

Parameters:
intensity the new gamma value; GAMMA_INVERT makes no sense here
Returns:
true, if successful; false if not

void GuiFader::fadeOut ( Uint32  ms  ) 

Turns the colors darker until all is black (after ms msecs).

Parameters:
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).

Parameters:
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).

Parameters:
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.

Parameters:
func the function, that gives the values

GuiFader * GuiFader::getThe (  )  [static]

Returns:
a pointer to the GuiFader-variable, or NULL if not initialized. (There is only one GuiFader-variable allowed in an application)
Every netrinjo-class that can only exist once at a time, has this static function.
See also:
Single inited classes

Uint32 GuiFader::onFrame (  )  [protected, virtual]

This event is called when graphics should be updated. It does not call the children's onFrame() function!

Returns:
currently the result is not used; may be zero, if no error...
Note:
in classes derived from GuiElement, it is probably more useful to implement onFrame(SdlSurface*)

Reimplemented from UiObject.


Member Data Documentation

GuiFader * GuiFader::the [static]

only accessible in Linux, and equals the result of getThe()


The documentation for this class was generated from the following files:
Generated on Wed May 9 17:36:16 2007 for netrinjo by  doxygen 1.5.1