1 #ifndef ENGINE_H
2 #define ENGINE_H
3 
4 #include <unordered_map>
5 #include "stringImproved.h"
6 #include "P.h"
7 
8 #include "input.h"
9 #include "windowManager.h"
10 #include "postProcessManager.h"
11 #include "shaderManager.h"
12 #include "scriptInterface.h"
13 #include "resources.h"
14 #include "soundManager.h"
15 #include "textureManager.h"
16 #include "gameEntity.h"
17 #include "collisionable.h"
18 #include "random.h"
19 #include "vectorUtils.h"
20 #include "multiplayer.h"
21 #include "multiplayer_server.h"
22 #include "multiplayer_server_scanner.h"
23 #include "multiplayer_client.h"
24 #include "event.h"
25 #include "logging.h"
26 #include "tween.h"
27 #include "clipboard.h"
28 
29 class Engine;
30 extern Engine* engine;
31 
32 class Engine
33 {
34 public:
35     class EngineTiming
36     {
37     public:
38         float update;
39         float collision;
40         float render;
41         float server_update;
42     };
43 private:
44     bool running;
45     WindowManager* windowManager;
46 
47     std::unordered_map<string, P<PObject> > objectMap;
48     float elapsedTime;
49     float gameSpeed;
50 
51     EngineTiming last_engine_timing;
52 public:
53     Engine();
54     ~Engine();
55 
56     void setGameSpeed(float speed);
57     float getGameSpeed();
58     float getElapsedTime();
59     EngineTiming getEngineTiming();
60 
61     void registerObject(string name, P<PObject> obj);
62     P<PObject> getObject(string name);
63 
64     void runMainLoop();
65     void shutdown();
66 private:
67     void handleEvent(sf::Event& event);
68 };
69 
70 #endif//ENGINE_H
71