tibia-client/src/framework/core/engine.h

54 lines
1.1 KiB
C
Raw Normal View History

#ifndef ENGINE_H
#define ENGINE_H
2011-07-13 23:12:36 +02:00
#include <global.h>
2011-07-17 02:13:53 +02:00
#include "input.h"
2010-11-23 16:30:43 +01:00
class Engine
{
public:
2011-04-06 21:46:58 +02:00
Engine() : m_stopping(false),
m_running(false),
m_calculateFps(false) { }
void init();
void terminate();
/// Poll events
void poll();
/// Main loop
void run();
2010-11-23 16:30:43 +01:00
/// Stops main loop
void stop();
2010-11-23 16:30:43 +01:00
/// Change current game state
bool isRunning() const { return m_running; }
bool isStopping() const { return m_stopping; }
/// Fired by platform on window close
void onClose();
/// Fired by platform on window resize
2011-04-08 07:10:00 +02:00
void onResize(const Size& size);
/// Fired by platform on mouse/keyboard input
void onInputEvent(const InputEvent& event);
2011-04-07 10:38:29 +02:00
/// Enable FPS counter on screen
void enableFpsCounter(bool enable = true) { m_calculateFps = enable; };
2011-04-17 22:09:37 +02:00
/// Return the current ticks on this frame
2011-04-17 21:14:24 +02:00
int getCurrentFrameTicks() const { return m_lastFrameTicks; }
2011-04-15 04:13:53 +02:00
private:
bool m_stopping;
bool m_running;
2011-04-07 10:38:29 +02:00
bool m_calculateFps;
2011-04-15 04:13:53 +02:00
int m_lastFrameTicks;
};
extern Engine g_engine;
#endif // ENGINE_H