Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages

core.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                         core.h  -  Core engine object
00003                              -------------------
00004     begin                : Mon Jun 28 2003
00005     copyright            : (C) 2003 by Reality Rift Studios
00006     email                : mattias@realityrift.com
00007  ***************************************************************************
00008 
00009  The contents of this file are subject to the Mozilla Public License Version
00010  1.1 (the "License"); you may not use this file except in compliance with
00011  the License. You may obtain a copy of the License at 
00012  http://www.mozilla.org/MPL/
00013 
00014  Software distributed under the License is distributed on an "AS IS" basis,
00015  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00016  for the specific language governing rights and limitations under the
00017  License.
00018 
00019  The Original Code is the NeoEngine, core.h
00020 
00021  The Initial Developer of the Original Code is Mattias Jansson.
00022  Portions created by Mattias Jansson are Copyright (C) 2003
00023  Reality Rift Studios. All Rights Reserved.
00024 
00025  ***************************************************************************/
00026 
00027 
00028 #ifndef __NECORE_H
00029 #define __NECORE_H
00030 
00031 #include "base.h"
00032 
00033 #include <string>
00034 
00035 
00052 namespace NeoEngine
00053 {
00054 
00055 
00056 // External classes
00057 class ModuleManager;
00058 class Material;
00059 class Console;
00060 class Config;
00061 class FontManager;
00062 class RoomManager;
00063 class TerrainManager;
00064 class Font;
00065 class Mesh;
00066 class ProfileManager;
00067 class RenderDevice;
00068 class InputDevice;
00069 class InputManager;
00070 class FileManager;
00071 class LogSink;
00072 
00073 template < class T > class HashTable;
00074 template < class T > class Pool;
00075 
00076 typedef HashTable< Material > MaterialTable;
00077 typedef Pool< Mesh >          MeshPool;
00078 
00079 
00080 // Internal private class you'll never see made public.. a la GTK-style, woo!
00081 struct TerrainPrivate;
00082 
00083 
00084 
00089 class NEOENGINE_API Core
00090 {
00091     public:
00092 
00096         enum BYTEORDER
00097         {
00099           BYTEORDER_LITTLEENDIAN,
00100           
00102           BYTEORDER_BIGENDIAN
00103         };
00104 
00105 
00106 
00107     public:
00108 
00109         //******** PROCESSOR AND SYSTEM ATTRIBUTES AND FEATURES ********//
00110 
00111 #if !defined( __MINGW32__ ) || defined( BUILD_STATIC )
00112 
00114         static const BYTEORDER                        BYTEORDER_SYSTEM;
00115 
00116 #else
00117         
00119         static NEOENGINE_API BYTEORDER                BYTEORDER_SYSTEM;
00120 
00121 #endif
00122 
00123 
00124 #ifdef __APPLE__
00125 
00127         int                                           m_iHasAltiVec;
00128 
00129 #endif
00130 
00131 
00132 #if defined( ARCH_X86 ) || defined( ARCH_X86_64 )
00133 
00135         int                                           m_iHasMMX;
00136 
00138         int                                           m_iHasFXSR;
00139 
00141         int                                           m_iHasSSE;
00142 
00144         int                                           m_iHasSSE2;
00145 
00147         int                                           m_iHas3DNow;
00148 
00150         int                                           m_iHas3DNowEx;
00151 
00152 #endif
00153 
00154     private:
00155 
00157         static NE_STATIC Core                        *s_pkSingleton;
00158 
00159 
00160     protected:
00161 
00162         //******** CORE ENGINE OBJECTS ********//
00163 
00165         static ModuleManager                         *s_pkModuleManager;
00166 
00168         FileManager                                  *m_pkFileManager;
00169 
00171         InputManager                                 *m_pkInputManager;
00172 
00174         MaterialTable                                *m_pkMaterialManager;
00175 
00177         MeshPool                                     *m_pkMeshManager;
00178 
00180         RoomManager                                  *m_pkRoomManager;
00181 
00183         TerrainManager                               *m_pkTerrainManager;
00184 
00186         TerrainPrivate                               *m_pkTerrainPrivate;
00187 
00189         FontManager                                  *m_pkFontManager;
00190 
00192         ProfileManager                               *m_pkProfileManager;
00193 
00195         Console                                      *m_pkConsole;
00196 
00198         Config                                       *m_pkConfig;
00199 
00201         RenderDevice                                 *m_pkRenderDevice;
00202 
00204         LogSink                                      *m_pkStdoutSink;
00205 
00206 
00210                                                       Core();
00211 
00212 
00213     public:
00214 
00215 
00218         virtual                                      ~Core();
00219 
00220 
00221         //******** INITIALIZATION AND SHUTDOWN METHODS ********//
00222 
00229         int                                           Initialize( int iArgs, char **ppszArgs );
00230 
00235         int                                           Shutdown();
00236 
00237 
00238         //******** INPUT DEVICE METHODS ********//
00239 
00253         InputDevice                                  *CreateInputDevice( const std::string &rstrName, RenderDevice *pkRenderDevice = 0, InputManager *pkInputManager = 0 );
00254 
00262         void                                          DeleteInputDevice( InputDevice *pkDevice );
00263 
00264 
00265         //******** RENDER DEVICE METHODS ********//
00266 
00280         RenderDevice                                 *CreateRenderDevice( const std::string &rstrName, FileManager *pkFileManager = 0, InputManager *pkInputManager = 0 );
00281 
00289         void                                          DeleteRenderDevice( RenderDevice *pkDevice );
00290 
00296         RenderDevice                                 *SetRenderDevice( RenderDevice *pkDevice );
00297 
00298 
00299 
00300         //******** ACCESS METHODS ********//
00301 
00305         static ModuleManager                         *GetModuleManager();
00306 
00310         inline FileManager                           *GetFileManager() { return m_pkFileManager; }
00311 
00315         inline InputManager                          *GetInputManager() { return m_pkInputManager; }
00316 
00320         inline FontManager                           *GetFontManager() { return m_pkFontManager; }
00321 
00325         inline MaterialTable                         *GetMaterialManager() { return m_pkMaterialManager; }
00326 
00330         inline MeshPool                              *GetMeshManager() { return m_pkMeshManager; }
00331 
00335         inline RoomManager                           *GetRoomManager() { return m_pkRoomManager; }
00336 
00340         void                                          InitializeTerrain( const std::string &rstrName );
00341 
00345         inline TerrainManager                        *GetTerrainManager() { return m_pkTerrainManager; }
00346 
00350         inline ProfileManager                        *GetProfileManager() { return m_pkProfileManager; }
00351 
00355         inline Console                               *GetConsole() { return m_pkConsole; }
00356 
00360         inline Config                                *GetConfig() { return m_pkConfig; }
00361 
00365         inline RenderDevice                          *GetRenderDevice() { return m_pkRenderDevice; }
00366 
00370         inline LogSink                               *GetStdoutSink() { return m_pkStdoutSink; }
00371 
00372 
00373 
00374         //******** REPLACEMENT METHODS ********//
00375 
00380         void                                          SetConsole( Console *pkConsole );
00381 
00382 
00383 
00384         //******** SINGLETON ACCESS ********** //
00385 
00390         inline static Core                           *Get() { if( !s_pkSingleton ) s_pkSingleton = new Core; return s_pkSingleton; }
00391 };
00392 
00393 
00394 };
00395 
00396 
00397 #endif
00398 

Generated on Wed Jan 21 14:21:06 2004 for NeoEngine by doxygen 1.3.5