-
Notifications
You must be signed in to change notification settings - Fork 2
/
Engine.h
72 lines (52 loc) · 1.47 KB
/
Engine.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#pragma once
#define GLEW_STATIC
#include <GL/glew.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
#include <functional>
#include "glm/glm.hpp"
#include "glm/gtc/matrix_transform.hpp"
#include "Texture.h"
#include "Camera.h"
#include "Mesh.h"
#include "Model.h"
#include "Light.h"
#include "ResourceManager.h"
#include "KeyManager.h"
#ifdef __APPLE__
#include <CoreGraphics/CoreGraphics.h>
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
#include <OpenGL/CGLCurrent.h>
#endif
namespace g3d {
class Engine {
std::function<void(float deltaTimeSec)> update;
std::function<void()> frameRender;
std::function<void(SDL_Event &e)> handleSDL_Events;
bool quit;
int width, height;
SDL_Window *window;
SDL_GLContext context;
SDL_Event windowEvent;
glm::vec3 clrColor;
GLdouble deltaTime;
int defaultShader;
public:
static Engine *Initialize();
Engine();
~Engine();
void setRenderCallback(std::function<void()> func);
void setUpdateCallback(std::function<void(float deltaTimeSec)> func);
void run();
void setClearColor(glm::vec3 color);
GLdouble getDeltaTime();
int getWidth();
int getHeight();
g3d::Shader *getShader(int id);
g3d::Shader *getDefaultShader();
void setWindowTitle(const char *name);
void shutdown();
};
extern g3d::Engine *engine;
};