[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.
This commit is contained in:
thefiddler 2014-04-27 19:43:16 +02:00
parent a61d20d2eb
commit 51567e610c

View file

@ -37,7 +37,8 @@ namespace Examples.Tutorial
offset, rgba, y * stride, stride); 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 #region Keyboard_KeyDown
@ -50,15 +51,31 @@ namespace Examples.Tutorial
void Keyboard_KeyDown(object sender, KeyboardKeyEventArgs e) void Keyboard_KeyDown(object sender, KeyboardKeyEventArgs e)
{ {
if (e.Key == Key.Escape) if (e.Key == Key.Escape)
{
this.Exit(); this.Exit();
}
if (e.Key == Key.F11) if (e.Key == Key.Enter && e.Alt)
{
if (this.WindowState == WindowState.Fullscreen) if (this.WindowState == WindowState.Fullscreen)
this.WindowState = WindowState.Normal; this.WindowState = WindowState.Normal;
else else
this.WindowState = WindowState.Fullscreen; this.WindowState = WindowState.Fullscreen;
} }
if (e.Key == Key.Space)
{
if (Cursor == MouseCursor.Default)
{
Cursor = MouseCursor.Empty;
}
else
{
Cursor = MouseCursor.Default;
}
}
}
#endregion #endregion
#region OnLoad #region OnLoad