spaceball
[o2demo] / src / main.c
index 433993d..97d7469 100644 (file)
@@ -11,6 +11,7 @@ static void keydown(unsigned char c, int x, int y);
 static void keyup(unsigned char c, int x, int y);
 static void mouse(int bn, int st, int x, int y);
 static void motion(int x, int y);
+static void sball_button(int bn, int pressed);
 
 static unsigned int start_time;
 
@@ -29,6 +30,9 @@ int main(int argc, char **argv)
        glutKeyboardUpFunc(keyup);
        glutMouseFunc(mouse);
        glutMotionFunc(motion);
+       glutSpaceballMotionFunc(demo_sball_motion);
+       glutSpaceballRotateFunc(demo_sball_rotate);
+       glutSpaceballButtonFunc(sball_button);
 
        if(demo_init(argc, argv) == -1) {
                return 1;
@@ -96,3 +100,8 @@ static void motion(int x, int y)
 {
        demo_mmotion(x, y);
 }
+
+static void sball_button(int bn, int pressed)
+{
+       demo_sball_button(bn - 1, pressed == GLUT_DOWN ? 1 : 0);
+}