intravenous
diff src/main.cc @ 1:3ea290d35984
it's never going to finish but wth :)
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 21 Apr 2012 22:42:43 +0300 |
parents | 2b30f261f641 |
children | 472c28b8b875 |
line diff
1.1 --- a/src/main.cc Sat Apr 21 06:56:33 2012 +0300 1.2 +++ b/src/main.cc Sat Apr 21 22:42:43 2012 +0300 1.3 @@ -10,6 +10,8 @@ 1.4 void reshape(int x, int y); 1.5 void key_press(unsigned char key, int x, int y); 1.6 void key_release(unsigned char key, int x, int y); 1.7 +void mouse(int bn, int state, int x, int y); 1.8 +void motion(int x, int y); 1.9 1.10 int win_xsz, win_ysz; 1.11 1.12 @@ -25,6 +27,8 @@ 1.13 glutReshapeFunc(reshape); 1.14 glutKeyboardFunc(key_press); 1.15 glutKeyboardUpFunc(key_release); 1.16 + glutMouseFunc(mouse); 1.17 + glutMotionFunc(motion); 1.18 1.19 if(!game_init()) { 1.20 return 1; 1.21 @@ -45,6 +49,7 @@ 1.22 // update any game logic 1.23 game_update(msec); 1.24 1.25 + glClearColor(0.05, 0.05, 0.05, 1.0); 1.26 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 1.27 1.28 // render stuff 1.29 @@ -75,3 +80,13 @@ 1.30 { 1.31 game_input_keyb(key, 0); 1.32 } 1.33 + 1.34 +void mouse(int bn, int state, int x, int y) 1.35 +{ 1.36 + game_input_mbutton(bn - GLUT_LEFT_BUTTON, state == GLUT_DOWN, x, y); 1.37 +} 1.38 + 1.39 +void motion(int x, int y) 1.40 +{ 1.41 + game_input_mmotion(x, y); 1.42 +}