[Examples] Set a predefined cursor on Key.Space
authorthefiddler <stapostol@gmail.com>
Sun, 27 Apr 2014 17:43:16 +0000 (19:43 +0200)
committerthefiddler <stapostol@gmail.com>
Sun, 27 Apr 2014 17:43:16 +0000 (19:43 +0200)
Custom cursor are not enabled for OpenTK 1.1.2. They will be part of
OpenTK 1.1.3.

Source/Examples/OpenTK/GameWindow/MouseCursorSimple.cs

index 2ff22bf..00c47b2 100644 (file)
@@ -37,7 +37,8 @@ namespace Examples.Tutorial
                     offset, rgba, y * stride, stride);
             }
             
-            this.Cursor = new OpenTK.MouseCursor(rgba, bitmap.Width, bitmap.Height, 0, 0);
+            //this.Cursor = new OpenTK.MouseCursor(rgba, bitmap.Width, bitmap.Height, 0, 0);
+            this.Cursor = MouseCursor.Default;
         }
 
         #region Keyboard_KeyDown
@@ -50,13 +51,29 @@ namespace Examples.Tutorial
         void Keyboard_KeyDown(object sender, KeyboardKeyEventArgs e)
         {
             if (e.Key == Key.Escape)
+            {
                 this.Exit();
+            }
 
-            if (e.Key == Key.F11)
+            if (e.Key == Key.Enter && e.Alt)
+            {
                 if (this.WindowState == WindowState.Fullscreen)
                     this.WindowState = WindowState.Normal;
                 else
                     this.WindowState = WindowState.Fullscreen;
+            }
+
+            if (e.Key == Key.Space)
+            {
+                if (Cursor == MouseCursor.Default)
+                {
+                    Cursor = MouseCursor.Empty;
+                }
+                else
+                {
+                    Cursor = MouseCursor.Default;
+                }
+            }
         }
 
         #endregion