-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainController.cpp
53 lines (41 loc) · 1.2 KB
/
mainController.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
#include "headers.hpp"
#include "varStore.hpp"
windowController *wc;
gameController *gc;
VP *vp;
GLfloat Angle, rate, newTime, oldTime;
int dx, dy, dz;
int blockDx, blockDz;
vec3 blockLeft, blockRight, blockUp, blockDown;
double zoomFactor;
double xCursor, yCursor;
bool isBlockView = false, isFollowView = false, isHelicopterView = false;
bool isWinner = false;
bool isRotating = false;
int Score = 0;
GLfloat prevRotatingAngle = 0.0f;
int main(){
wc = new windowController("Blockerz", 800, 600);
wc->setWindowContext();
wc->keyCallback(gameController::key_callback);
wc->mouseCallback(gameController::mouse_moveCallback, gameController::mouse_buttonCallback, gameController::mouse_scrollCallback);
Shader ourShader("shader.vs", "shader.frag");
wc->setProgramId(ourShader.Program);
wc->setViewPort();
vp = new VP();
gc = new gameController();
oldTime = 0.0f;
blockDx = 1; blockDz = 0;
while(!wc->isWindowClosed()){
glfwPollEvents();
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
ourShader.Use();
gc->displayAll();
glfwSwapBuffers(wc->getWindow());
}
if(isWinner){
cout<<"You Win!!!!\n";
cout<<Score<<"\n";
}
}