glviewvol

diff src/main.cc @ 7:71b479ffb9f7

curve manipulation works
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 30 Dec 2014 17:28:38 +0200
parents f22be47a3572
children fb6d93471352
line diff
     1.1 --- a/src/main.cc	Tue Dec 30 06:22:54 2014 +0200
     1.2 +++ b/src/main.cc	Tue Dec 30 17:28:38 2014 +0200
     1.3 @@ -21,6 +21,7 @@
     1.4  static void motion(int x, int y);
     1.5  
     1.6  static int win_width, win_height;
     1.7 +static unsigned int mod;
     1.8  
     1.9  int main(int argc, char **argv)
    1.10  {
    1.11 @@ -40,6 +41,7 @@
    1.12  	glutKeyboardUpFunc(key_up);
    1.13  	glutMouseFunc(mouse);
    1.14  	glutMotionFunc(motion);
    1.15 +	glutPassiveMotionFunc(motion);
    1.16  
    1.17  	glewInit();
    1.18  
    1.19 @@ -73,6 +75,11 @@
    1.20  	*ysz = win_height;
    1.21  }
    1.22  
    1.23 +unsigned int get_modifiers()
    1.24 +{
    1.25 +	return mod;
    1.26 +}
    1.27 +
    1.28  static void display()
    1.29  {
    1.30  	ev_display();
    1.31 @@ -87,16 +94,19 @@
    1.32  
    1.33  static void key_down(unsigned char key, int x, int y)
    1.34  {
    1.35 +	mod = glutGetModifiers();
    1.36  	ev_keyboard(key, 1, x, y);
    1.37  }
    1.38  
    1.39  static void key_up(unsigned char key, int x, int y)
    1.40  {
    1.41 +	mod = glutGetModifiers();
    1.42  	ev_keyboard(key, 0, x, y);
    1.43  }
    1.44  
    1.45  static void mouse(int bn, int state, int x, int y)
    1.46  {
    1.47 +	mod = glutGetModifiers();
    1.48  	ev_mouse_button(bn - GLUT_LEFT_BUTTON, state == GLUT_DOWN ? 1 : 0, x, y);
    1.49  }
    1.50