00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef GUIFADER_H
00023 #define GUIFADER_H
00024
00025 #include "uiobject.h"
00026 #include "tinyxml.h"
00027
00033
00034 #define GAMMA_WHITE 0x1FFFF
00036 #define GAMMA_BLACK 0x0000
00038 #define GAMMA_NORMAL 0x10000
00040 #define GAMMA_INVERT 0x80000000
00041
00042
00058 class DECLSPEC GuiFader : public UiObject
00059 {
00060 public:
00071 typedef bool (*FadeFunction)( Uint32 time, Uint32 *r, Uint32 *g, Uint32 *b );
00072
00078 DECLSPEC GuiFader(BasicObject *parent, const char *name, Uint32 normal = 0xFFFF );
00085 DECLSPEC GuiFader(TiXmlElement *el, BasicObject *parent);
00086 virtual DECLSPEC ~GuiFader();
00087
00088 virtual const char *getClassName() { return "GuiFrame"; }
00092 void setToNormal() { setGamma( nNormal ); }
00100 DECLSPEC bool setGamma( Uint32 intensity );
00110 DECLSPEC bool setGamma( Uint32 r, Uint32 g, Uint32 b );
00117 DECLSPEC bool setGammaInverted( Uint32 intensity );
00118
00123 DECLSPEC void fadeOut( Uint32 ms );
00128 DECLSPEC void fadeIn( Uint32 ms );
00134 DECLSPEC void fade( Uint32 ms, Uint32 end );
00139 DECLSPEC void fadeByFunction( FadeFunction func );
00140
00144 static GuiFader *the;
00152 DECLSPEC static GuiFader *getThe();
00153
00155 Uint32 nNormal;
00156 protected:
00157 virtual DECLSPEC Uint32 onFrame();
00158
00159 private:
00160 FadeFunction pFunction;
00161
00162 bool bFading;
00163 Uint32 tDuration, tEnd;
00164 Uint32 nEnd, nStart;
00165 Uint32 nNow;
00166
00167 Uint16 r[256],
00168 g[256],
00169 b[256];
00170
00171 friend class GuiManager;
00172 };
00173
00174 #endif