Update to Keyboard Handling.

This commit is contained in:
the_fiddler 2008-01-20 09:00:15 +00:00
parent cdab33e4a6
commit 71843190b2

View file

@ -18,7 +18,7 @@ using System.Runtime.InteropServices;
namespace Examples namespace Examples
{ {
[Example("GLU Tesselation Functions Test", ExampleCategory.Test)] [Example("GLU Tesselation Functions Test", ExampleCategory.OpenGL)]
public class Test : GameWindow public class Test : GameWindow
{ {
int startList; int startList;
@ -43,9 +43,12 @@ namespace Examples
unsafe delegate void VertexCallbackDelegate(IntPtr v); unsafe delegate void VertexCallbackDelegate(IntPtr v);
VertexCallbackDelegate tessVertex; VertexCallbackDelegate tessVertex;
//Delegate tessBegin, tessEnd, tessVertex; public Test() : base()
{
Keyboard.KeyDown += KeyDownHandler;
}
public Test() : base() { } #region --- GLU Tessellation callbacks ---
#region BeginHandler #region BeginHandler
@ -114,6 +117,18 @@ namespace Examples
#endregion #endregion
#endregion
#region KeyDownHandler
public void KeyDownHandler(KeyboardDevice sender, Key key)
{
if (Keyboard[Key.Escape])
this.Exit();
}
#endregion
#region OnResize #region OnResize
protected override void OnResize(OpenTK.Platform.ResizeEventArgs e) protected override void OnResize(OpenTK.Platform.ResizeEventArgs e)
@ -121,7 +136,7 @@ namespace Examples
GL.Viewport(0, 0, Width, Height); GL.Viewport(0, 0, Width, Height);
GL.MatrixMode(MatrixMode.Projection); GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity(); GL.LoadIdentity();
Glu.Ortho2D(0.0, (double)Width, (double)Height, 0.0); Glu.Ortho2D(0.0, (double)Width, 0.0, (double)Height);
} }
#endregion #endregion
@ -272,16 +287,6 @@ namespace Examples
#endregion #endregion
#region OnUpdateFrame
public override void OnUpdateFrame(UpdateFrameEventArgs e)
{
if (Keyboard[Key.Escape])
this.Exit();
}
#endregion
#region OnRenderFrame #region OnRenderFrame
public override void OnRenderFrame(RenderFrameEventArgs e) public override void OnRenderFrame(RenderFrameEventArgs e)