37 lines
740 B
C++
37 lines
740 B
C++
|
#ifndef ENGINE_HH
|
||
|
#define ENGINE_HH
|
||
|
|
||
|
#include <kos.h>
|
||
|
#include <sys/time.h>
|
||
|
|
||
|
#include <functional>
|
||
|
|
||
|
class Engine {
|
||
|
protected:
|
||
|
const float microSecond = 0.000001f;
|
||
|
|
||
|
float angle = 0;
|
||
|
float deltaTime = 1.0 / 60.0;
|
||
|
float speed = 5.0f;
|
||
|
|
||
|
bool thirtyfps;
|
||
|
unsigned int buttonsPressed;
|
||
|
|
||
|
void initScreen();
|
||
|
void printSystemInformation();
|
||
|
virtual void gameLoop(){};
|
||
|
void pressButton(cont_state_t* controller_state, int button,
|
||
|
std::function<void()> callback);
|
||
|
void glVertex3fNormalized(float x, float y, float z);
|
||
|
|
||
|
private:
|
||
|
template <typename T>
|
||
|
void deltaTimeLoop(T&& callback, struct timeval& beginningOfFrame,
|
||
|
struct timeval& endOfFrame);
|
||
|
|
||
|
public:
|
||
|
void initializeEngine();
|
||
|
void initializeGameLoop();
|
||
|
};
|
||
|
#endif
|