-
Notifications
You must be signed in to change notification settings - Fork 1
/
engine.cpp
62 lines (50 loc) · 900 Bytes
/
engine.cpp
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
#include <stdio.h>
#include <GL/glew.h>
#include "engine.h"
#include "msg.h"
#include "cube.h"
#include "sound.h"
#include "scene.h"
void Engine::init()
{
m_engine = this;
}
void Engine::initRender()
{
m_render = new GLRender;
m_scene = new Scene();
}
void Engine::drawFrame()
{
if (m_render) {
updateTimer();
m_render->drawFrame();
m_scene->drawFrame(0);
}
}
void Engine::setViewport(int x, int y) {
if (m_render) {
m_render->setViewport(x, y);
}
}
void Engine::toggleFrame() {
if (m_render)
m_render->toggleFrame();
}
void Engine::reloadShaders()
{
if (m_render)
m_render->loadShaders();
}
void Engine::destroy() {
delete m_render;
}
double Engine::getTime() {
return m_time;
}
int Engine::getResX() {
return m_render->getResX();
}
int Engine::getResY() {
return m_render->getResY();
}