-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cc
52 lines (43 loc) · 977 Bytes
/
main.cc
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
/*
* main.cc
*
* Created on: Oct 4, 2016
* Author: routerman
*/
#include "game.h"
Game *game;
void display(void){
game->display();
}
void mouse_click(int state ,int button, int cx,int cy){
game->mouse_click(state,button,I2(cx,cy));
}
void mouse_motion(int cx,int cy){
game->mouse_motion(I2(cx,cy));
}
void key(unsigned char k, int x, int y){
game->key(k,x,y);
}
void timer(int dt){
game->timer(dt);
glutTimerFunc(dt,timer,10);
}
void reshape(GLsizei width, GLsizei height){
game->reshape(width,height);
}
int main(int argc, char **argv){
game = new Game;
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
game->CreateWindow(0,800,600,0,"Othello");
glClearColor( 0 , 0.7, 0, 1);//back ground color
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutKeyboardFunc(key);
glutPassiveMotionFunc(mouse_motion);
glutMouseFunc(mouse_click);
glutTimerFunc(0,timer,10);
glutMainLoop();
delete game;
return 0;
}