From 51567e610c8e49ee44410bd5893bfc452aca273e Mon Sep 17 00:00:00 2001 From: thefiddler Date: Sun, 27 Apr 2014 19:43:16 +0200 Subject: [PATCH] [Examples] Set a predefined cursor on Key.Space Custom cursor are not enabled for OpenTK 1.1.2. They will be part of OpenTK 1.1.3. --- .../OpenTK/GameWindow/MouseCursorSimple.cs | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Source/Examples/OpenTK/GameWindow/MouseCursorSimple.cs b/Source/Examples/OpenTK/GameWindow/MouseCursorSimple.cs index 2ff22bf3..00c47b26 100644 --- a/Source/Examples/OpenTK/GameWindow/MouseCursorSimple.cs +++ b/Source/Examples/OpenTK/GameWindow/MouseCursorSimple.cs @@ -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