86 lines
1.9 KiB
C++
86 lines
1.9 KiB
C++
#ifndef ENGINE_H
|
|
#define ENGINE_H
|
|
|
|
#include <string>
|
|
|
|
class Input;
|
|
class SparrowRenderer;
|
|
class SceneTree;
|
|
class SparrowShell;
|
|
class PhysicsDebugNode;
|
|
|
|
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 initPhysics();
|
|
|
|
void enablePhysicsDebug();
|
|
void disablePhysicsDebug();
|
|
|
|
void toggleMouseVisibility();
|
|
|
|
// 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;}
|
|
SceneTree* getScene() const {return m_scene;}
|
|
|
|
void outputShell(std::string str) const;
|
|
|
|
unsigned int getTime() const;
|
|
unsigned int getDeltaTime() const;
|
|
|
|
SceneTree* createScene();
|
|
|
|
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;
|
|
SparrowShell* m_sparrowshell;
|
|
btDiscreteDynamicsWorld* m_world;
|
|
PhysicsDebugNode *m_physicsDebugNode;
|
|
SparrowRenderer* m_renderer;
|
|
|
|
void update();
|
|
|
|
int m_togglePhysicsDebugAction;
|
|
int m_toggleShellAction;
|
|
int m_exitGameAction;
|
|
int m_showMouseAction;
|
|
bool m_mouseVisible;
|
|
void checkSpecialInputs();
|
|
};
|
|
|
|
#endif
|