From: Tim R. <ti...@us...> - 2004-07-31 16:41:19
|
Update of /cvsroot/csdopenglnet/csdOpenGL/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17891 Modified Files: gtkAdvanced.cs Log Message: mouse rotation with speed commensurate to window size Index: gtkAdvanced.cs =================================================================== RCS file: /cvsroot/csdopenglnet/csdOpenGL/samples/gtkAdvanced.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gtkAdvanced.cs 31 Jul 2004 16:29:45 -0000 1.6 --- gtkAdvanced.cs 31 Jul 2004 16:41:11 -0000 1.7 *************** *** 203,214 **** protected void OnMotionNotify( object obj, MotionNotifyEventArgs args) { ! if (args.Event.State==Gdk.ModifierType.Button1Mask) { if ( mouseX>=0.0 ) { ! rotY += ((float)(args.Event.X-mouseX)) * speedY; } else mouseX = args.Event.X; if ( mouseY>=0.0 ) { ! rotX += ((float)(args.Event.Y-mouseY)) * speedX; } else mouseY = args.Event.Y; } } --- 203,222 ---- protected void OnMotionNotify( object obj, MotionNotifyEventArgs args) { ! if (args.Event.State==Gdk.ModifierType.Button1Mask) { + int w = 0; + int h = 0; + glarea.GdkWindow.GetSize( out w, out h ); + if ( mouseX>=0.0 ) { ! rotY += ((float)(args.Event.X-mouseX)) * 360.0f / w; ! mouseX = args.Event.X; } else mouseX = args.Event.X; + if ( mouseY>=0.0 ) { ! rotX += ((float)(args.Event.Y-mouseY)) * 360.0f / h; ! mouseY = args.Event.Y; } else mouseY = args.Event.Y; + } } |