Fries
23dd7ace18
Right now the implementation is extremely unoptimized and draw call heavy as I just copy and pasted that from the docs for tiny obj loader but added gl calls.
36 lines
759 B
C++
36 lines
759 B
C++
#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
|