FIFE 2008.0
|
00001 /*************************************************************************** 00002 * Copyright (C) 2005-2008 by the FIFE team * 00003 * http://www.fifengine.de * 00004 * This file is part of FIFE. * 00005 * * 00006 * FIFE 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 * 00018 * Free Software Foundation, Inc., * 00019 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * 00020 ***************************************************************************/ 00021 00022 #ifndef FIFE_ENGINE_H 00023 #define FIFE_ENGINE_H 00024 00025 // Standard C++ library includes 00026 #include <map> 00027 #include <string> 00028 #include <vector> 00029 00030 // Platform specific includes 00031 #ifdef USE_COCOA 00032 #include <objc/runtime.h> 00033 #endif 00034 00035 // 3rd party library includes 00036 #include <SDL.h> 00037 00038 // FIFE includes 00039 // These includes are split up in two parts, separated by one empty line 00040 // First block: files included from the FIFE root src directory 00041 // Second block: files included from the same folder 00042 #include "enginesettings.h" 00043 #include "video/devicecaps.h" 00044 00045 namespace gcn { 00046 class Graphics; 00047 } 00048 00049 namespace FIFE { 00050 00051 class SoundManager; 00052 class RenderBackend; 00053 class GUIManager; 00054 class VFS; 00055 class VFSSourceFactory; 00056 class EventManager; 00057 class TimeManager; 00058 class ImagePool; 00059 class AnimationPool; 00060 class Model; 00061 class LogManager; 00062 class GuiFont; 00063 class Cursor; 00064 class SoundClipPool; 00065 class RendererBase; 00066 class Image; 00067 00068 00069 class IEngineChangeListener { 00070 public: 00071 virtual ~IEngineChangeListener() {} 00072 00075 virtual void onScreenModeChanged(const ScreenMode& newmode) = 0; 00076 }; 00077 00084 class Engine { 00085 public: 00088 Engine(); 00089 00092 virtual ~Engine(); 00093 00096 EngineSettings& getSettings(); 00097 00100 const DeviceCaps& getDeviceCaps() const; 00101 00110 Image* changeScreenMode(const ScreenMode& mode); 00111 00114 void init(); 00115 00118 void destroy(); 00119 00123 void initializePumping(); 00124 00129 void finalizePumping(); 00130 00133 void pump(); 00134 00137 SoundManager* getSoundManager() const { return m_soundmanager; } 00138 00141 EventManager* getEventManager() const { return m_eventmanager; } 00142 00145 TimeManager* getTimeManager() const { return m_timemanager; } 00146 00149 GUIManager* getGuiManager() const { return m_guimanager; } 00150 00153 ImagePool* getImagePool() const { return m_imagepool; } 00154 00157 AnimationPool* getAnimationPool() const { return m_animpool; } 00158 00161 SoundClipPool* getSoundClipPool() const { return m_soundclippool; } 00162 00165 RenderBackend* getRenderBackend() const { return m_renderbackend; } 00166 00169 Model* getModel() const { return m_model; } 00170 00173 LogManager* getLogManager() const { return m_logmanager; } 00174 00177 GuiFont* getDefaultFont() const { return m_defaultfont; } 00178 00181 VFS* getVFS() const { return m_vfs; } 00182 00185 Cursor* getCursor() const { return m_cursor; } 00186 00190 void addChangeListener(IEngineChangeListener* listener); 00191 00195 void removeChangeListener(IEngineChangeListener* listener); 00196 00197 private: 00198 void preInit(); 00199 00200 RenderBackend* m_renderbackend; 00201 GUIManager* m_guimanager; 00202 EventManager* m_eventmanager; 00203 SoundManager* m_soundmanager; 00204 TimeManager* m_timemanager; 00205 ImagePool* m_imagepool; 00206 AnimationPool* m_animpool; 00207 SoundClipPool* m_soundclippool; 00208 VFS* m_vfs; 00209 Model* m_model; 00210 gcn::Graphics* m_gui_graphics; 00211 LogManager* m_logmanager; 00212 GuiFont* m_defaultfont; 00213 Cursor* m_cursor; 00214 bool m_destroyed; 00215 00216 EngineSettings m_settings; 00217 DeviceCaps m_devcaps; 00218 00219 ScreenMode m_screenMode; 00220 00221 std::vector<RendererBase*> m_renderers; 00222 00223 std::vector<IEngineChangeListener*> m_changelisteners; 00224 00225 #ifdef USE_COCOA 00226 objc_object *m_autoreleasePool; 00227 #endif 00228 00229 }; 00230 00231 }//FIFE 00232 00233 #endif