mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 17:25:39 +00:00
[Examples] Fixed all warnings
This commit is contained in:
parent
98399c2f48
commit
7a064c382a
|
@ -72,7 +72,8 @@ namespace Examples.Tutorial
|
|||
{
|
||||
base.OnUpdateFrame(e);
|
||||
|
||||
if (Keyboard[Key.Escape])
|
||||
var keyboard = OpenTK.Input.Keyboard.GetState();
|
||||
if (keyboard[Key.Escape])
|
||||
Exit();
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,8 @@ namespace Examples.Tutorial
|
|||
|
||||
protected override void OnUpdateFrame(FrameEventArgs e)
|
||||
{
|
||||
if (Keyboard[OpenTK.Input.Key.Escape])
|
||||
var keyboard = OpenTK.Input.Keyboard.GetState();
|
||||
if (keyboard[OpenTK.Input.Key.Escape])
|
||||
{
|
||||
this.Exit();
|
||||
}
|
||||
|
|
|
@ -220,7 +220,8 @@ namespace Examples.Tutorial
|
|||
{
|
||||
base.OnUpdateFrame(e);
|
||||
|
||||
if (Keyboard[Key.Escape])
|
||||
var keyboard = OpenTK.Input.Keyboard.GetState();
|
||||
if (keyboard[Key.Escape])
|
||||
this.Exit();
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,8 @@ namespace Examples.Tutorial
|
|||
{
|
||||
base.OnUpdateFrame(e);
|
||||
|
||||
if (Keyboard[OpenTK.Input.Key.Escape])
|
||||
var keyboard = OpenTK.Input.Keyboard.GetState();
|
||||
if (keyboard[OpenTK.Input.Key.Escape])
|
||||
{
|
||||
this.Exit();
|
||||
return;
|
||||
|
|
|
@ -411,7 +411,8 @@ namespace Examples.Tutorial
|
|||
{
|
||||
base.OnUpdateFrame(e);
|
||||
|
||||
if (Keyboard[Key.Escape])
|
||||
var keyboard = OpenTK.Input.Keyboard.GetState();
|
||||
if (keyboard[Key.Escape])
|
||||
Exit();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,11 +24,19 @@ namespace Examples.Tutorial
|
|||
[Example("Picking", ExampleCategory.OpenGL, "1.x", Documentation = "Picking")]
|
||||
class Picking : GameWindow
|
||||
{
|
||||
int mouse_x, mouse_y;
|
||||
|
||||
/// <summary>Creates a 800x600 window with the specified title.</summary>
|
||||
public Picking()
|
||||
: base(800, 600, GraphicsMode.Default, "Picking", GameWindowFlags.Default, DisplayDevice.Default, 1, 1, GraphicsContextFlags.Default)
|
||||
{
|
||||
VSync = VSyncMode.On;
|
||||
|
||||
MouseMove += (sender, e) =>
|
||||
{
|
||||
mouse_x = e.X;
|
||||
mouse_y = e.Y;
|
||||
};
|
||||
}
|
||||
|
||||
struct Byte4
|
||||
|
@ -192,7 +200,6 @@ namespace Examples.Tutorial
|
|||
GL.UseProgram(0);
|
||||
*/
|
||||
#endregion Shader
|
||||
|
||||
}
|
||||
|
||||
protected override void OnUnload(EventArgs e)
|
||||
|
@ -224,7 +231,8 @@ namespace Examples.Tutorial
|
|||
/// <param name="e">Contains timing information for framerate independent logic.</param>
|
||||
protected override void OnUpdateFrame(FrameEventArgs e)
|
||||
{
|
||||
if (Keyboard[Key.Escape])
|
||||
var keyboard = OpenTK.Input.Keyboard.GetState();
|
||||
if (keyboard[Key.Escape])
|
||||
Exit();
|
||||
}
|
||||
|
||||
|
@ -256,7 +264,7 @@ namespace Examples.Tutorial
|
|||
|
||||
// Read Pixel under mouse cursor
|
||||
Byte4 Pixel = new Byte4();
|
||||
GL.ReadPixels(Mouse.X, this.Height - Mouse.Y, 1, 1, PixelFormat.Rgba, PixelType.UnsignedByte, ref Pixel);
|
||||
GL.ReadPixels(mouse_x, this.Height - mouse_y, 1, 1, PixelFormat.Rgba, PixelType.UnsignedByte, ref Pixel);
|
||||
SelectedTriangle = Pixel.ToUInt32();
|
||||
#endregion Pass 1: Draw Object and pick Triangle
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace Examples.Tutorial
|
|||
: base(800, 600, new GraphicsMode(new ColorFormat(8, 8, 8, 8), 24, 8)) // request 8-bit stencil buffer
|
||||
{
|
||||
base.VSync = VSyncMode.Off;
|
||||
Keyboard.KeyDown += delegate(object sender, KeyboardKeyEventArgs e)
|
||||
KeyDown += delegate(object sender, KeyboardKeyEventArgs e)
|
||||
{
|
||||
switch (e.Key)
|
||||
{
|
||||
|
@ -174,11 +174,10 @@ namespace Examples.Tutorial
|
|||
|
||||
protected override void OnUpdateFrame(FrameEventArgs e)
|
||||
{
|
||||
#region Magic numbers for camera
|
||||
CameraRotX = -Mouse.X * .5f;
|
||||
CameraRotY = Mouse.Y * .5f;
|
||||
CameraZoom = Mouse.Wheel * .2f;
|
||||
#endregion Magic numbers for camera
|
||||
var mouse = OpenTK.Input.Mouse.GetState();
|
||||
CameraRotX = -mouse.X * .5f;
|
||||
CameraRotY = mouse.Y * .5f;
|
||||
CameraZoom = mouse.Wheel * .2f;
|
||||
}
|
||||
|
||||
public void DrawOperandB()
|
||||
|
|
|
@ -215,7 +215,8 @@ namespace Examples.Tutorial
|
|||
|
||||
protected override void OnUpdateFrame(FrameEventArgs e)
|
||||
{
|
||||
if (Keyboard[OpenTK.Input.Key.Escape])
|
||||
var keyboard = OpenTK.Input.Keyboard.GetState();
|
||||
if (keyboard[OpenTK.Input.Key.Escape])
|
||||
{
|
||||
this.Exit();
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace Examples.Tutorial
|
|||
|
||||
class TextureMatrix : GameWindow
|
||||
{
|
||||
Vector2 orientation;
|
||||
|
||||
public TextureMatrix()
|
||||
: base(800, 600, new GraphicsMode(32, 16, 0, 4))
|
||||
|
@ -89,8 +90,12 @@ namespace Examples.Tutorial
|
|||
|
||||
protected override void OnUpdateFrame(FrameEventArgs e)
|
||||
{
|
||||
if (Keyboard[Key.Escape])
|
||||
var keyboard = OpenTK.Input.Keyboard.GetState();
|
||||
if (keyboard[Key.Escape])
|
||||
Exit();
|
||||
|
||||
var mouse = OpenTK.Input.Mouse.GetState();
|
||||
orientation = new Vector2(mouse.X, mouse.Y);
|
||||
}
|
||||
|
||||
protected override void OnRenderFrame(FrameEventArgs e)
|
||||
|
@ -107,8 +112,8 @@ namespace Examples.Tutorial
|
|||
|
||||
GL.Translate(0f, 0f, 1.5f);
|
||||
|
||||
GL.Rotate(Mouse.X, Vector3.UnitY);
|
||||
GL.Rotate(Mouse.Y, Vector3.UnitX);
|
||||
GL.Rotate(orientation.X, Vector3.UnitY);
|
||||
GL.Rotate(orientation.Y, Vector3.UnitX);
|
||||
|
||||
GL.CallList(list);
|
||||
|
||||
|
|
|
@ -93,7 +93,8 @@ namespace Examples.Tutorial
|
|||
/// <remarks>There is no need to call the base implementation.</remarks>
|
||||
protected override void OnUpdateFrame(FrameEventArgs e)
|
||||
{
|
||||
if (Keyboard[OpenTK.Input.Key.Escape])
|
||||
var keyboard = OpenTK.Input.Keyboard.GetState();
|
||||
if (keyboard[OpenTK.Input.Key.Escape])
|
||||
this.Exit();
|
||||
}
|
||||
|
||||
|
|
|
@ -136,7 +136,8 @@ namespace Examples.Tutorial
|
|||
/// <param name="e">Contains timing information for framerate independent logic.</param>
|
||||
protected override void OnUpdateFrame(FrameEventArgs e)
|
||||
{
|
||||
if (Keyboard[Key.Escape])
|
||||
var keyboard = OpenTK.Input.Keyboard.GetState();
|
||||
if (keyboard[Key.Escape])
|
||||
{
|
||||
Exit();
|
||||
}
|
||||
|
|
|
@ -88,7 +88,8 @@ namespace Examples.Tutorial
|
|||
{
|
||||
base.OnUpdateFrame(e);
|
||||
|
||||
if (Keyboard[OpenTK.Input.Key.Escape])
|
||||
var keyboard = OpenTK.Input.Keyboard.GetState();
|
||||
if (keyboard[OpenTK.Input.Key.Escape])
|
||||
this.Exit();
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace Examples.Tutorial
|
|||
: base(800, 600)
|
||||
{
|
||||
//this.VSync = VSyncMode.On;
|
||||
this.Keyboard.KeyUp += Keyboard_KeyUp;
|
||||
KeyUp += Keyboard_KeyUp;
|
||||
}
|
||||
|
||||
void Keyboard_KeyUp(object sender, KeyboardKeyEventArgs e)
|
||||
|
@ -107,14 +107,15 @@ namespace Examples.Tutorial
|
|||
/// </remarks>
|
||||
protected override void OnUpdateFrame(FrameEventArgs e)
|
||||
{
|
||||
// Escape quits.
|
||||
if (Keyboard[Key.Escape])
|
||||
var keyboard = OpenTK.Input.Keyboard.GetState();
|
||||
|
||||
if (keyboard[Key.Escape])
|
||||
{
|
||||
this.Exit();
|
||||
return;
|
||||
}
|
||||
|
||||
if (Keyboard[Key.F11])
|
||||
if (keyboard[Key.F11])
|
||||
if (WindowState != WindowState.Fullscreen)
|
||||
WindowState = WindowState.Fullscreen;
|
||||
else
|
||||
|
@ -122,14 +123,14 @@ namespace Examples.Tutorial
|
|||
|
||||
// Plus/Minus change the target render frequency.
|
||||
// PageUp/PageDown change the target update frequency.
|
||||
if (Keyboard[Key.Plus] || Keyboard[Key.KeypadAdd]) TargetRenderFrequency++;
|
||||
if (Keyboard[Key.Minus] || Keyboard[Key.KeypadSubtract]) TargetRenderFrequency--;
|
||||
if (Keyboard[Key.PageUp]) TargetUpdateFrequency++;
|
||||
if (Keyboard[Key.PageDown]) TargetUpdateFrequency--;
|
||||
if (keyboard[Key.Plus] || keyboard[Key.KeypadAdd]) TargetRenderFrequency++;
|
||||
if (keyboard[Key.Minus] || keyboard[Key.KeypadSubtract]) TargetRenderFrequency--;
|
||||
if (keyboard[Key.PageUp]) TargetUpdateFrequency++;
|
||||
if (keyboard[Key.PageDown]) TargetUpdateFrequency--;
|
||||
|
||||
// Right/Left control the rotation speed and direction.
|
||||
if (Keyboard[Key.Right]) rotation_speed += 0.5f;
|
||||
if (Keyboard[Key.Left]) rotation_speed -= 0.5f;
|
||||
if (keyboard[Key.Right]) rotation_speed += 0.5f;
|
||||
if (keyboard[Key.Left]) rotation_speed -= 0.5f;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -100,24 +100,27 @@ namespace Examples.Tutorial
|
|||
/// </remarks>
|
||||
protected override void OnUpdateFrame(FrameEventArgs e)
|
||||
{
|
||||
if (Keyboard[OpenTK.Input.Key.Escape])
|
||||
var keyboard = OpenTK.Input.Keyboard.GetState();
|
||||
var mouse = OpenTK.Input.Mouse.GetState();
|
||||
|
||||
if (keyboard[OpenTK.Input.Key.Escape])
|
||||
{
|
||||
this.Exit();
|
||||
return;
|
||||
}
|
||||
|
||||
if (Keyboard[OpenTK.Input.Key.F11])
|
||||
if (keyboard[OpenTK.Input.Key.F11])
|
||||
if (WindowState != WindowState.Fullscreen)
|
||||
WindowState = WindowState.Fullscreen;
|
||||
else
|
||||
WindowState = WindowState.Normal;
|
||||
|
||||
if (Mouse[OpenTK.Input.MouseButton.Left])
|
||||
x_angle = Mouse.X;
|
||||
if (mouse[OpenTK.Input.MouseButton.Left])
|
||||
x_angle = mouse.X;
|
||||
else
|
||||
x_angle += 0.5f;
|
||||
|
||||
zoom = Mouse.Wheel * 0.5f; // Mouse.Wheel is broken on both Linux and Windows.
|
||||
zoom = mouse.Wheel * 0.5f; // Mouse.Wheel is broken on both Linux and Windows.
|
||||
|
||||
// Do not leave x_angle drift too far away, as this will cause inaccuracies.
|
||||
if (x_angle > 360.0f)
|
||||
|
|
|
@ -198,19 +198,21 @@ namespace Examples.Tutorial
|
|||
/// <summary>Add your game logic here.</summary>
|
||||
/// <param name="e">Contains timing information.</param>
|
||||
/// <remarks>There is no need to call the base implementation.</remarks>
|
||||
protected override void OnUpdateFrame( FrameEventArgs e )
|
||||
protected override void OnUpdateFrame(FrameEventArgs e)
|
||||
{
|
||||
base.OnUpdateFrame( e );
|
||||
base.OnUpdateFrame(e);
|
||||
|
||||
if ( Keyboard[OpenTK.Input.Key.Escape] )
|
||||
this.Exit( );
|
||||
if ( Keyboard[OpenTK.Input.Key.Space] )
|
||||
Trace.WriteLine( "GL: " + GL.GetError( ) );
|
||||
var keyboard = OpenTK.Input.Keyboard.GetState();
|
||||
var mouse = OpenTK.Input.Mouse.GetState();
|
||||
|
||||
Trackball.X = Mouse.X;
|
||||
Trackball.Y = Mouse.Y;
|
||||
Trackball.Z = Mouse.Wheel * 0.5f;
|
||||
if (keyboard[OpenTK.Input.Key.Escape])
|
||||
this.Exit();
|
||||
if (keyboard[OpenTK.Input.Key.Space])
|
||||
Trace.WriteLine("GL: " + GL.GetError());
|
||||
|
||||
Trackball.X = mouse.X;
|
||||
Trackball.Y = mouse.Y;
|
||||
Trackball.Z = mouse.Scroll.Y * 0.5f;
|
||||
}
|
||||
|
||||
/// <summary>Add your game rendering code here.</summary>
|
||||
|
|
|
@ -195,14 +195,15 @@ namespace Examples.Tutorial
|
|||
{
|
||||
base.OnUpdateFrame(e);
|
||||
|
||||
if (Keyboard[Key.Space])
|
||||
var keyboard = OpenTK.Input.Keyboard.GetState();
|
||||
if (keyboard[Key.Space])
|
||||
{
|
||||
ErrorCode err = GL.GetError();
|
||||
//Console.WriteLine(err + " " + Glu.ErrorString((GluErrorCode)err));
|
||||
Console.WriteLine("GL error code: {0}", err);
|
||||
}
|
||||
|
||||
if (Keyboard[Key.Escape])
|
||||
if (keyboard[Key.Escape])
|
||||
this.Exit();
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace Examples.Tutorial
|
|||
public SimpleGeometryShader2()
|
||||
: base(800, 600)
|
||||
{
|
||||
Keyboard.KeyDown += Keyboard_KeyDown;
|
||||
KeyDown += Keyboard_KeyDown;
|
||||
}
|
||||
|
||||
enum ViewMode
|
||||
|
@ -900,7 +900,8 @@ namespace Examples.Tutorial
|
|||
eyePos.X = (float)Math.Cos(elapsed / 3000) * 8;
|
||||
eyePos.Z = (float)Math.Sin(elapsed / 2000) * 8;
|
||||
|
||||
if (Keyboard[Key.Space])
|
||||
var keyboard = OpenTK.Input.Keyboard.GetState();
|
||||
if (keyboard[Key.Space])
|
||||
{
|
||||
ErrorCode err = GL.GetError();
|
||||
//Console.WriteLine(err + " " + Glu.ErrorString((GluErrorCode)err));
|
||||
|
|
|
@ -158,7 +158,7 @@ namespace Examples.Tutorial
|
|||
}
|
||||
#endregion Textures
|
||||
|
||||
Keyboard.KeyUp += Keyboard_KeyUp;
|
||||
KeyUp += Keyboard_KeyUp;
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
|
@ -233,7 +233,8 @@ namespace Examples.Tutorial
|
|||
{
|
||||
base.OnUpdateFrame(e);
|
||||
|
||||
if (Keyboard[OpenTK.Input.Key.Escape])
|
||||
var keyboard = OpenTK.Input.Keyboard.GetState();
|
||||
if (keyboard[OpenTK.Input.Key.Escape])
|
||||
{
|
||||
this.Exit();
|
||||
}
|
||||
|
|
|
@ -214,10 +214,11 @@ namespace Examples.Tutorial
|
|||
/// </remarks>
|
||||
protected override void OnUpdateFrame(FrameEventArgs e)
|
||||
{
|
||||
if (Keyboard[OpenTK.Input.Key.Escape])
|
||||
var keyboard = OpenTK.Input.Keyboard.GetState();
|
||||
if (keyboard[OpenTK.Input.Key.Escape])
|
||||
this.Exit();
|
||||
|
||||
if (Keyboard[OpenTK.Input.Key.F11])
|
||||
if (keyboard[OpenTK.Input.Key.F11])
|
||||
if (WindowState != WindowState.Fullscreen)
|
||||
WindowState = WindowState.Fullscreen;
|
||||
else
|
||||
|
|
|
@ -224,52 +224,62 @@ namespace Examples.Tutorial
|
|||
base.OnResize( e );
|
||||
}
|
||||
|
||||
protected override void OnKeyDown(OpenTK.Input.KeyboardKeyEventArgs e)
|
||||
{
|
||||
base.OnKeyDown(e);
|
||||
|
||||
if (e.Keyboard[OpenTK.Input.Key.Escape])
|
||||
this.Exit();
|
||||
if (e.Keyboard[OpenTK.Input.Key.Space])
|
||||
Trace.WriteLine("GL: " + GL.GetError());
|
||||
if (e.Keyboard[OpenTK.Input.Key.Q])
|
||||
{
|
||||
MaterialScaleAndBiasAndShininess.X += 0.01f;
|
||||
Trace.WriteLine("Scale: " + MaterialScaleAndBiasAndShininess.X + " Bias: " + MaterialScaleAndBiasAndShininess.Y);
|
||||
}
|
||||
if (e.Keyboard[OpenTK.Input.Key.A])
|
||||
{
|
||||
MaterialScaleAndBiasAndShininess.X -= 0.01f;
|
||||
Trace.WriteLine("Scale: " + MaterialScaleAndBiasAndShininess.X + " Bias: " + MaterialScaleAndBiasAndShininess.Y);
|
||||
}
|
||||
if (e.Keyboard[OpenTK.Input.Key.W])
|
||||
{
|
||||
MaterialScaleAndBiasAndShininess.Y += 0.01f;
|
||||
Trace.WriteLine("Scale: " + MaterialScaleAndBiasAndShininess.X + " Bias: " + MaterialScaleAndBiasAndShininess.Y);
|
||||
}
|
||||
if (e.Keyboard[OpenTK.Input.Key.S])
|
||||
{
|
||||
MaterialScaleAndBiasAndShininess.Y -= 0.01f;
|
||||
Trace.WriteLine("Scale: " + MaterialScaleAndBiasAndShininess.X + " Bias: " + MaterialScaleAndBiasAndShininess.Y);
|
||||
}
|
||||
if (e.Keyboard[OpenTK.Input.Key.E])
|
||||
{
|
||||
MaterialScaleAndBiasAndShininess.Z += 1f;
|
||||
Trace.WriteLine("Shininess: " + MaterialScaleAndBiasAndShininess.Z);
|
||||
}
|
||||
if (e.Keyboard[OpenTK.Input.Key.D])
|
||||
{
|
||||
MaterialScaleAndBiasAndShininess.Z -= 1f;
|
||||
Trace.WriteLine("Shininess: " + MaterialScaleAndBiasAndShininess.Z);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(OpenTK.Input.MouseMoveEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
|
||||
LightPosition.X = (-(this.Width / 2) + e.Mouse.X) / 100f;
|
||||
LightPosition.Y = ((this.Height / 2) - e.Mouse.Y) / 100f;
|
||||
|
||||
EyePos.Y = e.Mouse.Wheel * 0.5f;
|
||||
}
|
||||
|
||||
/// <summary>Add your game logic here.</summary>
|
||||
/// <param name="e">Contains timing information.</param>
|
||||
/// <remarks>There is no need to call the base implementation.</remarks>
|
||||
protected override void OnUpdateFrame( FrameEventArgs e )
|
||||
protected override void OnUpdateFrame( FrameEventArgs e )
|
||||
{
|
||||
base.OnUpdateFrame( e );
|
||||
|
||||
if ( Keyboard[OpenTK.Input.Key.Escape] )
|
||||
this.Exit( );
|
||||
if ( Keyboard[OpenTK.Input.Key.Space] )
|
||||
Trace.WriteLine( "GL: " + GL.GetError( ) );
|
||||
if ( Keyboard[OpenTK.Input.Key.Q] )
|
||||
{
|
||||
MaterialScaleAndBiasAndShininess.X += 0.01f;
|
||||
Trace.WriteLine( "Scale: " + MaterialScaleAndBiasAndShininess.X + " Bias: " + MaterialScaleAndBiasAndShininess.Y );
|
||||
}
|
||||
if ( Keyboard[OpenTK.Input.Key.A] )
|
||||
{
|
||||
MaterialScaleAndBiasAndShininess.X -= 0.01f;
|
||||
Trace.WriteLine( "Scale: " + MaterialScaleAndBiasAndShininess.X + " Bias: " + MaterialScaleAndBiasAndShininess.Y );
|
||||
}
|
||||
if ( Keyboard[OpenTK.Input.Key.W] )
|
||||
{
|
||||
MaterialScaleAndBiasAndShininess.Y += 0.01f;
|
||||
Trace.WriteLine( "Scale: " + MaterialScaleAndBiasAndShininess.X + " Bias: " + MaterialScaleAndBiasAndShininess.Y );
|
||||
}
|
||||
if ( Keyboard[OpenTK.Input.Key.S] )
|
||||
{
|
||||
MaterialScaleAndBiasAndShininess.Y -= 0.01f;
|
||||
Trace.WriteLine( "Scale: " + MaterialScaleAndBiasAndShininess.X + " Bias: " + MaterialScaleAndBiasAndShininess.Y );
|
||||
}
|
||||
if ( Keyboard[OpenTK.Input.Key.E] )
|
||||
{
|
||||
MaterialScaleAndBiasAndShininess.Z += 1f;
|
||||
Trace.WriteLine( "Shininess: " + MaterialScaleAndBiasAndShininess.Z );
|
||||
}
|
||||
if ( Keyboard[OpenTK.Input.Key.D] )
|
||||
{
|
||||
MaterialScaleAndBiasAndShininess.Z -= 1f;
|
||||
Trace.WriteLine( "Shininess: " + MaterialScaleAndBiasAndShininess.Z );
|
||||
}
|
||||
|
||||
LightPosition.X = ( -( this.Width / 2 ) + Mouse.X ) / 100f;
|
||||
LightPosition.Y = ( ( this.Height / 2 ) - Mouse.Y ) / 100f;
|
||||
|
||||
EyePos.Y = Mouse.Wheel * 0.5f;
|
||||
}
|
||||
|
||||
/// <summary>Add your game rendering code here.</summary>
|
||||
|
|
|
@ -202,7 +202,8 @@ void main(void)
|
|||
Matrix4.Mult(ref rotation, ref modelviewMatrix, out modelviewMatrix);
|
||||
GL.UniformMatrix4(modelviewMatrixLocation, false, ref modelviewMatrix);
|
||||
|
||||
if (Keyboard[OpenTK.Input.Key.Escape])
|
||||
var keyboard = OpenTK.Input.Keyboard.GetState();
|
||||
if (keyboard[OpenTK.Input.Key.Escape])
|
||||
Exit();
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,8 @@ namespace Examples.Tutorial
|
|||
/// </remarks>
|
||||
protected override void OnUpdateFrame(FrameEventArgs e)
|
||||
{
|
||||
if (Keyboard[OpenTK.Input.Key.Escape])
|
||||
var keyboard = OpenTK.Input.Keyboard.GetState();
|
||||
if (keyboard[OpenTK.Input.Key.Escape])
|
||||
{
|
||||
this.Exit();
|
||||
return;
|
||||
|
|
|
@ -379,9 +379,6 @@
|
|||
<Compile Include="OpenTK\Test\TestGraphicsModes.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="OpenTK\Test\InputLogger.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="OpenGL\1.x\ImmediateMode.rtf">
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="OpenGL\1.x\VBODynamic.rtf">
|
||||
|
@ -476,12 +473,6 @@
|
|||
<Compile Include="OpenTK\Test\Extensions.Designer.cs">
|
||||
<DependentUpon>Extensions.cs</DependentUpon>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="OpenTK\Test\InputLogger.resx">
|
||||
<DependentUpon>InputLogger.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="OpenTK\Test\InputLogger.Designer.cs">
|
||||
<DependentUpon>InputLogger.cs</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="..\..\OpenTK.snk">
|
||||
<Link>OpenTK.snk</Link>
|
||||
</None>
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Examples
|
|||
public FullscreenAntialias()
|
||||
: base(800, 600, new GraphicsMode(32, 0, 0, 4))
|
||||
{
|
||||
Keyboard.KeyDown += Keyboard_KeyDown;
|
||||
KeyDown += Keyboard_KeyDown;
|
||||
}
|
||||
|
||||
#region Keyboard_KeyDown
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Examples.Tutorial
|
|||
{
|
||||
public SimpleWindow() : base(800, 600)
|
||||
{
|
||||
Keyboard.KeyDown += Keyboard_KeyDown;
|
||||
KeyDown += Keyboard_KeyDown;
|
||||
}
|
||||
|
||||
#region Keyboard_KeyDown
|
||||
|
|
|
@ -43,13 +43,13 @@ namespace Examples.Tutorial
|
|||
public ThreadedRendering()
|
||||
: base(800, 600)
|
||||
{
|
||||
Keyboard.KeyDown += delegate(object sender, KeyboardKeyEventArgs e)
|
||||
KeyDown += delegate(object sender, KeyboardKeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
this.Exit();
|
||||
};
|
||||
|
||||
Keyboard.KeyUp += delegate(object sender, KeyboardKeyEventArgs e)
|
||||
KeyUp += delegate(object sender, KeyboardKeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.F11)
|
||||
if (this.WindowState == WindowState.Fullscreen)
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Examples.Tutorial
|
|||
public MouseCursorSimple()
|
||||
: base(800, 600)
|
||||
{
|
||||
Keyboard.KeyDown += Keyboard_KeyDown;
|
||||
KeyDown += Keyboard_KeyDown;
|
||||
|
||||
using (Bitmap bitmap = new Bitmap("Data/Textures/cursor.png"))
|
||||
{
|
||||
|
@ -37,8 +37,8 @@ namespace Examples.Tutorial
|
|||
Cursor = MyCursor;
|
||||
}
|
||||
|
||||
Mouse.Move += Mouse_Move;
|
||||
Mouse.ButtonDown += Mouse_ButtonDown;
|
||||
MouseMove += Mouse_Move;
|
||||
MouseDown += Mouse_ButtonDown;
|
||||
}
|
||||
|
||||
void AddLine(float x, float y)
|
||||
|
@ -71,7 +71,7 @@ namespace Examples.Tutorial
|
|||
|
||||
void Mouse_Move(object sender, MouseMoveEventArgs e)
|
||||
{
|
||||
if (Mouse[MouseButton.Left])
|
||||
if (e.Mouse[MouseButton.Left])
|
||||
{
|
||||
AddLine(e.X, e.Y);
|
||||
}
|
||||
|
|
|
@ -28,9 +28,9 @@ namespace Examples.Tests
|
|||
public BasicMouseInput()
|
||||
: base(800, 600)
|
||||
{
|
||||
Mouse.Move += (sender, e) =>
|
||||
MouseMove += (sender, e) =>
|
||||
{
|
||||
if (Mouse[MouseButton.Left])
|
||||
if (e.Mouse[MouseButton.Left])
|
||||
{
|
||||
// Scale mouse coordinates from
|
||||
// (0, 0):(Width, Height) to
|
||||
|
@ -48,7 +48,7 @@ namespace Examples.Tests
|
|||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
this.Mouse.ButtonUp += (object sender, MouseButtonEventArgs buttonEvent) => {
|
||||
MouseUp += (object sender, MouseButtonEventArgs buttonEvent) => {
|
||||
Console.WriteLine("Mouse button up: " + buttonEvent.Button + " at: " + buttonEvent.Position);
|
||||
};
|
||||
}
|
||||
|
@ -65,10 +65,12 @@ namespace Examples.Tests
|
|||
Console.WriteLine("The A key is down!");
|
||||
}
|
||||
|
||||
if (Keyboard[OpenTK.Input.Key.Escape])
|
||||
var keyboard = OpenTK.Input.Keyboard.GetState();
|
||||
|
||||
if (keyboard[OpenTK.Input.Key.Escape])
|
||||
this.Exit();
|
||||
|
||||
if (Keyboard[OpenTK.Input.Key.F11])
|
||||
if (keyboard[OpenTK.Input.Key.F11])
|
||||
if (WindowState != WindowState.Fullscreen)
|
||||
WindowState = WindowState.Fullscreen;
|
||||
else
|
||||
|
@ -95,7 +97,8 @@ namespace Examples.Tests
|
|||
|
||||
SwapBuffers();
|
||||
|
||||
if (Keyboard[Key.Space])
|
||||
var keyboard = OpenTK.Input.Keyboard.GetState();
|
||||
if (keyboard[Key.Space])
|
||||
{
|
||||
// Simulate high load (4 fps) to check
|
||||
// mouse input behavior
|
||||
|
|
|
@ -14,6 +14,8 @@ using OpenTK.Graphics;
|
|||
using OpenTK.Graphics.OpenGL;
|
||||
using OpenTK.Input;
|
||||
|
||||
#pragma warning disable 612,618 // disable obsolete warnings - we need to access these functions
|
||||
|
||||
namespace Examples.Tests
|
||||
{
|
||||
[Example("GameWindow States", ExampleCategory.OpenTK, "GameWindow", 4, Documentation = "GameWindowStates")]
|
||||
|
|
682
Source/Examples/OpenTK/Test/InputLogger.Designer.cs
generated
682
Source/Examples/OpenTK/Test/InputLogger.Designer.cs
generated
|
@ -1,682 +0,0 @@
|
|||
namespace Examples.Tests
|
||||
{
|
||||
partial class InputLogger
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.tabControl = new System.Windows.Forms.TabControl();
|
||||
this.Keyboard = new System.Windows.Forms.TabPage();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.listBox4 = new System.Windows.Forms.ListBox();
|
||||
this.listBox3 = new System.Windows.Forms.ListBox();
|
||||
this.listBox2 = new System.Windows.Forms.ListBox();
|
||||
this.listBox1 = new System.Windows.Forms.ListBox();
|
||||
this.Mouse = new System.Windows.Forms.TabPage();
|
||||
this.WindowY = new System.Windows.Forms.Label();
|
||||
this.WindowX = new System.Windows.Forms.Label();
|
||||
this.MouseYWindow = new System.Windows.Forms.TextBox();
|
||||
this.MouseXWindow = new System.Windows.Forms.TextBox();
|
||||
this.MouseWheelDelta = new System.Windows.Forms.TextBox();
|
||||
this.WheelDelta = new System.Windows.Forms.Label();
|
||||
this.MouseWheelText = new System.Windows.Forms.TextBox();
|
||||
this.MouseWheelLabel = new System.Windows.Forms.Label();
|
||||
this.MouseDeltaY = new System.Windows.Forms.Label();
|
||||
this.MouseDeltaX = new System.Windows.Forms.Label();
|
||||
this.MouseY = new System.Windows.Forms.Label();
|
||||
this.MouseX = new System.Windows.Forms.Label();
|
||||
this.MouseDYText = new System.Windows.Forms.TextBox();
|
||||
this.MouseDXText = new System.Windows.Forms.TextBox();
|
||||
this.MouseYText = new System.Windows.Forms.TextBox();
|
||||
this.MouseXText = new System.Windows.Forms.TextBox();
|
||||
this.MouseButtonsBox = new System.Windows.Forms.ListBox();
|
||||
this.ChooseMouse = new System.Windows.Forms.ComboBox();
|
||||
this.HID = new System.Windows.Forms.TabPage();
|
||||
this.PollTimer = new System.Windows.Forms.Timer(this.components);
|
||||
this.comboBoxActiveJoystick = new System.Windows.Forms.ComboBox();
|
||||
this.textBoxAxis1 = new System.Windows.Forms.TextBox();
|
||||
this.textBoxAxis2 = new System.Windows.Forms.TextBox();
|
||||
this.textBoxAxis3 = new System.Windows.Forms.TextBox();
|
||||
this.textBoxAxis4 = new System.Windows.Forms.TextBox();
|
||||
this.textBoxAxis5 = new System.Windows.Forms.TextBox();
|
||||
this.textBoxAxis6 = new System.Windows.Forms.TextBox();
|
||||
this.textBoxAxis7 = new System.Windows.Forms.TextBox();
|
||||
this.textBoxAxis8 = new System.Windows.Forms.TextBox();
|
||||
this.textBoxAxis9 = new System.Windows.Forms.TextBox();
|
||||
this.textBoxAxis10 = new System.Windows.Forms.TextBox();
|
||||
this.labelAxis1 = new System.Windows.Forms.Label();
|
||||
this.labelAxis2 = new System.Windows.Forms.Label();
|
||||
this.labelAxis3 = new System.Windows.Forms.Label();
|
||||
this.labelAxis4 = new System.Windows.Forms.Label();
|
||||
this.labelAxis5 = new System.Windows.Forms.Label();
|
||||
this.labelAxis6 = new System.Windows.Forms.Label();
|
||||
this.labelAxis7 = new System.Windows.Forms.Label();
|
||||
this.labelAxis8 = new System.Windows.Forms.Label();
|
||||
this.labelAxis9 = new System.Windows.Forms.Label();
|
||||
this.labelAxis10 = new System.Windows.Forms.Label();
|
||||
this.JoystickButtonsBox = new System.Windows.Forms.ListBox();
|
||||
this.tabControl.SuspendLayout();
|
||||
this.Keyboard.SuspendLayout();
|
||||
this.Mouse.SuspendLayout();
|
||||
this.HID.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tabControl
|
||||
//
|
||||
this.tabControl.Controls.Add(this.Keyboard);
|
||||
this.tabControl.Controls.Add(this.Mouse);
|
||||
this.tabControl.Controls.Add(this.HID);
|
||||
this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tabControl.Location = new System.Drawing.Point(0, 0);
|
||||
this.tabControl.Name = "tabControl";
|
||||
this.tabControl.SelectedIndex = 0;
|
||||
this.tabControl.Size = new System.Drawing.Size(432, 379);
|
||||
this.tabControl.TabIndex = 0;
|
||||
//
|
||||
// Keyboard
|
||||
//
|
||||
this.Keyboard.BackColor = System.Drawing.SystemColors.ControlLight;
|
||||
this.Keyboard.Controls.Add(this.label4);
|
||||
this.Keyboard.Controls.Add(this.label3);
|
||||
this.Keyboard.Controls.Add(this.label2);
|
||||
this.Keyboard.Controls.Add(this.label1);
|
||||
this.Keyboard.Controls.Add(this.listBox4);
|
||||
this.Keyboard.Controls.Add(this.listBox3);
|
||||
this.Keyboard.Controls.Add(this.listBox2);
|
||||
this.Keyboard.Controls.Add(this.listBox1);
|
||||
this.Keyboard.Location = new System.Drawing.Point(4, 22);
|
||||
this.Keyboard.Name = "Keyboard";
|
||||
this.Keyboard.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.Keyboard.Size = new System.Drawing.Size(424, 352);
|
||||
this.Keyboard.TabIndex = 0;
|
||||
this.Keyboard.Text = "Keyboard";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(207, 180);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(64, 13);
|
||||
this.label4.TabIndex = 7;
|
||||
this.label4.Text = "Keyboard 4";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(6, 180);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(64, 13);
|
||||
this.label3.TabIndex = 6;
|
||||
this.label3.Text = "Keyboard 3";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(207, 3);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(64, 13);
|
||||
this.label2.TabIndex = 5;
|
||||
this.label2.Text = "Keyboard 2";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(8, 3);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(64, 13);
|
||||
this.label1.TabIndex = 4;
|
||||
this.label1.Text = "Keyboard 1";
|
||||
//
|
||||
// listBox4
|
||||
//
|
||||
this.listBox4.FormattingEnabled = true;
|
||||
this.listBox4.Location = new System.Drawing.Point(210, 197);
|
||||
this.listBox4.Name = "listBox4";
|
||||
this.listBox4.Size = new System.Drawing.Size(206, 147);
|
||||
this.listBox4.TabIndex = 3;
|
||||
//
|
||||
// listBox3
|
||||
//
|
||||
this.listBox3.FormattingEnabled = true;
|
||||
this.listBox3.Location = new System.Drawing.Point(9, 197);
|
||||
this.listBox3.Name = "listBox3";
|
||||
this.listBox3.Size = new System.Drawing.Size(195, 147);
|
||||
this.listBox3.TabIndex = 2;
|
||||
//
|
||||
// listBox2
|
||||
//
|
||||
this.listBox2.FormattingEnabled = true;
|
||||
this.listBox2.Location = new System.Drawing.Point(210, 20);
|
||||
this.listBox2.Name = "listBox2";
|
||||
this.listBox2.Size = new System.Drawing.Size(206, 147);
|
||||
this.listBox2.TabIndex = 1;
|
||||
//
|
||||
// listBox1
|
||||
//
|
||||
this.listBox1.FormattingEnabled = true;
|
||||
this.listBox1.Location = new System.Drawing.Point(9, 20);
|
||||
this.listBox1.Name = "listBox1";
|
||||
this.listBox1.Size = new System.Drawing.Size(195, 147);
|
||||
this.listBox1.TabIndex = 0;
|
||||
//
|
||||
// Mouse
|
||||
//
|
||||
this.Mouse.BackColor = System.Drawing.SystemColors.ControlLight;
|
||||
this.Mouse.Controls.Add(this.WindowY);
|
||||
this.Mouse.Controls.Add(this.WindowX);
|
||||
this.Mouse.Controls.Add(this.MouseYWindow);
|
||||
this.Mouse.Controls.Add(this.MouseXWindow);
|
||||
this.Mouse.Controls.Add(this.MouseWheelDelta);
|
||||
this.Mouse.Controls.Add(this.WheelDelta);
|
||||
this.Mouse.Controls.Add(this.MouseWheelText);
|
||||
this.Mouse.Controls.Add(this.MouseWheelLabel);
|
||||
this.Mouse.Controls.Add(this.MouseDeltaY);
|
||||
this.Mouse.Controls.Add(this.MouseDeltaX);
|
||||
this.Mouse.Controls.Add(this.MouseY);
|
||||
this.Mouse.Controls.Add(this.MouseX);
|
||||
this.Mouse.Controls.Add(this.MouseDYText);
|
||||
this.Mouse.Controls.Add(this.MouseDXText);
|
||||
this.Mouse.Controls.Add(this.MouseYText);
|
||||
this.Mouse.Controls.Add(this.MouseXText);
|
||||
this.Mouse.Controls.Add(this.MouseButtonsBox);
|
||||
this.Mouse.Controls.Add(this.ChooseMouse);
|
||||
this.Mouse.Location = new System.Drawing.Point(4, 22);
|
||||
this.Mouse.Name = "Mouse";
|
||||
this.Mouse.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.Mouse.Size = new System.Drawing.Size(424, 353);
|
||||
this.Mouse.TabIndex = 1;
|
||||
this.Mouse.Text = "Mouse";
|
||||
//
|
||||
// WindowY
|
||||
//
|
||||
this.WindowY.AutoSize = true;
|
||||
this.WindowY.Location = new System.Drawing.Point(4, 239);
|
||||
this.WindowY.Name = "WindowY";
|
||||
this.WindowY.Size = new System.Drawing.Size(62, 13);
|
||||
this.WindowY.TabIndex = 17;
|
||||
this.WindowY.Text = "Window Y:";
|
||||
//
|
||||
// WindowX
|
||||
//
|
||||
this.WindowX.AutoSize = true;
|
||||
this.WindowX.Location = new System.Drawing.Point(4, 212);
|
||||
this.WindowX.Name = "WindowX";
|
||||
this.WindowX.Size = new System.Drawing.Size(63, 13);
|
||||
this.WindowX.TabIndex = 16;
|
||||
this.WindowX.Text = "Window X:";
|
||||
//
|
||||
// MouseYWindow
|
||||
//
|
||||
this.MouseYWindow.Location = new System.Drawing.Point(80, 232);
|
||||
this.MouseYWindow.Name = "MouseYWindow";
|
||||
this.MouseYWindow.ReadOnly = true;
|
||||
this.MouseYWindow.Size = new System.Drawing.Size(73, 22);
|
||||
this.MouseYWindow.TabIndex = 15;
|
||||
//
|
||||
// MouseXWindow
|
||||
//
|
||||
this.MouseXWindow.Location = new System.Drawing.Point(80, 205);
|
||||
this.MouseXWindow.Name = "MouseXWindow";
|
||||
this.MouseXWindow.ReadOnly = true;
|
||||
this.MouseXWindow.Size = new System.Drawing.Size(73, 22);
|
||||
this.MouseXWindow.TabIndex = 14;
|
||||
//
|
||||
// MouseWheelDelta
|
||||
//
|
||||
this.MouseWheelDelta.Location = new System.Drawing.Point(80, 178);
|
||||
this.MouseWheelDelta.Name = "MouseWheelDelta";
|
||||
this.MouseWheelDelta.ReadOnly = true;
|
||||
this.MouseWheelDelta.Size = new System.Drawing.Size(73, 22);
|
||||
this.MouseWheelDelta.TabIndex = 13;
|
||||
//
|
||||
// WheelDelta
|
||||
//
|
||||
this.WheelDelta.AutoSize = true;
|
||||
this.WheelDelta.Location = new System.Drawing.Point(4, 185);
|
||||
this.WheelDelta.Name = "WheelDelta";
|
||||
this.WheelDelta.Size = new System.Drawing.Size(73, 13);
|
||||
this.WheelDelta.TabIndex = 12;
|
||||
this.WheelDelta.Text = "Wheel Delta:";
|
||||
//
|
||||
// MouseWheelText
|
||||
//
|
||||
this.MouseWheelText.Location = new System.Drawing.Point(80, 152);
|
||||
this.MouseWheelText.Name = "MouseWheelText";
|
||||
this.MouseWheelText.ReadOnly = true;
|
||||
this.MouseWheelText.Size = new System.Drawing.Size(73, 22);
|
||||
this.MouseWheelText.TabIndex = 11;
|
||||
//
|
||||
// MouseWheelLabel
|
||||
//
|
||||
this.MouseWheelLabel.AutoSize = true;
|
||||
this.MouseWheelLabel.Location = new System.Drawing.Point(4, 159);
|
||||
this.MouseWheelLabel.Name = "MouseWheelLabel";
|
||||
this.MouseWheelLabel.Size = new System.Drawing.Size(43, 13);
|
||||
this.MouseWheelLabel.TabIndex = 10;
|
||||
this.MouseWheelLabel.Text = "Wheel:";
|
||||
//
|
||||
// MouseDeltaY
|
||||
//
|
||||
this.MouseDeltaY.AutoSize = true;
|
||||
this.MouseDeltaY.Location = new System.Drawing.Point(4, 132);
|
||||
this.MouseDeltaY.Name = "MouseDeltaY";
|
||||
this.MouseDeltaY.Size = new System.Drawing.Size(45, 13);
|
||||
this.MouseDeltaY.TabIndex = 9;
|
||||
this.MouseDeltaY.Text = "Delta Y:";
|
||||
//
|
||||
// MouseDeltaX
|
||||
//
|
||||
this.MouseDeltaX.AutoSize = true;
|
||||
this.MouseDeltaX.Location = new System.Drawing.Point(4, 105);
|
||||
this.MouseDeltaX.Name = "MouseDeltaX";
|
||||
this.MouseDeltaX.Size = new System.Drawing.Size(46, 13);
|
||||
this.MouseDeltaX.TabIndex = 8;
|
||||
this.MouseDeltaX.Text = "Delta X:";
|
||||
//
|
||||
// MouseY
|
||||
//
|
||||
this.MouseY.AutoSize = true;
|
||||
this.MouseY.Location = new System.Drawing.Point(4, 78);
|
||||
this.MouseY.Name = "MouseY";
|
||||
this.MouseY.Size = new System.Drawing.Size(60, 13);
|
||||
this.MouseY.TabIndex = 7;
|
||||
this.MouseY.Text = "Position Y:";
|
||||
//
|
||||
// MouseX
|
||||
//
|
||||
this.MouseX.AutoSize = true;
|
||||
this.MouseX.Location = new System.Drawing.Point(4, 51);
|
||||
this.MouseX.Name = "MouseX";
|
||||
this.MouseX.Size = new System.Drawing.Size(61, 13);
|
||||
this.MouseX.TabIndex = 6;
|
||||
this.MouseX.Text = "Position X:";
|
||||
//
|
||||
// MouseDYText
|
||||
//
|
||||
this.MouseDYText.Location = new System.Drawing.Point(80, 125);
|
||||
this.MouseDYText.Name = "MouseDYText";
|
||||
this.MouseDYText.ReadOnly = true;
|
||||
this.MouseDYText.Size = new System.Drawing.Size(73, 22);
|
||||
this.MouseDYText.TabIndex = 5;
|
||||
//
|
||||
// MouseDXText
|
||||
//
|
||||
this.MouseDXText.Location = new System.Drawing.Point(80, 98);
|
||||
this.MouseDXText.Name = "MouseDXText";
|
||||
this.MouseDXText.ReadOnly = true;
|
||||
this.MouseDXText.Size = new System.Drawing.Size(73, 22);
|
||||
this.MouseDXText.TabIndex = 4;
|
||||
//
|
||||
// MouseYText
|
||||
//
|
||||
this.MouseYText.Location = new System.Drawing.Point(80, 71);
|
||||
this.MouseYText.Name = "MouseYText";
|
||||
this.MouseYText.ReadOnly = true;
|
||||
this.MouseYText.Size = new System.Drawing.Size(73, 22);
|
||||
this.MouseYText.TabIndex = 3;
|
||||
//
|
||||
// MouseXText
|
||||
//
|
||||
this.MouseXText.Location = new System.Drawing.Point(80, 44);
|
||||
this.MouseXText.Name = "MouseXText";
|
||||
this.MouseXText.ReadOnly = true;
|
||||
this.MouseXText.Size = new System.Drawing.Size(73, 22);
|
||||
this.MouseXText.TabIndex = 2;
|
||||
//
|
||||
// MouseButtonsBox
|
||||
//
|
||||
this.MouseButtonsBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.MouseButtonsBox.FormattingEnabled = true;
|
||||
this.MouseButtonsBox.Location = new System.Drawing.Point(190, 44);
|
||||
this.MouseButtonsBox.Name = "MouseButtonsBox";
|
||||
this.MouseButtonsBox.Size = new System.Drawing.Size(226, 303);
|
||||
this.MouseButtonsBox.TabIndex = 1;
|
||||
//
|
||||
// ChooseMouse
|
||||
//
|
||||
this.ChooseMouse.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ChooseMouse.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.ChooseMouse.FormattingEnabled = true;
|
||||
this.ChooseMouse.Location = new System.Drawing.Point(7, 7);
|
||||
this.ChooseMouse.Name = "ChooseMouse";
|
||||
this.ChooseMouse.Size = new System.Drawing.Size(409, 21);
|
||||
this.ChooseMouse.TabIndex = 0;
|
||||
this.ChooseMouse.SelectedIndexChanged += new System.EventHandler(this.ChooseMouse_SelectedIndexChanged);
|
||||
//
|
||||
// HID
|
||||
//
|
||||
this.HID.Controls.Add(this.labelAxis10);
|
||||
this.HID.Controls.Add(this.labelAxis9);
|
||||
this.HID.Controls.Add(this.labelAxis8);
|
||||
this.HID.Controls.Add(this.labelAxis7);
|
||||
this.HID.Controls.Add(this.labelAxis6);
|
||||
this.HID.Controls.Add(this.labelAxis5);
|
||||
this.HID.Controls.Add(this.labelAxis4);
|
||||
this.HID.Controls.Add(this.labelAxis3);
|
||||
this.HID.Controls.Add(this.labelAxis2);
|
||||
this.HID.Controls.Add(this.labelAxis1);
|
||||
this.HID.Controls.Add(this.textBoxAxis10);
|
||||
this.HID.Controls.Add(this.textBoxAxis9);
|
||||
this.HID.Controls.Add(this.textBoxAxis8);
|
||||
this.HID.Controls.Add(this.textBoxAxis7);
|
||||
this.HID.Controls.Add(this.textBoxAxis6);
|
||||
this.HID.Controls.Add(this.textBoxAxis5);
|
||||
this.HID.Controls.Add(this.textBoxAxis4);
|
||||
this.HID.Controls.Add(this.textBoxAxis3);
|
||||
this.HID.Controls.Add(this.textBoxAxis2);
|
||||
this.HID.Controls.Add(this.textBoxAxis1);
|
||||
this.HID.Controls.Add(this.JoystickButtonsBox);
|
||||
this.HID.Controls.Add(this.comboBoxActiveJoystick);
|
||||
this.HID.Location = new System.Drawing.Point(4, 22);
|
||||
this.HID.Name = "HID";
|
||||
this.HID.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.HID.Size = new System.Drawing.Size(424, 353);
|
||||
this.HID.TabIndex = 2;
|
||||
this.HID.Text = "HID";
|
||||
this.HID.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// PollTimer
|
||||
//
|
||||
this.PollTimer.Interval = 10;
|
||||
//
|
||||
// comboBoxActiveJoystick
|
||||
//
|
||||
this.comboBoxActiveJoystick.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.comboBoxActiveJoystick.FormattingEnabled = true;
|
||||
this.comboBoxActiveJoystick.Location = new System.Drawing.Point(7, 7);
|
||||
this.comboBoxActiveJoystick.Name = "comboBoxActiveJoystick";
|
||||
this.comboBoxActiveJoystick.Size = new System.Drawing.Size(409, 21);
|
||||
this.comboBoxActiveJoystick.TabIndex = 0;
|
||||
//
|
||||
// textBoxAxis1
|
||||
//
|
||||
this.textBoxAxis1.Location = new System.Drawing.Point(55, 43);
|
||||
this.textBoxAxis1.Name = "textBoxAxis1";
|
||||
this.textBoxAxis1.ReadOnly = true;
|
||||
this.textBoxAxis1.Size = new System.Drawing.Size(129, 22);
|
||||
this.textBoxAxis1.TabIndex = 2;
|
||||
//
|
||||
// textBoxAxis2
|
||||
//
|
||||
this.textBoxAxis2.Location = new System.Drawing.Point(55, 72);
|
||||
this.textBoxAxis2.Name = "textBoxAxis2";
|
||||
this.textBoxAxis2.ReadOnly = true;
|
||||
this.textBoxAxis2.Size = new System.Drawing.Size(129, 22);
|
||||
this.textBoxAxis2.TabIndex = 3;
|
||||
//
|
||||
// textBoxAxis3
|
||||
//
|
||||
this.textBoxAxis3.Location = new System.Drawing.Point(55, 101);
|
||||
this.textBoxAxis3.Name = "textBoxAxis3";
|
||||
this.textBoxAxis3.ReadOnly = true;
|
||||
this.textBoxAxis3.Size = new System.Drawing.Size(129, 22);
|
||||
this.textBoxAxis3.TabIndex = 4;
|
||||
//
|
||||
// textBoxAxis4
|
||||
//
|
||||
this.textBoxAxis4.Location = new System.Drawing.Point(55, 130);
|
||||
this.textBoxAxis4.Name = "textBoxAxis4";
|
||||
this.textBoxAxis4.ReadOnly = true;
|
||||
this.textBoxAxis4.Size = new System.Drawing.Size(129, 22);
|
||||
this.textBoxAxis4.TabIndex = 5;
|
||||
//
|
||||
// textBoxAxis5
|
||||
//
|
||||
this.textBoxAxis5.Location = new System.Drawing.Point(55, 158);
|
||||
this.textBoxAxis5.Name = "textBoxAxis5";
|
||||
this.textBoxAxis5.ReadOnly = true;
|
||||
this.textBoxAxis5.Size = new System.Drawing.Size(129, 22);
|
||||
this.textBoxAxis5.TabIndex = 6;
|
||||
//
|
||||
// textBoxAxis6
|
||||
//
|
||||
this.textBoxAxis6.Location = new System.Drawing.Point(55, 186);
|
||||
this.textBoxAxis6.Name = "textBoxAxis6";
|
||||
this.textBoxAxis6.ReadOnly = true;
|
||||
this.textBoxAxis6.Size = new System.Drawing.Size(129, 22);
|
||||
this.textBoxAxis6.TabIndex = 7;
|
||||
//
|
||||
// textBoxAxis7
|
||||
//
|
||||
this.textBoxAxis7.Location = new System.Drawing.Point(55, 214);
|
||||
this.textBoxAxis7.Name = "textBoxAxis7";
|
||||
this.textBoxAxis7.ReadOnly = true;
|
||||
this.textBoxAxis7.Size = new System.Drawing.Size(129, 22);
|
||||
this.textBoxAxis7.TabIndex = 8;
|
||||
//
|
||||
// textBoxAxis8
|
||||
//
|
||||
this.textBoxAxis8.Location = new System.Drawing.Point(55, 242);
|
||||
this.textBoxAxis8.Name = "textBoxAxis8";
|
||||
this.textBoxAxis8.ReadOnly = true;
|
||||
this.textBoxAxis8.Size = new System.Drawing.Size(129, 22);
|
||||
this.textBoxAxis8.TabIndex = 9;
|
||||
//
|
||||
// textBoxAxis9
|
||||
//
|
||||
this.textBoxAxis9.Location = new System.Drawing.Point(55, 270);
|
||||
this.textBoxAxis9.Name = "textBoxAxis9";
|
||||
this.textBoxAxis9.ReadOnly = true;
|
||||
this.textBoxAxis9.Size = new System.Drawing.Size(129, 22);
|
||||
this.textBoxAxis9.TabIndex = 10;
|
||||
//
|
||||
// textBoxAxis10
|
||||
//
|
||||
this.textBoxAxis10.Location = new System.Drawing.Point(55, 298);
|
||||
this.textBoxAxis10.Name = "textBoxAxis10";
|
||||
this.textBoxAxis10.ReadOnly = true;
|
||||
this.textBoxAxis10.Size = new System.Drawing.Size(129, 22);
|
||||
this.textBoxAxis10.TabIndex = 11;
|
||||
//
|
||||
// labelAxis1
|
||||
//
|
||||
this.labelAxis1.AutoSize = true;
|
||||
this.labelAxis1.Location = new System.Drawing.Point(4, 46);
|
||||
this.labelAxis1.Name = "labelAxis1";
|
||||
this.labelAxis1.Size = new System.Drawing.Size(39, 13);
|
||||
this.labelAxis1.TabIndex = 12;
|
||||
this.labelAxis1.Text = "Axis 1:";
|
||||
//
|
||||
// labelAxis2
|
||||
//
|
||||
this.labelAxis2.AutoSize = true;
|
||||
this.labelAxis2.Location = new System.Drawing.Point(4, 75);
|
||||
this.labelAxis2.Name = "labelAxis2";
|
||||
this.labelAxis2.Size = new System.Drawing.Size(39, 13);
|
||||
this.labelAxis2.TabIndex = 13;
|
||||
this.labelAxis2.Text = "Axis 2:";
|
||||
//
|
||||
// labelAxis3
|
||||
//
|
||||
this.labelAxis3.AutoSize = true;
|
||||
this.labelAxis3.Location = new System.Drawing.Point(4, 104);
|
||||
this.labelAxis3.Name = "labelAxis3";
|
||||
this.labelAxis3.Size = new System.Drawing.Size(39, 13);
|
||||
this.labelAxis3.TabIndex = 14;
|
||||
this.labelAxis3.Text = "Axis 3:";
|
||||
//
|
||||
// labelAxis4
|
||||
//
|
||||
this.labelAxis4.AutoSize = true;
|
||||
this.labelAxis4.Location = new System.Drawing.Point(4, 133);
|
||||
this.labelAxis4.Name = "labelAxis4";
|
||||
this.labelAxis4.Size = new System.Drawing.Size(39, 13);
|
||||
this.labelAxis4.TabIndex = 15;
|
||||
this.labelAxis4.Text = "Axis 4:";
|
||||
//
|
||||
// labelAxis5
|
||||
//
|
||||
this.labelAxis5.AutoSize = true;
|
||||
this.labelAxis5.Location = new System.Drawing.Point(4, 161);
|
||||
this.labelAxis5.Name = "labelAxis5";
|
||||
this.labelAxis5.Size = new System.Drawing.Size(39, 13);
|
||||
this.labelAxis5.TabIndex = 16;
|
||||
this.labelAxis5.Text = "Axis 5:";
|
||||
//
|
||||
// labelAxis6
|
||||
//
|
||||
this.labelAxis6.AutoSize = true;
|
||||
this.labelAxis6.Location = new System.Drawing.Point(4, 189);
|
||||
this.labelAxis6.Name = "labelAxis6";
|
||||
this.labelAxis6.Size = new System.Drawing.Size(39, 13);
|
||||
this.labelAxis6.TabIndex = 17;
|
||||
this.labelAxis6.Text = "Axis 6:";
|
||||
//
|
||||
// labelAxis7
|
||||
//
|
||||
this.labelAxis7.AutoSize = true;
|
||||
this.labelAxis7.Location = new System.Drawing.Point(4, 217);
|
||||
this.labelAxis7.Name = "labelAxis7";
|
||||
this.labelAxis7.Size = new System.Drawing.Size(39, 13);
|
||||
this.labelAxis7.TabIndex = 18;
|
||||
this.labelAxis7.Text = "Axis 7:";
|
||||
//
|
||||
// labelAxis8
|
||||
//
|
||||
this.labelAxis8.AutoSize = true;
|
||||
this.labelAxis8.Location = new System.Drawing.Point(4, 245);
|
||||
this.labelAxis8.Name = "labelAxis8";
|
||||
this.labelAxis8.Size = new System.Drawing.Size(39, 13);
|
||||
this.labelAxis8.TabIndex = 18;
|
||||
this.labelAxis8.Text = "Axis 8:";
|
||||
//
|
||||
// labelAxis9
|
||||
//
|
||||
this.labelAxis9.AutoSize = true;
|
||||
this.labelAxis9.Location = new System.Drawing.Point(4, 273);
|
||||
this.labelAxis9.Name = "labelAxis9";
|
||||
this.labelAxis9.Size = new System.Drawing.Size(39, 13);
|
||||
this.labelAxis9.TabIndex = 19;
|
||||
this.labelAxis9.Text = "Axis 9:";
|
||||
//
|
||||
// labelAxis10
|
||||
//
|
||||
this.labelAxis10.AutoSize = true;
|
||||
this.labelAxis10.Location = new System.Drawing.Point(4, 301);
|
||||
this.labelAxis10.Name = "labelAxis10";
|
||||
this.labelAxis10.Size = new System.Drawing.Size(45, 13);
|
||||
this.labelAxis10.TabIndex = 20;
|
||||
this.labelAxis10.Text = "Axis 10:";
|
||||
//
|
||||
// JoystickButtonsBox
|
||||
//
|
||||
this.JoystickButtonsBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.JoystickButtonsBox.FormattingEnabled = true;
|
||||
this.JoystickButtonsBox.Location = new System.Drawing.Point(190, 43);
|
||||
this.JoystickButtonsBox.Name = "JoystickButtonsBox";
|
||||
this.JoystickButtonsBox.Size = new System.Drawing.Size(226, 303);
|
||||
this.JoystickButtonsBox.TabIndex = 1;
|
||||
//
|
||||
// InputLogger
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(432, 379);
|
||||
this.Controls.Add(this.tabControl);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "InputLogger";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "S04: Input Logger";
|
||||
this.tabControl.ResumeLayout(false);
|
||||
this.Keyboard.ResumeLayout(false);
|
||||
this.Keyboard.PerformLayout();
|
||||
this.Mouse.ResumeLayout(false);
|
||||
this.Mouse.PerformLayout();
|
||||
this.HID.ResumeLayout(false);
|
||||
this.HID.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TabControl tabControl;
|
||||
private System.Windows.Forms.TabPage Keyboard;
|
||||
private System.Windows.Forms.TabPage Mouse;
|
||||
private System.Windows.Forms.TabPage HID;
|
||||
private System.Windows.Forms.ListBox listBox4;
|
||||
private System.Windows.Forms.ListBox listBox3;
|
||||
private System.Windows.Forms.ListBox listBox2;
|
||||
private System.Windows.Forms.ListBox listBox1;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.ComboBox ChooseMouse;
|
||||
private System.Windows.Forms.ListBox MouseButtonsBox;
|
||||
private System.Windows.Forms.Label MouseDeltaY;
|
||||
private System.Windows.Forms.Label MouseDeltaX;
|
||||
private System.Windows.Forms.Label MouseY;
|
||||
private System.Windows.Forms.Label MouseX;
|
||||
private System.Windows.Forms.TextBox MouseDYText;
|
||||
private System.Windows.Forms.TextBox MouseDXText;
|
||||
private System.Windows.Forms.TextBox MouseYText;
|
||||
private System.Windows.Forms.TextBox MouseXText;
|
||||
private System.Windows.Forms.TextBox MouseWheelText;
|
||||
private System.Windows.Forms.Label MouseWheelLabel;
|
||||
private System.Windows.Forms.TextBox MouseWheelDelta;
|
||||
private System.Windows.Forms.Label WheelDelta;
|
||||
private System.Windows.Forms.Timer PollTimer;
|
||||
private System.Windows.Forms.TextBox MouseXWindow;
|
||||
private System.Windows.Forms.Label WindowY;
|
||||
private System.Windows.Forms.Label WindowX;
|
||||
private System.Windows.Forms.TextBox MouseYWindow;
|
||||
private System.Windows.Forms.ComboBox comboBoxActiveJoystick;
|
||||
private System.Windows.Forms.Label labelAxis10;
|
||||
private System.Windows.Forms.Label labelAxis9;
|
||||
private System.Windows.Forms.Label labelAxis8;
|
||||
private System.Windows.Forms.Label labelAxis7;
|
||||
private System.Windows.Forms.Label labelAxis6;
|
||||
private System.Windows.Forms.Label labelAxis5;
|
||||
private System.Windows.Forms.Label labelAxis4;
|
||||
private System.Windows.Forms.Label labelAxis3;
|
||||
private System.Windows.Forms.Label labelAxis2;
|
||||
private System.Windows.Forms.Label labelAxis1;
|
||||
private System.Windows.Forms.TextBox textBoxAxis10;
|
||||
private System.Windows.Forms.TextBox textBoxAxis9;
|
||||
private System.Windows.Forms.TextBox textBoxAxis8;
|
||||
private System.Windows.Forms.TextBox textBoxAxis7;
|
||||
private System.Windows.Forms.TextBox textBoxAxis6;
|
||||
private System.Windows.Forms.TextBox textBoxAxis5;
|
||||
private System.Windows.Forms.TextBox textBoxAxis4;
|
||||
private System.Windows.Forms.TextBox textBoxAxis3;
|
||||
private System.Windows.Forms.TextBox textBoxAxis2;
|
||||
private System.Windows.Forms.TextBox textBoxAxis1;
|
||||
private System.Windows.Forms.ListBox JoystickButtonsBox;
|
||||
|
||||
}
|
||||
}
|
|
@ -1,311 +0,0 @@
|
|||
#region --- License ---
|
||||
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
|
||||
* See license.txt for license info
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using OpenTK;
|
||||
using OpenTK.Platform;
|
||||
using OpenTK.Input;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Graphics.OpenGL;
|
||||
|
||||
namespace Examples.Tests
|
||||
{
|
||||
[Example("Input Logger", ExampleCategory.OpenTK, "Test", Documentation="InputLogger")]
|
||||
public partial class InputLogger : Form
|
||||
{
|
||||
#region Fields
|
||||
|
||||
Thread thread;
|
||||
GameWindow hidden;
|
||||
bool start;
|
||||
Dictionary<IntPtr, ListBox> keyboardListBoxes = new Dictionary<IntPtr, ListBox>(4);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public InputLogger()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GameWindow
|
||||
|
||||
void LaunchGameWindow()
|
||||
{
|
||||
hidden = new GameWindow(320, 240, GraphicsMode.Default, "OpenTK | Hidden input window");
|
||||
hidden.Load += hidden_Load;
|
||||
hidden.Unload += hidden_Unload;
|
||||
hidden.RenderFrame += hidden_RenderFrame;
|
||||
hidden.Run(60.0, 0.0);
|
||||
}
|
||||
|
||||
void hidden_RenderFrame(object sender, FrameEventArgs e)
|
||||
{
|
||||
GL.Clear(ClearBufferMask.ColorBufferBit);
|
||||
((GameWindow)sender).SwapBuffers();
|
||||
}
|
||||
|
||||
void hidden_Load(object sender, EventArgs e)
|
||||
{
|
||||
hidden.VSync = VSyncMode.On;
|
||||
start = true;
|
||||
GL.ClearColor(Color.Black);
|
||||
}
|
||||
|
||||
void hidden_Unload(object sender, EventArgs e)
|
||||
{
|
||||
this.BeginInvoke(on_hidden_unload, sender, e, this);
|
||||
}
|
||||
|
||||
delegate void CloseTrigger(GameWindow sender, EventArgs e, Form f);
|
||||
CloseTrigger on_hidden_unload = delegate(GameWindow sender, EventArgs e, Form f) { f.Close(); };
|
||||
|
||||
#endregion
|
||||
|
||||
#region Protected Members
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
|
||||
thread = new Thread(LaunchGameWindow);
|
||||
thread.Start();
|
||||
|
||||
while (!start)
|
||||
Thread.Sleep(100);
|
||||
|
||||
keyboardListBoxes.Add(hidden.Keyboard.DeviceID, listBox1);
|
||||
|
||||
// Add available mice to the mouse input logger.
|
||||
ChooseMouse.Items.Add(String.Format("Mouse {0} ({1})", 0, hidden.Mouse.Description));
|
||||
ChooseMouse.SelectedIndex = 0;
|
||||
|
||||
hidden.Mouse.Move += LogMouseMove;
|
||||
hidden.Mouse.WheelChanged += LogMouseWheelChanged;
|
||||
hidden.Mouse.ButtonDown += LogMouseButtonDown;
|
||||
hidden.Mouse.ButtonUp += LogMouseButtonUp;
|
||||
|
||||
hidden.Keyboard.KeyDown += LogKeyDown;
|
||||
hidden.Keyboard.KeyUp += LogKeyUp;
|
||||
|
||||
#region Joysticks
|
||||
|
||||
foreach (JoystickDevice joystick in hidden.Joysticks)
|
||||
{
|
||||
comboBoxActiveJoystick.Items.Add(joystick.Description);
|
||||
|
||||
joystick.Move += delegate(object sender, JoystickMoveEventArgs args)
|
||||
{
|
||||
this.BeginInvoke(ControlLogJoystickMoved, this, sender, args);
|
||||
};
|
||||
joystick.ButtonDown += delegate(object sender, JoystickButtonEventArgs args)
|
||||
{
|
||||
this.BeginInvoke(ControlLogJoystickButtonDown, this, sender, args);
|
||||
};
|
||||
joystick.ButtonUp += delegate(object sender, JoystickButtonEventArgs args)
|
||||
{
|
||||
this.BeginInvoke(ControlLogJoystickButtonUp, this, sender, args);
|
||||
};
|
||||
}
|
||||
if (comboBoxActiveJoystick.Items.Count > 0)
|
||||
comboBoxActiveJoystick.SelectedIndex = 0;
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
protected override void OnClosing(CancelEventArgs e)
|
||||
{
|
||||
base.OnClosing(e);
|
||||
|
||||
hidden.Exit();
|
||||
|
||||
while (hidden.Exists)
|
||||
Thread.Sleep(100);
|
||||
|
||||
e.Cancel = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Members
|
||||
|
||||
private void ChooseMouse_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
MouseButtonsBox.Items.Clear();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logging Delegates
|
||||
|
||||
#region Mice
|
||||
|
||||
delegate void ControlLogMouseKey(GameWindow input_window, InputLogger control, object sender, MouseButtonEventArgs e);
|
||||
ControlLogMouseKey ControlLogMouseKeyDown =
|
||||
delegate(GameWindow input_window, InputLogger control, object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if ((sender as MouseDevice).DeviceID == input_window.Mouse.DeviceID)
|
||||
{
|
||||
control.MouseButtonsBox.Items.Add(e.Button);
|
||||
System.Diagnostics.Debug.Print("Button down: {0}", e.Button);
|
||||
}
|
||||
};
|
||||
ControlLogMouseKey ControlLogMouseKeyUp =
|
||||
delegate(GameWindow input_window, InputLogger control, object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if ((sender as MouseDevice).DeviceID == input_window.Mouse.DeviceID)
|
||||
{
|
||||
control.MouseButtonsBox.Items.Remove(e.Button);
|
||||
System.Diagnostics.Debug.Print("Button up: {0}", e.Button);
|
||||
}
|
||||
};
|
||||
|
||||
delegate void ControlLogMouseMove(GameWindow input_window, InputLogger control, object sender, MouseMoveEventArgs e);
|
||||
ControlLogMouseMove ControlLogMouseMoveChanges =
|
||||
delegate(GameWindow input_window, InputLogger control, object sender, MouseMoveEventArgs e)
|
||||
{
|
||||
control.MouseXText.Text = e.X.ToString();
|
||||
control.MouseYText.Text = e.Y.ToString();
|
||||
};
|
||||
|
||||
delegate void ControlLogMouseWheel(GameWindow input_window, InputLogger control, object sender, MouseWheelEventArgs e);
|
||||
ControlLogMouseWheel ControlLogMouseWheelChanges =
|
||||
delegate(GameWindow input_window, InputLogger control, object sender, MouseWheelEventArgs e)
|
||||
{
|
||||
control.MouseWheelText.Text = e.ValuePrecise.ToString("F2");
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboards
|
||||
|
||||
delegate void ControlLogKeyboard(GameWindow input_window, InputLogger control, OpenTK.Input.KeyboardDevice sender, KeyboardKeyEventArgs e);
|
||||
ControlLogKeyboard ControlLogKeyboardDown =
|
||||
delegate(GameWindow input_window, InputLogger control, KeyboardDevice sender, KeyboardKeyEventArgs e)
|
||||
{
|
||||
control.keyboardListBoxes[sender.DeviceID].Items.Add(e.Key);
|
||||
};
|
||||
ControlLogKeyboard ControlLogKeyboardUp =
|
||||
delegate(GameWindow input_window, InputLogger control, KeyboardDevice sender, KeyboardKeyEventArgs e)
|
||||
{
|
||||
control.keyboardListBoxes[sender.DeviceID].Items.Remove(e.Key);
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Joysticks
|
||||
|
||||
delegate void ControlLogJoystickMove(InputLogger control, object sender, JoystickMoveEventArgs e);
|
||||
ControlLogJoystickMove ControlLogJoystickMoved =
|
||||
delegate(InputLogger control, object sender, JoystickMoveEventArgs e)
|
||||
{
|
||||
// Yes, there are things such as arrays. Tell that to the visual studio designer!
|
||||
switch (e.Axis)
|
||||
{
|
||||
case JoystickAxis.Axis0: control.textBoxAxis1.Text = e.Value.ToString(); break;
|
||||
case JoystickAxis.Axis1: control.textBoxAxis2.Text = e.Value.ToString(); break;
|
||||
case JoystickAxis.Axis2: control.textBoxAxis3.Text = e.Value.ToString(); break;
|
||||
case JoystickAxis.Axis3: control.textBoxAxis4.Text = e.Value.ToString(); break;
|
||||
case JoystickAxis.Axis4: control.textBoxAxis5.Text = e.Value.ToString(); break;
|
||||
case JoystickAxis.Axis5: control.textBoxAxis6.Text = e.Value.ToString(); break;
|
||||
case JoystickAxis.Axis6: control.textBoxAxis7.Text = e.Value.ToString(); break;
|
||||
case JoystickAxis.Axis7: control.textBoxAxis8.Text = e.Value.ToString(); break;
|
||||
case JoystickAxis.Axis8: control.textBoxAxis9.Text = e.Value.ToString(); break;
|
||||
case JoystickAxis.Axis9: control.textBoxAxis10.Text = e.Value.ToString(); break;
|
||||
}
|
||||
};
|
||||
|
||||
delegate void ControlLogJoystickButton(InputLogger control, object sender, JoystickButtonEventArgs e);
|
||||
ControlLogJoystickButton ControlLogJoystickButtonDown =
|
||||
delegate(InputLogger control, object sender, JoystickButtonEventArgs e)
|
||||
{
|
||||
if ((sender as JoystickDevice).Description == control.comboBoxActiveJoystick.Text)
|
||||
{
|
||||
control.JoystickButtonsBox.Items.Add(e.Button);
|
||||
System.Diagnostics.Debug.Print("Joystick button down: {0}", e.Button);
|
||||
}
|
||||
};
|
||||
ControlLogJoystickButton ControlLogJoystickButtonUp =
|
||||
delegate(InputLogger control, object sender, JoystickButtonEventArgs e)
|
||||
{
|
||||
if ((sender as JoystickDevice).Description == control.comboBoxActiveJoystick.Text)
|
||||
{
|
||||
control.JoystickButtonsBox.Items.Remove(e.Button);
|
||||
System.Diagnostics.Debug.Print("Joystick button down: {0}", e.Button);
|
||||
}
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Input Event Handlers
|
||||
|
||||
void LogMouseMove(object sender, MouseMoveEventArgs e)
|
||||
{
|
||||
this.BeginInvoke(ControlLogMouseMoveChanges, hidden, this, sender, e);
|
||||
}
|
||||
|
||||
void LogMouseWheelChanged(object sender, MouseWheelEventArgs e)
|
||||
{
|
||||
this.BeginInvoke(ControlLogMouseWheelChanges, hidden, this, sender, e);
|
||||
}
|
||||
|
||||
void LogMouseButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
this.BeginInvoke(ControlLogMouseKeyDown, hidden, this, sender, e);
|
||||
}
|
||||
|
||||
void LogMouseButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
this.BeginInvoke(ControlLogMouseKeyUp, hidden, this, sender, e);
|
||||
}
|
||||
|
||||
void LogKeyDown(object sender, KeyboardKeyEventArgs key)
|
||||
{
|
||||
this.BeginInvoke(ControlLogKeyboardDown, hidden, this, sender, key);
|
||||
}
|
||||
|
||||
void LogKeyUp(object sender, KeyboardKeyEventArgs key)
|
||||
{
|
||||
this.BeginInvoke(ControlLogKeyboardUp, hidden, this, sender, key);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public static void Main()
|
||||
|
||||
/// <summary>
|
||||
/// Entry point of this example.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
public static void Main()
|
||||
{
|
||||
using (InputLogger example = new InputLogger())
|
||||
{
|
||||
// Get the title and category of this example using reflection.
|
||||
ExampleAttribute info = ((ExampleAttribute)example.GetType().GetCustomAttributes(false)[0]);
|
||||
example.Text = String.Format("OpenTK | {0} {1}: {2}", info.Category, info.Difficulty, info.Title);
|
||||
example.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,123 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="PollTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -39,7 +39,7 @@ namespace Examples.Tests
|
|||
using (Tutorial.T03_Immediate_Mode_Cube game = new Examples.Tutorial.T03_Immediate_Mode_Cube())
|
||||
{
|
||||
Utilities.SetWindowTitle(game);
|
||||
game.Keyboard.KeyUp += delegate(object sender, OpenTK.Input.KeyboardKeyEventArgs e)
|
||||
game.KeyUp += delegate(object sender, OpenTK.Input.KeyboardKeyEventArgs e)
|
||||
{
|
||||
if (e.Key == OpenTK.Input.Key.F11)
|
||||
{
|
||||
|
|
|
@ -207,7 +207,8 @@ void main(void)
|
|||
Matrix4.Mult(ref rotation, ref modelviewMatrix, out modelviewMatrix);
|
||||
GL.UniformMatrix4(modelviewMatrixLocation, false, ref modelviewMatrix);
|
||||
|
||||
if (Keyboard[OpenTK.Input.Key.Escape])
|
||||
var keyboard = OpenTK.Input.Keyboard.GetState();
|
||||
if (keyboard[OpenTK.Input.Key.Escape])
|
||||
Exit();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue