Page principale | Hiérarchie des classes | Liste alphabétique | Liste des classes | Liste des fichiers | Membres de classe

C:/Projects/ngn/include/engine.h

00001 /***************************************************************************
00002  *            engine.h
00003  *
00004  *  Sat Sep 11 10:09:15 2004
00005  *  Copyright  2004  thierry schartz
00006  *  thierry.schartz@bluebottle.com
00007  ****************************************************************************/
00008 
00009 /*
00010  *  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  You should have received a copy of the GNU General Public License
00021  *  along with this program; if not, write to the Free Software
00022  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00023  */
00024  
00025 #ifndef _ENGINE_H
00026 #define _ENGINE_H
00027 
00028 #ifdef WIN32
00029 #include <windows.h>
00030 #endif
00031 
00032 
00033 #include <string>
00034 #include "color.h"
00035 #include "system.h"
00036 #include "log.h"
00037 #include "font.h"
00038 #include "fps.h"
00039 
00040 //friend classes
00041 #include "texture.h"
00042 #include "renderer.h"
00043 #include "bsp.h"
00044 #include "scene.h"
00045 #include "camera.h"
00046 #include "font.h"
00047 #include "gltools.h"
00048 #include "parser.h"
00049 #include "skybox.h"
00050 #include "shader.h"
00051 #include "patch.h"
00052 #include "models_md2.h"
00053 
00054 #include "build.h"
00055 
00056 
00057 
00058 
00059         struct SDL_Surface;
00060 
00061         namespace ngn
00062         {
00063                 class InputHandler;
00064         }
00065 
00066         class NGN;
00067 
00068         // instanciate the singleton NGN class
00070         NGN_API NGN& WINAPI ngnCreate( ngn::InputHandler *input, int width, int height, int bpp, const std::string& name, bool fullscreen=false );      
00072         NGN_API NGN& WINAPI ngnGet();
00074         NGN_API void WINAPI ngnQuit();
00075         
00076 
00080         class NGN_API NGN
00081         {
00082                 
00083                 friend NGN_API NGN& WINAPI ngnCreate( ngn::InputHandler *input, int width, int height, int bpp, const std::string& name, bool fullscreen );     
00084                 friend NGN_API NGN& WINAPI ngnGet();
00085                 friend NGN_API void WINAPI ngnQuit();
00086 
00087                         
00088         public:
00089                         virtual ~NGN(); 
00091                         void toggleFullscreen();
00093                         void resize( int w, int h, int d );
00095                         void setCursorVisible( bool state );
00097                         void setBackgroundColor( const ngn::core::Colorf& colour );
00099                         int getMouseX() const;
00101                         int getMouseY() const;
00102                 
00104                         int getWidth();
00106                         int getHeight();
00108                         int getColorDepth() const;
00110                         const std::string& getCaption() const;
00112                         bool isFullscreen() const;
00114                         bool isRunning() const;
00116                         bool isCursorVisible() const;
00118                         const ngn::core::Colorf& getBackgroundColor() const;
00120                         const ngn::SystemInfo& getSystemInfo() const;
00122                         const std::string& getVersion() const;
00124                         ngn::FontManager& getFontManager();
00126                         static ngn::core::FPS& getTimer();
00128                         void setDebugMode( bool state );
00130                         bool isDebugMode() const;
00132                         ngn::sys::Log& getLogManager();                 
00133                                                                                 
00134         private:
00135                         // private constructor
00136                         NGN( ngn::InputHandler *input, int width, int height, int bpp, const std::string& name, bool fullscreen=false );
00137 
00138                         // SDL init
00139                         bool initSDL();
00140                                                 
00141                         SDL_Surface* m_win;
00142                         ngn::InputHandler* m_input;
00143                         ngn::SystemInfo m_sysinfo;
00144                         int m_width;
00145                         int m_height;
00146                         int m_depth;
00147                         std::string m_caption;
00148                         std::string m_version;
00149                         bool m_fullscreen;
00150                         bool m_runs;
00151                         bool m_cursor_visible;
00152                         // background color
00153                         ngn::core::Colorf m_bg_color;
00154                         // logger
00155                         ngn::sys::Log slog;
00156                         // font manager
00157                         ngn::FontManager m_fontmanager;
00158                         // internal default font used by ngn
00159                         unsigned int m_font0;
00160                         // timer
00161                         static ngn::core::FPS m_fps;
00162                         // debug mode will show log debug msg
00163                         bool m_debug_mode;
00164 
00165 
00166                         friend class ngn::core::Texture;
00167                         friend class ngn::gl::Renderer;
00168                         friend class ngn::Camera;
00169                         friend class ngn::core::Bsp;
00170                         friend class ngn::Scene;
00171                         friend class ngn::core::Font;
00172                         friend class ngn::core::SkyboxScriptParser;
00173                         friend class ngn::Skybox;
00174                         friend void ngn::gl::Enter2DMode();     
00175                         friend class ngn::gl::Shader;
00176                         friend class ngn::gl::ShaderProgram;
00177                         friend class ngn::core::bsp::Q3Patch;
00178                         friend class ngn::Md2Model;
00179                         
00180         };
00181 
00182 
00183 /*
00184 #ifdef WIN32
00185 
00186 BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved )
00187 {
00188     switch (reason)
00189     {
00190       case DLL_PROCESS_ATTACH:
00191         break;
00192 
00193       case DLL_PROCESS_DETACH:
00194         break;
00195 
00196       case DLL_THREAD_ATTACH:
00197         break;
00198 
00199       case DLL_THREAD_DETACH:
00200         break;
00201     }
00202 
00203     
00204     return TRUE;
00205 }
00206 
00207 #endif
00208  */
00209         
00210         
00211 #endif /* _ENGINE_H */

Généré le Fri Nov 19 14:20:29 2004 pour NGN par  doxygen 1.3.9.1