vrfileman

diff src/main.cc @ 2:282da6123fd4

lalalala
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 01 Feb 2015 12:51:10 +0200
parents dca518e371cf
children
line diff
     1.1 --- a/src/main.cc	Sat Jan 31 20:01:35 2015 +0200
     1.2 +++ b/src/main.cc	Sun Feb 01 12:51:10 2015 +0200
     1.3 @@ -15,6 +15,9 @@
     1.4  static void key_up(unsigned char key, int x, int y);
     1.5  static void mouse(int bn, int state, int x, int y);
     1.6  static void motion(int x, int y);
     1.7 +static void sball_motion(int x, int y, int z);
     1.8 +static void sball_rotate(int x, int y, int z);
     1.9 +static void sball_button(int bn, int state);
    1.10  
    1.11  static int win_width, win_height;
    1.12  static unsigned int mod;
    1.13 @@ -34,6 +37,9 @@
    1.14  	glutMouseFunc(mouse);
    1.15  	glutMotionFunc(motion);
    1.16  	glutPassiveMotionFunc(motion);
    1.17 +	glutSpaceballMotionFunc(sball_motion);
    1.18 +	glutSpaceballRotateFunc(sball_rotate);
    1.19 +	glutSpaceballButtonFunc(sball_button);
    1.20  
    1.21  	if(app_init() == -1) {
    1.22  		return 1;
    1.23 @@ -104,3 +110,18 @@
    1.24  {
    1.25  	app_mouse_motion(x, y);
    1.26  }
    1.27 +
    1.28 +static void sball_motion(int x, int y, int z)
    1.29 +{
    1.30 +	app_sball_motion(x / 1000.0f, y / 1000.0f, z / 1000.0f);
    1.31 +}
    1.32 +
    1.33 +static void sball_rotate(int x, int y, int z)
    1.34 +{
    1.35 +	app_sball_rotate(x / 1800.0f, y / 1800.0f, z / 1800.0f);
    1.36 +}
    1.37 +
    1.38 +static void sball_button(int bn, int state)
    1.39 +{
    1.40 +	app_sball_button(bn, state == GLUT_DOWN);
    1.41 +}