SparrowEngine/src/engine.h
2017-08-29 16:11:45 +02:00

97 lines
2.3 KiB
C++

#ifndef ENGINE_H
#define ENGINE_H
#include <string>
class Input;
class SparrowRenderer;
class SceneTree;
class SparrowShell;
class PhysicsDebugNode;
class Editor;
class LoadingThread;
namespace sf
{
class Clock;
class Window;
}
class btDiscreteDynamicsWorld;
class Engine
{
public:
Engine();
~Engine();
void createWindow(std::string title = "SparrowEngine",
unsigned int w = 800,
unsigned int h = 600,
const std::string &mode = "windowed");
// void setScene(SceneTree *scene);
void setScene(std::string scene);
void initPhysics();
void enablePhysicsDebug();
void disablePhysicsDebug();
void toggleMouseVisibility();
bool isMouseGrabbed() const { return !m_mouseVisible; }
// special inputs
void setTogglePhysicsDebugAction(int action);
void setToggleShellAction(int action);
void setExitGameAction(int action);
void setShowMouseAction(int action);
void start();
void stop();
Input* getInput() const {return m_input;}
sf::Window* getWindow() const {return m_window;}
SparrowRenderer* getRenderer() const {return m_renderer;}
btDiscreteDynamicsWorld* getPhysics() const {return m_world;}
SparrowShell* getShell() const {return m_sparrowshell;}
Editor* getGuiTools() const {return m_editor;}
LoadingThread* getLoadingThread() const {return m_loadingThread;}
SceneTree* getScene() const;
unsigned int getTime() const;
unsigned int getDeltaTime() const;
// SceneTree* createScene();
void createScene(std::string scene_name);
//void setCurrentScene(std::string scene_name){m_current_scene = scene_name;}
private:
sf::Clock* m_clock;
unsigned int m_timeStamp = 0;
unsigned int m_lastTimeStamp = 0;
bool m_running;
sf::Window* m_window;
Input* m_input;
// SceneTree* m_scene;
std::string m_current_scene;
SparrowShell* m_sparrowshell;
btDiscreteDynamicsWorld* m_world;
PhysicsDebugNode *m_physicsDebugNode;
SparrowRenderer* m_renderer;
Editor* m_editor;
LoadingThread* m_loadingThread;
void update();
int m_togglePhysicsDebugAction;
int m_toggleShellAction;
int m_exitGameAction;
int m_showMouseAction;
bool m_mouseVisible;
bool m_pickerEnabled;
void checkSpecialInputs();
};
#endif