dreamcast-opengl/engine.hh

37 lines
759 B
C++
Raw Normal View History

#ifndef ENGINE_HH
#define ENGINE_HH
#include <kos.h>
#include <sys/time.h>
#include <functional>
class Engine {
protected:
static constexpr float microSecond = 0.000001f;
float angle = 0;
float deltaTime = 1.0 / 60.0;
float speed = 5.0f;
bool thirtyfps;
unsigned int buttonsPressed;
virtual 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