guifader.h

Go to the documentation of this file.
00001 /********************************************************************************/
00002 /*                                                                              */
00003 /*  Netrinjo-Engine - a library for game-development                            */
00004 /*  Copyright (C) 1999, 2000, 2005 by Tobias Nadler und Georg Schnattinger      */
00005 /*                                                                              */
00006 /*  This library is free software; you can redistribute it and/or               */
00007 /*  modify it under the terms of the GNU Lesser General Public                  */
00008 /*  License as published by the Free Software Foundation; either                */
00009 /*  version 2.1 of the License, or (at your option) any later version.          */
00010 /*                                                                              */
00011 /*  This library is distributed in the hope that it will be useful,             */
00012 /*  but WITHOUT ANY WARRANTY; without even the implied warranty of              */
00013 /*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU           */
00014 /*  Lesser General Public License for more details.                             */
00015 /*                                                                              */
00016 /*  You should have received a copy of the GNU Lesser General Public            */
00017 /*  License along with this library; if not, write to the Free Software         */
00018 /*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   */
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 //#define FADEFUNC_END  (~0)
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

Generated on Wed May 9 17:35:55 2007 for netrinjo by  doxygen 1.5.1