My Project
AnnEngine.hpp
Go to the documentation of this file.
1 
8 #pragma once
9 
10 //Keep track of engine version here
11 #define ANN_MAJOR 0
12 #define ANN_MINOR 4
13 #define ANN_PATCH 1
14 #define ANN_EXPERIMENTAL true
15 
16 #include "systemMacro.h"
17 
18 //C++ STD & STL
19 #include <cassert>
20 #include <memory>
21 #include <unordered_map>
22 #include <string>
23 
24 //Annwvyn
25 #include "AnnTypes.h"
26 #include "AnnEventManager.hpp"
27 #include "AnnPhysicsEngine.hpp"
28 #include "AnnTriggerObject.hpp"
29 #include "AnnAudioEngine.hpp"
30 #include "AnnConsole.hpp"
31 #include "AnnLevelManager.hpp"
32 #include "AnnFilesystem.hpp"
33 #include "AnnResourceManager.hpp"
34 #include "AnnGameObject.hpp"
35 #include "AnnGameObjectManager.hpp"
36 #include "AnnSceneryManager.hpp"
37 #include "AnnScriptManager.hpp"
38 #include "AnnStringUtility.hpp"
39 #include "AnnPlayerBody.hpp"
41 
42 //Get the deprecated warnings
43 #pragma warning(default : 4996)
44 
45 namespace Annwvyn
46 {
47  class AnnEngine;
48  class AnnPhysicsEngine;
49 
50  //Pre-declare renderer abstract class
51  class AnnOgreVRRenderer;
56 
59 
62  {
65  friend class AnnEngine;
67  };
68 
71  {
73 
77 
85 
87  void selectAndCreateRenderer(const std::string& hmd, const std::string& title);
88 
91 
92  public:
94  static bool registerVRRenderer(const std::string& name);
95 
97  static void manuallyRegisterVRRender(const std::string& name, AnnOgreVRRendererBootstrapFunction boostrapFunctionPointer);
98 
101 
103  static void setLogFileName(const char* logName);
104 
106  static void setDefaultRenderer(const char* renderer);
107 
109  static void setNoConsoleColor();
110 
112  static void setProcessPriorityNormal();
113 
115  static void setProcessPriorityHigh();
116 
118  static AnnEngine* Instance();
119 
121  static std::string getAnnwvynVersion(size_t padding = 0);
122 
125  AnnEngine(const char title[], const std::string& hmdCommand = "DefaultRender");
126 
128  ~AnnEngine();
129 
133  static void writeToLog(std::string message, bool flag = true); //engine
134 
136  AnnPlayerBodyPtr getPlayer() const;
137 
140  DEPRECATED bool isKeyDown(OIS::KeyCode key) const; //event
141 
143  Ogre::SceneNode* getPlayerPovNode() const;
144 
148  static bool openConsole();
149 
151  Ogre::SceneManager* getSceneManager() const; //scene or graphics
152 
154  AnnEventManagerPtr getEventManager() const;
155 
157  AnnFilesystemManagerPtr getFileSystemManager() const;
158 
160  AnnAudioEnginePtr getAudioEngine() const; //audio
161 
163  AnnPhysicsEnginePtr getPhysicsEngine() const;
164 
166  AnnLevelManagerPtr getLevelManager() const;
167 
169  AnnResourceManagerPtr getResourceManager() const;
170 
172  AnnGameObjectManagerPtr getGameObjectManager() const;
173 
175  AnnSceneryManagerPtr getSceneryManager() const;
176 
178  AnnScriptManagerPtr getScriptManager() const;
179 
181  AnnOgreVRRendererPtr getVRRenderer() const;
182 
184  AnnConsolePtr getOnScreenConsole() const;
185 
187  AnnStringUtilityPtr getStringUtility() const;
188 
190  void initPlayerStandingPhysics() const;
191 
193  void initPlayerRoomscalePhysics() const;
194 
196  bool checkNeedToQuit() const; //engine
197 
199  bool refresh(); //engine main loop
200 
202  void syncPalyerPov() const;
203 
205  void startGameplayLoop();
206 
208  bool appVisibleInHMD() const;
209 
211  unsigned long getTimeFromStartUp() const; //engine
212 
214  double getTimeFromStartupSeconds() const;
215 
217  double getFrameTime() const;
218 
220  DEPRECATED AnnPose getHmdPose() const;
221 
223  AnnUserSubSystemPtr registerUserSubSystem(AnnUserSubSystemPtr userSystem);
224 
226  void loadUserSubSystemFromPlugin(const std::string& pluginName, bool local = true);
227 
229  template <class AnnUserSubSystemType, class... Args>
230  decltype(auto) registerUserSubSystem(Args&&... args)
231  {
232  auto subsystem = std::make_shared<AnnUserSubSystemType>(args...);
233  auto output = registerUserSubSystem(std::static_pointer_cast<AnnUserSubSystem>(subsystem));
234  if(output != nullptr) return subsystem;
235  subsystem = nullptr;
236  return subsystem;
237  }
238 
240  AnnSubSystemPtr getSubSystemByName(const std::string& name);
241 
243  static bool isUserSubSystem(AnnSubSystemPtr subsystem);
244 
246  void removeUserSubSystem(AnnUserSubSystemPtr subsystem);
247 
249  void requestQuit();
250 
251  private:
252  static void setConsoleGreen();
253  static void setConsoleYellow();
254 
255 #ifdef _WIN32
256  static WORD consoleGreen;
257  static WORD consoleYellow;
258  static WORD consoleWhite;
259 #endif
260  static bool consoleReady;
263  static bool noConsoleColor;
265  static bool manualConsole;
268 
271 
298 
300  Ogre::SceneManager* SceneManager;
303 
305  double updateTime;
306 
309  };
310 }
file for defining macros used for symbol export regarding the way the OS does things.
AnnStringUtilityPtr stringUtility
String Utility;.
Definition: AnnEngine.hpp:273
Abstract class for VR Renderers. Serve as interface between Annwvyn, and "OgreHMDRender" object.
AnnConsolePtr onScreenConsole
The onScreenConsole object.
Definition: AnnEngine.hpp:277
static AnnEngine * singleton
the singleton address itself is stored here
Definition: AnnEngine.hpp:75
Represent the output console that can be shown by calling AnnEngine::toggleOnScreenConsole() This cla...
AnnOgreVRRenderer *(*)(const std::string &appName) AnnOgreVRRendererBootstrapFunction
Definition: AnnEngine.hpp:55
Utility class for AnnEngine.
Definition: AnnEngine.hpp:61
AnnLevelManagerPtr levelManager
LevelManager.
Definition: AnnEngine.hpp:293
Main engine class. Creating an instance of this class make the engine start.
Definition: AnnEngine.hpp:70
AnnFilesystemManagerPtr filesystemManager
FilesystemManager.
Definition: AnnEngine.hpp:283
Namespace containing the totality of Annwvyn components.
Definition: AnnGetter.cpp:8
#define DEPRECATED
Mark the symbol as Deprecated. The comments on it should help you use the correct method.
Definition: systemMacro.h:40
AnnResourceManagerPtr resourceManager
ResourceManager.
Definition: AnnEngine.hpp:279
class that represent the player
Ogre::SceneNode * vrRendererPovGameplayPlacement
Point Of View : Node used as "root" for putting the VR "camera rig".
Definition: AnnEngine.hpp:302
A pose refer to the combination of a position and an orientation. It permit to define the placement o...
AnnEngineSingletonReseter resetGuard
Object that upon it's destruction will reset the static singleton pointer to nullptr....
Definition: AnnEngine.hpp:84
static bool manualConsole
If true, a console was manually allocated.
Definition: AnnEngine.hpp:265
AnnScriptManagerPtr scriptManager
ScriptManager.
Definition: AnnEngine.hpp:295
Implement file I/O for saving game data.
AnnPlayerBodyPtr player
Player.
Definition: AnnEngine.hpp:297
static bool autosetProcessPriorityHigh
Public flag, true by default : will ask Windows to give us high priority.
Definition: AnnEngine.hpp:100
static std::vector< AnnUniqueDynamicLibraryHolder > dynamicLibraries
loaded libraries
Definition: AnnEngine.hpp:270
OpenAL audio handling for Annwvyn handle the OpenAL context creation and the loading of sound files h...
AnnOgreVRRendererPtr renderer
VR renderer.
Definition: AnnEngine.hpp:275
AnnAudioEnginePtr audioEngine
Audio engine.
Definition: AnnEngine.hpp:285
std::vector< AnnSubSystemPtr > subsystems
Container for all the subsystem. Populated in the update/delete order.
Definition: AnnEngine.hpp:308
static AnnOgreVRRenderBootstrapMap registeredRenderers
Definition: AnnEngine.hpp:72
AnnSceneryManagerPtr sceneryManager
SceneryManager.
Definition: AnnEngine.hpp:281
static std::string logFileName
Definition: AnnEngine.hpp:89
AnnGameObjectManagerPtr gameObjectManager
GameObjectManager.
Definition: AnnEngine.hpp:291
AnnPhysicsEnginePtr physicsEngine
Physics.
Definition: AnnEngine.hpp:289
static bool noConsoleColor
If true, don't use color in the output.
Definition: AnnEngine.hpp:263
event management for Annwvyn
Main class of the level system The Level Manager load and unload levels from the internal Ogre Scene....
Object for representing a volume that trigger an event.
The Physics Engine handle the Bullet "dynamics world" where the simulation occurs....
AnnEventManagerPtr eventManager
Event manager.
Definition: AnnEngine.hpp:287
bool applicationQuitRequested
If true, should quit the app ASAP.
Definition: AnnEngine.hpp:267
Data types definition for Annwvyn.
#define AnnDllExport
Definition: systemMacro.h:24
double updateTime
Elapsed time between 2 frames.
Definition: AnnEngine.hpp:305
Ogre::SceneManager * SceneManager
The scene manager.
Definition: AnnEngine.hpp:300
Game Object class.
static std::string defaultRenderer
Definition: AnnEngine.hpp:90