68 lines
849 B
C++
68 lines
849 B
C++
|
|
#ifndef SPECTRE_GAME_H
|
|
#define SPECTRE_GAME_H
|
|
|
|
#include <Spectre/Graphics.h>
|
|
#include <Spectre/Game/FPSCounter.h>
|
|
|
|
class InputModule;
|
|
class MessageQueue;
|
|
class MessageHandler;
|
|
class PlatformApplication;
|
|
|
|
namespace sp {
|
|
|
|
class Game
|
|
{
|
|
public :
|
|
Game();
|
|
virtual ~Game();
|
|
|
|
void run();
|
|
|
|
void exit();
|
|
|
|
protected :
|
|
|
|
virtual void init() = 0;
|
|
|
|
virtual void update(double dt) = 0;
|
|
|
|
virtual void render() = 0;
|
|
|
|
Graphics* getGraphics() const;
|
|
|
|
InputModule* getInput() const;
|
|
|
|
FPSCounter& getFpsCounter();
|
|
|
|
MessageHandler* getMessageHandler() const;
|
|
|
|
private :
|
|
|
|
void setup();
|
|
|
|
void gameLoop();
|
|
|
|
void processEvents();
|
|
|
|
private :
|
|
|
|
PlatformApplication *m_platform;
|
|
|
|
Graphics *m_graphics;
|
|
|
|
InputModule* m_input;
|
|
|
|
MessageHandler* m_messageHandler;
|
|
|
|
FPSCounter m_fpsCounter;
|
|
|
|
double m_timestep;
|
|
|
|
bool m_running;
|
|
};
|
|
|
|
}
|
|
|
|
#endif /* SPECTRE_GAME_H */
|