FIFE  6e1afdbeda11afe9ac53e6023a4be96ef88f1dc6
engine.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2017 by the FIFE team *
3  * http://www.fifengine.net *
4  * This file is part of FIFE. *
5  * *
6  * FIFE is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU Lesser General Public *
8  * License as published by the Free Software Foundation; either *
9  * version 2.1 of the License, or (at your option) any later version. *
10  * *
11  * This library is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with this library; if not, write to the *
18  * Free Software Foundation, Inc., *
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20  ***************************************************************************/
21 
22 #ifndef FIFE_ENGINE_H
23 #define FIFE_ENGINE_H
24 
25 // Standard C++ library includes
26 #include <map>
27 #include <string>
28 #include <vector>
29 
30 // Platform specific includes
31 #ifdef USE_COCOA
32 #include <objc/runtime.h>
33 #endif
34 
35 // 3rd party library includes
36 #include <SDL.h>
37 
38 // FIFE includes
39 // These includes are split up in two parts, separated by one empty line
40 // First block: files included from the FIFE root src directory
41 // Second block: files included from the same folder
42 #include "enginesettings.h"
43 #include "video/devicecaps.h"
44 
45 namespace FIFE {
46 
47  class SoundManager;
48  class RenderBackend;
49  class IGUIManager;
50  class VFS;
51  class VFSSourceFactory;
52  class EventManager;
53  class TimeManager;
54  class Model;
55  class LogManager;
56  class Cursor;
57  class RendererBase;
58  class Image;
59  class ImageManager;
60  class AnimationManager;
61  class SoundClipManager;
62  class OffRenderer;
63  class TargetRenderer;
64 
66  public:
68 
71  virtual void onScreenModeChanged(const ScreenMode& newmode) = 0;
72  };
73 
80  class Engine {
81  public:
84  Engine();
85 
88  virtual ~Engine();
89 
92  EngineSettings& getSettings();
93 
96  const DeviceCaps& getDeviceCaps() const;
97 
105  void changeScreenMode(const ScreenMode& mode);
106 
109  void init();
110 
113  void destroy();
114 
118  void initializePumping();
119 
124  void finalizePumping();
125 
128  void pump();
129 
132  SoundManager* getSoundManager() const { return m_soundmanager; }
133 
136  EventManager* getEventManager() const { return m_eventmanager; }
137 
140  TimeManager* getTimeManager() const { return m_timemanager; }
141 
142 
146  void setGuiManager(IGUIManager* guimanager) { m_guimanager = guimanager; }
147 
150  IGUIManager* getGuiManager() const { return m_guimanager; }
151 
154  ImageManager* getImageManager() const { return m_imagemanager; }
155 
158  AnimationManager* getAnimationManager() const { return m_animationmanager; }
159 
162  SoundClipManager* getSoundClipManager() const { return m_soundclipmanager; }
163 
166  RenderBackend* getRenderBackend() const { return m_renderbackend; }
167 
170  Model* getModel() const { return m_model; }
171 
174  LogManager* getLogManager() const { return m_logmanager; }
175 
178  VFS* getVFS() const { return m_vfs; }
179 
182  Cursor* getCursor() const { return m_cursor; }
183 
186  OffRenderer* getOffRenderer() const { return m_offrenderer; }
187 
190  TargetRenderer* getTargetRenderer() const { return m_targetrenderer; }
191 
195  void addChangeListener(IEngineChangeListener* listener);
196 
200  void removeChangeListener(IEngineChangeListener* listener);
201 
202  private:
211 
215 
218 
221 
223 
226  std::vector<RendererBase*> m_renderers;
227 
228  std::vector<IEngineChangeListener*> m_changelisteners;
229 
230 #ifdef USE_COCOA
231  id m_autoreleasePool;
232 #endif
233 
234  };
235 
236 }//FIFE
237 
238 #endif
EngineSettings m_settings
Definition: engine.h:219
Abstract interface for all the renderbackends.
This class defines the engine settings on engine init.
ImageManager * m_imagemanager
Definition: engine.h:208
RenderBackend * getRenderBackend() const
Provides access point to the RenderBackend.
Definition: engine.h:166
TimeManager * getTimeManager() const
Provides access point to the TimeManager.
Definition: engine.h:140
ImageManager.
Definition: imagemanager.h:54
Model * getModel() const
Provides access point to the Model.
Definition: engine.h:170
Engine acts as a controller to the whole system Responsibilities of the engine are: ...
Definition: engine.h:80
RenderBackend * m_renderbackend
Definition: engine.h:203
IGUIManager * getGuiManager() const
Provides access point to the GUI Manager.
Definition: engine.h:150
std::vector< IEngineChangeListener * > m_changelisteners
Definition: engine.h:228
LogManager * getLogManager() const
Provides access point to the LogManager.
Definition: engine.h:174
virtual void onScreenModeChanged(const ScreenMode &newmode)=0
Screen mode has been changed.
bool m_destroyed
Definition: engine.h:217
TargetRenderer * m_targetrenderer
Definition: engine.h:225
SoundManager * m_soundmanager
Definition: engine.h:206
Cursor * getCursor() const
Returns cursor used in the engine.
Definition: engine.h:182
DeviceCaps m_devcaps
Definition: engine.h:220
SoundClipManager.
AnimationManager.
LogManager * m_logmanager
Definition: engine.h:214
EventManager * m_eventmanager
Definition: engine.h:205
TimeManager * m_timemanager
Definition: engine.h:207
AnimationManager * m_animationmanager
Definition: engine.h:209
A model is a facade for everything in the model.
Definition: model.h:54
SoundClipManager * getSoundClipManager() const
Provides access point to the SoundClipManager.
Definition: engine.h:162
OffRenderer * m_offrenderer
Definition: engine.h:224
IGUIManager * m_guimanager
Definition: engine.h:204
EventManager * getEventManager() const
Provides access point to the EventManager.
Definition: engine.h:136
Cursor * m_cursor
Definition: engine.h:216
Event Manager manages all events related to FIFE.
Definition: eventmanager.h:80
Time Manager.
Definition: timemanager.h:50
Cursor class manages mouse cursor handling.
Definition: cursor.h:73
std::vector< RendererBase * > m_renderers
Definition: engine.h:226
the main VFS (virtual file system) class
Definition: vfs.h:58
ScreenMode m_screenMode
Definition: engine.h:222
Logmanager takes care of log filtering and output direction.
Definition: logger.h:99
Model * m_model
Definition: engine.h:213
SoundClipManager * m_soundclipmanager
Definition: engine.h:210
ImageManager * getImageManager() const
Provides access point to the ImageManager.
Definition: engine.h:154
TargetRenderer * getTargetRenderer() const
Provides access point to the TargetRenderer.
Definition: engine.h:190
SoundManager * getSoundManager() const
Provides access point to the SoundManager.
Definition: engine.h:132
OffRenderer * getOffRenderer() const
Provides access point to the OffRenderer.
Definition: engine.h:186
virtual ~IEngineChangeListener()
Definition: engine.h:67
VFS * m_vfs
Definition: engine.h:212
void setGuiManager(IGUIManager *guimanager)
Sets the GUI Manager to use.
Definition: engine.h:146
AnimationManager * getAnimationManager() const
Provides access point to the ImageManager.
Definition: engine.h:158
VFS * getVFS() const
Provides access point to the VFS.
Definition: engine.h:178