Major updates to keyboard input. The infrastructure (drivers etc) is ready. Windows raw input works (now implementing multiple devices). The examples need updating for the new input methods.
Updated the ExampleLauncher to not process exceptions. Updated the IExample interface to contain the Launch method. Updated examples and the ExampleLauncher according to the IExample interface. Synced with gl3 branch.
This commit is contained in:
parent
a3bfafc04a
commit
2f64fb372e
32 changed files with 1030 additions and 268 deletions
|
@ -100,7 +100,7 @@ namespace Bind.GL2
|
|||
|
||||
// complete_enum contains all opengl enumerants.
|
||||
Bind.Structures.Enum complete_enum = new Bind.Structures.Enum();
|
||||
complete_enum.Name = "GLenum";
|
||||
complete_enum.Name = Settings.CompleteEnumName;
|
||||
|
||||
Trace.WriteLine(String.Format("Reading opengl enumerant specs"));
|
||||
Trace.Indent();
|
||||
|
|
|
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
|||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("0.9.7.1")]
|
||||
[assembly: AssemblyFileVersion("0.9.7.1")]
|
||||
[assembly: AssemblyVersion("0.9.7.2")]
|
||||
[assembly: AssemblyFileVersion("0.9.7.2")]
|
||||
|
|
|
@ -29,6 +29,11 @@ namespace Bind
|
|||
public static string GluClass = "Glu";
|
||||
public static Legacy Compatibility = Legacy.None;
|
||||
|
||||
/// <summary>
|
||||
/// The name of the C# enum which holds every single OpenGL enum (for compatibility purposes).
|
||||
/// </summary>
|
||||
public static string CompleteEnumName = "All";
|
||||
|
||||
public enum Legacy
|
||||
{
|
||||
None,
|
||||
|
|
|
@ -810,7 +810,10 @@ namespace Bind.Structures
|
|||
if (ReturnType.CurrentType.Contains("GLenum"))
|
||||
{
|
||||
if (Settings.Compatibility == Settings.Legacy.None)
|
||||
ReturnType.CurrentType = ReturnType.CurrentType.Insert(0, Settings.GLEnumsClass + ".");
|
||||
ReturnType.CurrentType =
|
||||
String.Format("{0}.{1}",
|
||||
Settings.GLEnumsClass,
|
||||
Settings.CompleteEnumName);
|
||||
else
|
||||
ReturnType.CurrentType = "int";
|
||||
}
|
||||
|
|
|
@ -245,7 +245,7 @@ namespace Bind.Structures
|
|||
}
|
||||
else
|
||||
{
|
||||
p.CurrentType = String.Format("{0}.GLenum", Settings.GLEnumsClass);
|
||||
p.CurrentType = String.Format("{0}.{1}", Settings.GLEnumsClass, Settings.CompleteEnumName);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -9,6 +9,9 @@ using System.Reflection;
|
|||
using System.Threading;
|
||||
using OpenTK;
|
||||
using System.Diagnostics;
|
||||
using System.Security;
|
||||
using System.Security.Permissions;
|
||||
using System.Security.Policy;
|
||||
|
||||
namespace Examples
|
||||
{
|
||||
|
@ -83,31 +86,27 @@ namespace Examples
|
|||
|
||||
void Launch(object example)
|
||||
{
|
||||
Type ex = example as Type;
|
||||
(ex.GetConstructor(Type.EmptyTypes).Invoke(null) as IExample).Launch();
|
||||
//(example as Type).InvokeMember("Launch", BindingFlags.InvokeMethod, null, example, null);
|
||||
/*
|
||||
AppDomain app = AppDomain.CreateDomain((example as Type).Name);
|
||||
|
||||
Type exType = example as Type;
|
||||
try
|
||||
{
|
||||
(example as Type).InvokeMember("Launch", BindingFlags.InvokeMethod, null, null, null);
|
||||
IExample ex = app.CreateInstanceAndUnwrap(
|
||||
exType.Assembly.GetName().Name,
|
||||
"Examples.Tests.Shim") as IExample;
|
||||
ex.Launch();
|
||||
//ex.InvokeMember("Launch", BindingFlags.InvokeMethod, null, null, null);
|
||||
//
|
||||
}
|
||||
catch (Exception expt)
|
||||
finally
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(
|
||||
String.Format(
|
||||
"Exception: {3}{0}Stacktrace:{0}{1}{0}{0}Inner exception:{0}{2}",
|
||||
System.Environment.NewLine,
|
||||
expt.StackTrace,
|
||||
expt.InnerException,
|
||||
expt.Message
|
||||
)
|
||||
);
|
||||
MessageBox.Show(
|
||||
String.Format(
|
||||
"Stacktrace:{0}{1}{0}{0}Inner exception:{0}{2}",
|
||||
System.Environment.NewLine,
|
||||
expt.StackTrace,
|
||||
expt.InnerException
|
||||
),
|
||||
expt.Message
|
||||
);
|
||||
AppDomain.Unload(app);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public void ExampleLauncher_Load(object sender, EventArgs e)
|
||||
|
|
|
@ -10,5 +10,6 @@ namespace Examples
|
|||
/// </summary>
|
||||
interface IExample
|
||||
{
|
||||
void Launch();
|
||||
}
|
||||
}
|
||||
|
|
33
Source/Examples/Properties/AssemblyInfo.cs
Normal file
33
Source/Examples/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("OpenTK Examples")]
|
||||
[assembly: AssemblyDescription("Examples showcasing OpenTK and OpenGL")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("OpenTK")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2006-2007 Stefanos Apostolopoulos")]
|
||||
[assembly: AssemblyTrademark("OpenTK")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("f236c767-678f-4c20-9282-d051a3c39657")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("0.3.9.0")]
|
||||
[assembly: AssemblyFileVersion("0.3.9.0")]
|
228
Source/Examples/T10_GLSL_Cube.cs
Normal file
228
Source/Examples/T10_GLSL_Cube.cs
Normal file
|
@ -0,0 +1,228 @@
|
|||
#region --- License ---
|
||||
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
|
||||
* See license.txt for license info
|
||||
*/
|
||||
#endregion
|
||||
|
||||
#region --- Using Directives ---
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Threading;
|
||||
|
||||
using OpenTK.OpenGL;
|
||||
using Enums = OpenTK.OpenGL.GL.Enums;
|
||||
using OpenTK;
|
||||
using OpenTK.Input;
|
||||
|
||||
#endregion --- Using Directives ---
|
||||
|
||||
namespace Examples.Tutorial
|
||||
{
|
||||
public class T10_GLSL_Cube : GameWindow, IExample
|
||||
{
|
||||
#region --- Fields ---
|
||||
|
||||
#region Shaders
|
||||
|
||||
string[] vertex_shader_source =
|
||||
{
|
||||
"void main() {",
|
||||
"gl_FrontColor = gl_Color;",
|
||||
"gl_Position = ftransform();",
|
||||
"}",
|
||||
};
|
||||
|
||||
string[] fragment_shader_source =
|
||||
{
|
||||
"void main() { gl_FragColor = gl_Color; }\0"
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
static float angle;
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- Constructors ---
|
||||
|
||||
public T10_GLSL_Cube()
|
||||
{
|
||||
Context.MakeCurrent();
|
||||
|
||||
//Text =
|
||||
// GL.GetString(Enums.StringName.VENDOR) + " " +
|
||||
// GL.GetString(Enums.StringName.RENDERER) + " " +
|
||||
// GL.GetString(Enums.StringName.VERSION);
|
||||
|
||||
GL.ClearColor(0.1f, 0.1f, 0.5f, 0.0f);
|
||||
GL.Enable(Enums.EnableCap.DEPTH_TEST);
|
||||
|
||||
int vertex_shader_object, fragment_shader_object;
|
||||
int status;
|
||||
int shader_program;
|
||||
|
||||
vertex_shader_object = GL.CreateShader(Enums.VERSION_2_0.VERTEX_SHADER);
|
||||
fragment_shader_object = GL.CreateShader(Enums.VERSION_2_0.FRAGMENT_SHADER);
|
||||
|
||||
GL.ShaderSource(vertex_shader_object, vertex_shader_source.Length, vertex_shader_source, (int[])null);
|
||||
GL.CompileShader(vertex_shader_object);
|
||||
GL.GetShader(vertex_shader_object, Enums.VERSION_2_0.COMPILE_STATUS, out status);
|
||||
if (status != (int)Enums.Boolean.TRUE)
|
||||
{
|
||||
StringBuilder info = new StringBuilder(1024);
|
||||
GL.GetShaderInfoLog(vertex_shader_object, info.MaxCapacity, (int[])null, info);
|
||||
|
||||
throw new Exception(info.ToString());
|
||||
}
|
||||
|
||||
GL.ShaderSource(fragment_shader_object, fragment_shader_source.Length, fragment_shader_source, (int[])null);
|
||||
GL.CompileShader(fragment_shader_object);
|
||||
GL.GetShader(fragment_shader_object, Enums.VERSION_2_0.COMPILE_STATUS, out status);
|
||||
if (status != (int)Enums.Boolean.TRUE)
|
||||
{
|
||||
StringBuilder info = new StringBuilder(1024);
|
||||
GL.GetShaderInfoLog(fragment_shader_object, 1024, (int[])null, info);
|
||||
|
||||
throw new Exception(info.ToString());
|
||||
}
|
||||
|
||||
shader_program = GL.CreateProgram();
|
||||
GL.AttachShader(shader_program, fragment_shader_object);
|
||||
GL.AttachShader(shader_program, vertex_shader_object);
|
||||
|
||||
GL.LinkProgram(shader_program);
|
||||
GL.UseProgram(shader_program);
|
||||
|
||||
OnResize(new OpenTK.Platform.ResizeEventArgs(this.Width, this.Height));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region static public void Launch()
|
||||
|
||||
/// <summary>
|
||||
/// Launches this example.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Provides a simple way for the example launcher to launch the examples.
|
||||
/// </remarks>
|
||||
static public void Launch()
|
||||
{
|
||||
using (T10_GLSL_Cube ex = new T10_GLSL_Cube())
|
||||
{
|
||||
ex.Run();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnResize
|
||||
|
||||
protected override void OnResize(OpenTK.Platform.ResizeEventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
|
||||
GL.Viewport(0, 0, this.Width, this.Height);
|
||||
|
||||
double ratio = 0.0;
|
||||
ratio = this.Width / (double)this.Height;
|
||||
|
||||
GL.MatrixMode(Enums.MatrixMode.PROJECTION);
|
||||
GL.LoadIdentity();
|
||||
Glu.Perspective(45.0, ratio, 1.0, 64.0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UpdateFrame
|
||||
|
||||
public override void UpdateFrame()
|
||||
{
|
||||
base.UpdateFrame();
|
||||
|
||||
if (Key[OpenTK.Input.Keys.Escape])
|
||||
{
|
||||
this.Quit = true;
|
||||
}
|
||||
|
||||
GL.MatrixMode(Enums.MatrixMode.MODELVIEW);
|
||||
GL.LoadIdentity();
|
||||
Glu.LookAt(
|
||||
0.0, 5.0, 5.0,
|
||||
0.0, 0.0, 0.0,
|
||||
0.0, 1.0, 0.0
|
||||
);
|
||||
GL.Rotatef(angle, 0.0f, 1.0f, 0.0f);
|
||||
angle += 0.05f;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RenderFrame
|
||||
|
||||
public override void RenderFrame()
|
||||
{
|
||||
base.RenderFrame();
|
||||
|
||||
GL.Clear(Enums.ClearBufferMask.COLOR_BUFFER_BIT | Enums.ClearBufferMask.DEPTH_BUFFER_BIT);
|
||||
|
||||
DrawCube();
|
||||
|
||||
Context.SwapBuffers();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DrawCube
|
||||
|
||||
public void DrawCube()
|
||||
{
|
||||
GL.Begin(Enums.BeginMode.QUADS);
|
||||
|
||||
GL.Color3(1, 0, 0);
|
||||
GL.Vertex3(-1.0f, -1.0f, -1.0f);
|
||||
GL.Vertex3(-1.0f, 1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, -1.0f, -1.0f);
|
||||
|
||||
GL.Color3(1, 1, 0);
|
||||
GL.Vertex3(-1.0f, -1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, -1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, -1.0f, 1.0f);
|
||||
GL.Vertex3(-1.0f, -1.0f, 1.0f);
|
||||
|
||||
GL.Color3(1, 0, 1);
|
||||
GL.Vertex3(-1.0f, -1.0f, -1.0f);
|
||||
GL.Vertex3(-1.0f, -1.0f, 1.0f);
|
||||
GL.Vertex3(-1.0f, 1.0f, 1.0f);
|
||||
GL.Vertex3(-1.0f, 1.0f, -1.0f);
|
||||
|
||||
GL.Color3(0, 1, 0);
|
||||
GL.Vertex3(-1.0f, -1.0f, 1.0f);
|
||||
GL.Vertex3(1.0f, -1.0f, 1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, 1.0f);
|
||||
GL.Vertex3(-1.0f, 1.0f, 1.0f);
|
||||
|
||||
GL.Color3(0, 0, 1);
|
||||
GL.Vertex3(-1.0f, 1.0f, -1.0f);
|
||||
GL.Vertex3(-1.0f, 1.0f, 1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, 1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, -1.0f);
|
||||
|
||||
GL.Color3(0, 1, 1);
|
||||
GL.Vertex3(1.0f, -1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, 1.0f);
|
||||
GL.Vertex3(1.0f, -1.0f, 1.0f);
|
||||
|
||||
GL.End();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
78
Source/Examples/Tests/S02_RawInput_Logger.cs
Normal file
78
Source/Examples/Tests/S02_RawInput_Logger.cs
Normal file
|
@ -0,0 +1,78 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using OpenTK;
|
||||
using OpenTK.OpenGL;
|
||||
using System.Threading;
|
||||
using System.Runtime.Serialization;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Examples.Tests
|
||||
{
|
||||
public class S02_RawInput_Logger : GameWindow, IExample
|
||||
{
|
||||
#region IExample Members
|
||||
|
||||
public void Launch()
|
||||
{
|
||||
using (StreamWriter sw = new StreamWriter(Path.Combine(System.Environment.CurrentDirectory, "keymap.log")))
|
||||
{
|
||||
//Debug.Listeners.Clear();
|
||||
Debug.Listeners.Add(new TextWriterTraceListener(sw));
|
||||
Debug.AutoFlush = true;
|
||||
Debug.WriteLine("Starting key dump");
|
||||
|
||||
//using (S02_RawInput_Logger ex = new S02_RawInput_Logger())
|
||||
{
|
||||
try
|
||||
{
|
||||
//ex.Run();
|
||||
Run();
|
||||
}
|
||||
catch (Exception expt)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(
|
||||
String.Format(
|
||||
"Exception: {3}{0}Stacktrace:{0}{1}{0}{0}{2}",
|
||||
System.Environment.NewLine,
|
||||
expt.TargetSite,
|
||||
expt.StackTrace,
|
||||
expt.Message
|
||||
)
|
||||
);
|
||||
/*MessageBox.Show(
|
||||
String.Format(
|
||||
"Stacktrace:{0}{1}{0}{0}{2}",
|
||||
System.Environment.NewLine,
|
||||
expt.TargetSite,
|
||||
expt.StackTrace
|
||||
),
|
||||
expt.Message
|
||||
);*/
|
||||
throw;
|
||||
}
|
||||
}
|
||||
Debug.Flush();
|
||||
Debug.Close();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public S02_RawInput_Logger()
|
||||
{
|
||||
GL.ClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
public override void RenderFrame()
|
||||
{
|
||||
base.RenderFrame();
|
||||
|
||||
GL.Clear(GL.Enums.ClearBufferMask.COLOR_BUFFER_BIT);
|
||||
Context.SwapBuffers();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,7 +14,6 @@ using OpenTK;
|
|||
using OpenTK.OpenGL;
|
||||
using OpenTK.Platform;
|
||||
using Enums = OpenTK.OpenGL.GL.Enums;
|
||||
using OpenTK.Input;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -122,46 +121,43 @@ namespace Examples.Tutorial
|
|||
|
||||
#endregion
|
||||
|
||||
#region DrawCube function
|
||||
#region private void DrawCube()
|
||||
|
||||
/// <summary>
|
||||
/// Draws simple, colored cube.
|
||||
/// </summary>
|
||||
protected void DrawCube()
|
||||
private void DrawCube()
|
||||
{
|
||||
GL.Begin(Enums.BeginMode.QUADS);
|
||||
GL.Begin(GL.Enums.BeginMode.QUADS);
|
||||
|
||||
GL.Color3(1, 0, 0);
|
||||
GL.Color3(1.0f, 0.0f, 0.0f);
|
||||
GL.Vertex3(-1.0f, -1.0f, -1.0f);
|
||||
GL.Vertex3(-1.0f, 1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, -1.0f, -1.0f);
|
||||
|
||||
GL.Color3(1, 1, 0);
|
||||
GL.Color3(1.0f, 1.0f, 0.0f);
|
||||
GL.Vertex3(-1.0f, -1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, -1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, -1.0f, 1.0f);
|
||||
GL.Vertex3(-1.0f, -1.0f, 1.0f);
|
||||
|
||||
GL.Color3(1, 0, 1);
|
||||
GL.Color3(1.0f, 0.0f, 1.0f);
|
||||
GL.Vertex3(-1.0f, -1.0f, -1.0f);
|
||||
GL.Vertex3(-1.0f, -1.0f, 1.0f);
|
||||
GL.Vertex3(-1.0f, 1.0f, 1.0f);
|
||||
GL.Vertex3(-1.0f, 1.0f, -1.0f);
|
||||
|
||||
GL.Color3(0, 1, 0);
|
||||
GL.Color3(0.0f, 1.0f, 0.0f);
|
||||
GL.Vertex3(-1.0f, -1.0f, 1.0f);
|
||||
GL.Vertex3(1.0f, -1.0f, 1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, 1.0f);
|
||||
GL.Vertex3(-1.0f, 1.0f, 1.0f);
|
||||
|
||||
GL.Color3(0, 0, 1);
|
||||
GL.Color3(0.0f, 0.0f, 1.0f);
|
||||
GL.Vertex3(-1.0f, 1.0f, -1.0f);
|
||||
GL.Vertex3(-1.0f, 1.0f, 1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, 1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, -1.0f);
|
||||
|
||||
GL.Color3(0, 1, 1);
|
||||
GL.Color3(0.0f, 1.0f, 1.0f);
|
||||
GL.Vertex3(1.0f, -1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, 1.0f);
|
||||
|
@ -172,7 +168,7 @@ namespace Examples.Tutorial
|
|||
|
||||
#endregion
|
||||
|
||||
#region static public void Launch()
|
||||
#region public void Launch()
|
||||
|
||||
/// <summary>
|
||||
/// Launches this example.
|
||||
|
@ -180,11 +176,12 @@ namespace Examples.Tutorial
|
|||
/// <remarks>
|
||||
/// Provides a simple way for the example launcher to launch the examples.
|
||||
/// </remarks>
|
||||
static public void Launch()
|
||||
public void Launch()
|
||||
{
|
||||
using (T03_RotatingCube ex = new T03_RotatingCube())
|
||||
//using (T03_RotatingCube ex = new T03_RotatingCube())
|
||||
{
|
||||
ex.Run();
|
||||
//ex.Run();
|
||||
Run();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ using System.Windows.Forms;
|
|||
using OpenTK.OpenGL;
|
||||
using Enums = OpenTK.OpenGL.GL.Enums;
|
||||
using OpenTK;
|
||||
using OpenTK.Input;
|
||||
|
||||
#endregion --- Using Directives ---
|
||||
|
||||
|
@ -80,7 +79,7 @@ namespace Examples.Tutorial
|
|||
|
||||
#endregion
|
||||
|
||||
#region static public void Launch()
|
||||
#region public void Launch()
|
||||
|
||||
/// <summary>
|
||||
/// Launches this example.
|
||||
|
@ -88,11 +87,12 @@ namespace Examples.Tutorial
|
|||
/// <remarks>
|
||||
/// Provides a simple way for the example launcher to launch the examples.
|
||||
/// </remarks>
|
||||
static public void Launch()
|
||||
public void Launch()
|
||||
{
|
||||
using (T03_RotatingCube ex = new T03_RotatingCube())
|
||||
//using (T03_RotatingCube ex = new T03_RotatingCube())
|
||||
{
|
||||
ex.Run();
|
||||
//ex.Run();
|
||||
Run();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ using System.Text;
|
|||
|
||||
using OpenTK;
|
||||
using OpenTK.OpenGL;
|
||||
using OpenTK.Input;
|
||||
using OpenTK.Platform;
|
||||
|
||||
#endregion
|
||||
|
@ -107,7 +106,7 @@ namespace Examples.Tutorial
|
|||
GL.DrawElements(
|
||||
GL.Enums.BeginMode.QUADS,
|
||||
idata.Length,
|
||||
GL.Enums.GLenum.UNSIGNED_SHORT,
|
||||
GL.Enums.All.UNSIGNED_SHORT,
|
||||
idata);
|
||||
|
||||
GL.BindBuffer(GL.Enums.VERSION_1_5.ARRAY_BUFFER, 0);
|
||||
|
@ -212,7 +211,7 @@ namespace Examples.Tutorial
|
|||
|
||||
#endregion
|
||||
|
||||
#region static public void Launch()
|
||||
#region public void Launch()
|
||||
|
||||
/// <summary>
|
||||
/// Launches this example.
|
||||
|
@ -220,11 +219,12 @@ namespace Examples.Tutorial
|
|||
/// <remarks>
|
||||
/// Provides a simple way for the example launcher to launch the examples.
|
||||
/// </remarks>
|
||||
static public void Launch()
|
||||
public void Launch()
|
||||
{
|
||||
using (T08_VBO ex = new T08_VBO())
|
||||
//using (T08_VBO ex = new T08_VBO())
|
||||
{
|
||||
ex.Run();
|
||||
//ex.Run();
|
||||
Run();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,9 +15,7 @@ using System.Windows.Forms;
|
|||
using System.Threading;
|
||||
|
||||
using OpenTK.OpenGL;
|
||||
using Enums = OpenTK.OpenGL.GL.Enums;
|
||||
using OpenTK;
|
||||
using OpenTK.Input;
|
||||
|
||||
#endregion --- Using Directives ---
|
||||
|
||||
|
@ -60,19 +58,19 @@ namespace Examples.Tutorial
|
|||
// GL.GetString(Enums.StringName.VERSION);
|
||||
|
||||
GL.ClearColor(0.1f, 0.1f, 0.5f, 0.0f);
|
||||
GL.Enable(Enums.EnableCap.DEPTH_TEST);
|
||||
GL.Enable(GL.Enums.EnableCap.DEPTH_TEST);
|
||||
|
||||
int vertex_shader_object, fragment_shader_object;
|
||||
uint vertex_shader_object, fragment_shader_object;
|
||||
int status;
|
||||
int shader_program;
|
||||
uint shader_program;
|
||||
|
||||
vertex_shader_object = GL.CreateShader(Enums.VERSION_2_0.VERTEX_SHADER);
|
||||
fragment_shader_object = GL.CreateShader(Enums.VERSION_2_0.FRAGMENT_SHADER);
|
||||
vertex_shader_object = (uint)GL.CreateShader(GL.Enums.VERSION_2_0.VERTEX_SHADER);
|
||||
fragment_shader_object = (uint)GL.CreateShader(GL.Enums.VERSION_2_0.FRAGMENT_SHADER);
|
||||
|
||||
GL.ShaderSource(vertex_shader_object, vertex_shader_source.Length, vertex_shader_source, (int[])null);
|
||||
GL.CompileShader(vertex_shader_object);
|
||||
GL.GetShader(vertex_shader_object, Enums.VERSION_2_0.COMPILE_STATUS, out status);
|
||||
if (status != (int)Enums.Boolean.TRUE)
|
||||
GL.GetShader(vertex_shader_object, GL.Enums.VERSION_2_0.COMPILE_STATUS, out status);
|
||||
if (status != (int)GL.Enums.Boolean.TRUE)
|
||||
{
|
||||
StringBuilder info = new StringBuilder(1024);
|
||||
GL.GetShaderInfoLog(vertex_shader_object, info.MaxCapacity, (int[])null, info);
|
||||
|
@ -82,8 +80,8 @@ namespace Examples.Tutorial
|
|||
|
||||
GL.ShaderSource(fragment_shader_object, fragment_shader_source.Length, fragment_shader_source, (int[])null);
|
||||
GL.CompileShader(fragment_shader_object);
|
||||
GL.GetShader(fragment_shader_object, Enums.VERSION_2_0.COMPILE_STATUS, out status);
|
||||
if (status != (int)Enums.Boolean.TRUE)
|
||||
GL.GetShader(fragment_shader_object, GL.Enums.VERSION_2_0.COMPILE_STATUS, out status);
|
||||
if (status != (int)GL.Enums.Boolean.TRUE)
|
||||
{
|
||||
StringBuilder info = new StringBuilder(1024);
|
||||
GL.GetShaderInfoLog(fragment_shader_object, 1024, (int[])null, info);
|
||||
|
@ -91,7 +89,7 @@ namespace Examples.Tutorial
|
|||
throw new Exception(info.ToString());
|
||||
}
|
||||
|
||||
shader_program = GL.CreateProgram();
|
||||
shader_program = (uint)GL.CreateProgram();
|
||||
GL.AttachShader(shader_program, fragment_shader_object);
|
||||
GL.AttachShader(shader_program, vertex_shader_object);
|
||||
|
||||
|
@ -103,7 +101,7 @@ namespace Examples.Tutorial
|
|||
|
||||
#endregion
|
||||
|
||||
#region static public void Launch()
|
||||
#region public void Launch()
|
||||
|
||||
/// <summary>
|
||||
/// Launches this example.
|
||||
|
@ -111,11 +109,12 @@ namespace Examples.Tutorial
|
|||
/// <remarks>
|
||||
/// Provides a simple way for the example launcher to launch the examples.
|
||||
/// </remarks>
|
||||
static public void Launch()
|
||||
public void Launch()
|
||||
{
|
||||
using (T10_GLSL_Cube ex = new T10_GLSL_Cube())
|
||||
//using (T10_GLSL_Cube ex = new T10_GLSL_Cube())
|
||||
{
|
||||
ex.Run();
|
||||
//ex.Run();
|
||||
Run();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,7 +131,7 @@ namespace Examples.Tutorial
|
|||
double ratio = 0.0;
|
||||
ratio = this.Width / (double)this.Height;
|
||||
|
||||
GL.MatrixMode(Enums.MatrixMode.PROJECTION);
|
||||
GL.MatrixMode(GL.Enums.MatrixMode.PROJECTION);
|
||||
GL.LoadIdentity();
|
||||
Glu.Perspective(45.0, ratio, 1.0, 64.0);
|
||||
}
|
||||
|
@ -150,7 +149,7 @@ namespace Examples.Tutorial
|
|||
this.Quit = true;
|
||||
}
|
||||
|
||||
GL.MatrixMode(Enums.MatrixMode.MODELVIEW);
|
||||
GL.MatrixMode(GL.Enums.MatrixMode.MODELVIEW);
|
||||
GL.LoadIdentity();
|
||||
Glu.LookAt(
|
||||
0.0, 5.0, 5.0,
|
||||
|
@ -169,7 +168,7 @@ namespace Examples.Tutorial
|
|||
{
|
||||
base.RenderFrame();
|
||||
|
||||
GL.Clear(Enums.ClearBufferMask.COLOR_BUFFER_BIT | Enums.ClearBufferMask.DEPTH_BUFFER_BIT);
|
||||
GL.Clear(GL.Enums.ClearBufferMask.COLOR_BUFFER_BIT | GL.Enums.ClearBufferMask.DEPTH_BUFFER_BIT);
|
||||
|
||||
DrawCube();
|
||||
|
||||
|
@ -178,43 +177,43 @@ namespace Examples.Tutorial
|
|||
|
||||
#endregion
|
||||
|
||||
#region DrawCube
|
||||
#region private void DrawCube()
|
||||
|
||||
public void DrawCube()
|
||||
private void DrawCube()
|
||||
{
|
||||
GL.Begin(Enums.BeginMode.QUADS);
|
||||
GL.Begin(GL.Enums.BeginMode.QUADS);
|
||||
|
||||
GL.Color3(1, 0, 0);
|
||||
GL.Color3(1.0f, 0.0f, 0.0f);
|
||||
GL.Vertex3(-1.0f, -1.0f, -1.0f);
|
||||
GL.Vertex3(-1.0f, 1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, -1.0f, -1.0f);
|
||||
|
||||
GL.Color3(1, 1, 0);
|
||||
GL.Color3(1.0f, 1.0f, 0.0f);
|
||||
GL.Vertex3(-1.0f, -1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, -1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, -1.0f, 1.0f);
|
||||
GL.Vertex3(-1.0f, -1.0f, 1.0f);
|
||||
|
||||
GL.Color3(1, 0, 1);
|
||||
GL.Color3(1.0f, 0.0f, 1.0f);
|
||||
GL.Vertex3(-1.0f, -1.0f, -1.0f);
|
||||
GL.Vertex3(-1.0f, -1.0f, 1.0f);
|
||||
GL.Vertex3(-1.0f, 1.0f, 1.0f);
|
||||
GL.Vertex3(-1.0f, 1.0f, -1.0f);
|
||||
|
||||
GL.Color3(0, 1, 0);
|
||||
GL.Color3(0.0f, 1.0f, 0.0f);
|
||||
GL.Vertex3(-1.0f, -1.0f, 1.0f);
|
||||
GL.Vertex3(1.0f, -1.0f, 1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, 1.0f);
|
||||
GL.Vertex3(-1.0f, 1.0f, 1.0f);
|
||||
|
||||
GL.Color3(0, 0, 1);
|
||||
GL.Color3(0.0f, 0.0f, 1.0f);
|
||||
GL.Vertex3(-1.0f, 1.0f, -1.0f);
|
||||
GL.Vertex3(-1.0f, 1.0f, 1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, 1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, -1.0f);
|
||||
|
||||
GL.Color3(0, 1, 1);
|
||||
GL.Color3(0.0f, 1.0f, 1.0f);
|
||||
GL.Vertex3(1.0f, -1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, 1.0f);
|
||||
|
|
|
@ -9,7 +9,6 @@ using System.Collections.Generic;
|
|||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
|
||||
using OpenTK.Input;
|
||||
using OpenTK.Platform;
|
||||
|
||||
namespace OpenTK
|
||||
|
@ -19,6 +18,10 @@ namespace OpenTK
|
|||
private INativeWindow glWindow;
|
||||
private ResizeEventArgs resizeEventArgs = new ResizeEventArgs();
|
||||
|
||||
public Input.IKeyboard Keyboard { get { return inputDevices.Keyboards[0]; } }
|
||||
|
||||
private InputDevices inputDevices = new InputDevices();
|
||||
|
||||
#region --- Contructors ---
|
||||
|
||||
/// <summary>
|
||||
|
@ -176,11 +179,6 @@ namespace OpenTK
|
|||
public event UpdateFrameEvent UpdateFrameNotify;
|
||||
public event RenderFrameEvent RenderFrameNotify;
|
||||
|
||||
public IKeyboard Key
|
||||
{
|
||||
get { return glWindow.Key; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- IResizable Members ---
|
||||
|
|
33
Source/OpenTK/Input/IInputDevice.cs
Normal file
33
Source/OpenTK/Input/IInputDevice.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenTK.Input
|
||||
{
|
||||
public interface IInputDevice
|
||||
{
|
||||
string Description { get; }
|
||||
InputDeviceType DeviceType { get; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The type of the input device.
|
||||
/// </summary>
|
||||
public enum InputDeviceType
|
||||
{
|
||||
/// <summary>
|
||||
/// Device is a keyboard.
|
||||
/// </summary>
|
||||
Keyboard,
|
||||
/// <summary>
|
||||
/// Device is a mouse.
|
||||
/// </summary>
|
||||
Mouse,
|
||||
/// <summary>
|
||||
/// Device is a Human Interface Device. Joysticks, joypads, pens
|
||||
/// and some specific usb keyboards/mice fall into this category.
|
||||
/// </summary>
|
||||
HID
|
||||
}
|
||||
}
|
14
Source/OpenTK/Input/IInputDriver.cs
Normal file
14
Source/OpenTK/Input/IInputDriver.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenTK.Input
|
||||
{
|
||||
public interface IInputDriver
|
||||
{
|
||||
IList<IInputDevice> InputDevices { get; }
|
||||
IList<IKeyboard> Keyboards { get; }
|
||||
//IEnumerable<IMouse> Mice { get; }
|
||||
//IEnumerable<IHid> Hids { get; }
|
||||
}
|
||||
}
|
|
@ -6,9 +6,8 @@
|
|||
|
||||
namespace OpenTK.Input
|
||||
{
|
||||
public interface IKeyboard
|
||||
public interface IKeyboard : IInputDevice
|
||||
{
|
||||
bool this[Keys k] { get; }
|
||||
//void Poll();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,6 +16,8 @@ namespace OpenTK.Input
|
|||
{
|
||||
private IKeyboard keyboard;
|
||||
|
||||
#region --- Constructors ---
|
||||
|
||||
public Keyboard()
|
||||
{
|
||||
if (Environment.OSVersion.Platform == PlatformID.Win32NT ||
|
||||
|
@ -36,6 +38,8 @@ namespace OpenTK.Input
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- IKeyboard members ---
|
||||
|
||||
public bool this[Keys k]
|
||||
|
@ -45,8 +49,27 @@ namespace OpenTK.Input
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- IInputDevice Members ---
|
||||
|
||||
public string Description
|
||||
{
|
||||
get { return keyboard.Description; }
|
||||
}
|
||||
|
||||
public InputDeviceType DeviceType
|
||||
{
|
||||
get { return keyboard.DeviceType; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region public enum Keys : int
|
||||
|
||||
/// <summary>
|
||||
/// The available keyboard keys.
|
||||
/// </summary>
|
||||
public enum Keys : int
|
||||
{
|
||||
// Modifiers
|
||||
|
@ -56,6 +79,9 @@ namespace OpenTK.Input
|
|||
RightControl,
|
||||
LeftAlt,
|
||||
RightAlt,
|
||||
LeftApp,
|
||||
RightApp,
|
||||
Menu,
|
||||
|
||||
// Function keys (hopefully enough for most keyboards - mine has 26)
|
||||
F1, F2, F3, F4,
|
||||
|
@ -73,7 +99,6 @@ namespace OpenTK.Input
|
|||
Left,
|
||||
Right,
|
||||
|
||||
// Special keys
|
||||
Enter,
|
||||
Escape,
|
||||
Space,
|
||||
|
@ -86,6 +111,43 @@ namespace OpenTK.Input
|
|||
Home,
|
||||
End,
|
||||
CapsLock,
|
||||
PrintScreen,
|
||||
Pause,
|
||||
NumLock,
|
||||
|
||||
// Special keys
|
||||
Sleep,
|
||||
/*LogOff,
|
||||
Help,
|
||||
Undo,
|
||||
Redo,
|
||||
New,
|
||||
Open,
|
||||
Close,
|
||||
Reply,
|
||||
Forward,
|
||||
Send,
|
||||
Spell,
|
||||
Save,
|
||||
Calculator,
|
||||
|
||||
// Folders and applications
|
||||
Documents,
|
||||
Pictures,
|
||||
Music,
|
||||
MediaPlayer,
|
||||
Mail,
|
||||
Browser,
|
||||
Messenger,
|
||||
|
||||
// Multimedia keys
|
||||
Mute,
|
||||
PlayPause,
|
||||
Stop,
|
||||
VolumeUp,
|
||||
VOlumeDown,
|
||||
PreviousTrack,
|
||||
NextTrack,*/
|
||||
|
||||
// Keypad keys
|
||||
Keypad0,
|
||||
|
@ -103,8 +165,7 @@ namespace OpenTK.Input
|
|||
KeypadSubtract,
|
||||
KeypadAdd,
|
||||
KeypadDecimal,
|
||||
KeypadEqual,
|
||||
KeypadEnter,
|
||||
//KeypadEnter,
|
||||
|
||||
// Letters
|
||||
A, B, C, D, E, F, G,
|
||||
|
@ -125,17 +186,21 @@ namespace OpenTK.Input
|
|||
Number9,
|
||||
|
||||
// Symbols
|
||||
Tilde,
|
||||
Minus,
|
||||
Equal,
|
||||
//Equal,
|
||||
Plus,
|
||||
LeftBracket,
|
||||
RightBracket,
|
||||
Semicolon,
|
||||
QuotationMark,
|
||||
Quote,
|
||||
Comma,
|
||||
FullStop,
|
||||
Period,
|
||||
Slash,
|
||||
BackSlash,
|
||||
|
||||
MaxKeys
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
40
Source/OpenTK/InputDevices.cs
Normal file
40
Source/OpenTK/InputDevices.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using OpenTK.Input;
|
||||
|
||||
namespace OpenTK
|
||||
{
|
||||
public class InputDevices : IInputDriver
|
||||
{
|
||||
IInputDriver inputDriver;
|
||||
|
||||
public InputDevices()
|
||||
{
|
||||
if (Environment.OSVersion.Version.Major > 5 ||
|
||||
(Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor >= 1))
|
||||
{
|
||||
inputDriver = new OpenTK.Platform.Windows.WinRawInput();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new PlatformNotSupportedException("Input is not implemented for platforms prior to Windows XP, yet.");
|
||||
}
|
||||
}
|
||||
|
||||
#region --- IInputDriver Members ---
|
||||
|
||||
IList<OpenTK.Input.IInputDevice> OpenTK.Input.IInputDriver.InputDevices
|
||||
{
|
||||
get { return inputDriver.InputDevices; }
|
||||
}
|
||||
|
||||
public IList<OpenTK.Input.IKeyboard> Keyboards
|
||||
{
|
||||
get { return inputDriver.Keyboards; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -4743,7 +4743,7 @@ namespace OpenTK.OpenGL
|
|||
}
|
||||
|
||||
public static
|
||||
GL.Enums.GLenum GetError()
|
||||
GL.Enums.All GetError()
|
||||
{
|
||||
return Delegates.glGetError();
|
||||
}
|
||||
|
@ -5851,20 +5851,20 @@ namespace OpenTK.OpenGL
|
|||
|
||||
[System.CLSCompliant(false)]
|
||||
public static
|
||||
unsafe void DrawElements(GL.Enums.BeginMode mode, Int32 count, GL.Enums.GLenum type, void* indices)
|
||||
unsafe void DrawElements(GL.Enums.BeginMode mode, Int32 count, GL.Enums.All type, void* indices)
|
||||
{
|
||||
unsafe { Delegates.glDrawElements((GL.Enums.BeginMode)mode, (Int32)count, (GL.Enums.GLenum)type, (void*)indices); }
|
||||
unsafe { Delegates.glDrawElements((GL.Enums.BeginMode)mode, (Int32)count, (GL.Enums.All)type, (void*)indices); }
|
||||
}
|
||||
|
||||
public static
|
||||
void DrawElements(GL.Enums.BeginMode mode, Int32 count, GL.Enums.GLenum type, [In, Out] object indices)
|
||||
void DrawElements(GL.Enums.BeginMode mode, Int32 count, GL.Enums.All type, [In, Out] object indices)
|
||||
{
|
||||
System.Runtime.InteropServices.GCHandle indices_ptr = System.Runtime.InteropServices.GCHandle.Alloc(indices, System.Runtime.InteropServices.GCHandleType.Pinned);
|
||||
unsafe
|
||||
{
|
||||
try
|
||||
{
|
||||
Delegates.glDrawElements((GL.Enums.BeginMode)mode, (Int32)count, (GL.Enums.GLenum)type, (void*)indices_ptr.AddrOfPinnedObject());
|
||||
Delegates.glDrawElements((GL.Enums.BeginMode)mode, (Int32)count, (GL.Enums.All)type, (void*)indices_ptr.AddrOfPinnedObject());
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -27616,7 +27616,7 @@ namespace OpenTK.OpenGL
|
|||
}
|
||||
|
||||
public static
|
||||
GL.Enums.GLenum CheckFramebufferStat(GL.Enums.EXT_framebuffer_object target)
|
||||
GL.Enums.All CheckFramebufferStat(GL.Enums.EXT_framebuffer_object target)
|
||||
{
|
||||
return Delegates.glCheckFramebufferStatusEXT((GL.Enums.EXT_framebuffer_object)target);
|
||||
}
|
||||
|
@ -31538,20 +31538,20 @@ namespace OpenTK.OpenGL
|
|||
|
||||
[System.CLSCompliant(false)]
|
||||
public static
|
||||
unsafe void IglooInterfaceSGIX(GL.Enums.GLenum pname, void* @params)
|
||||
unsafe void IglooInterfaceSGIX(GL.Enums.All pname, void* @params)
|
||||
{
|
||||
unsafe { Delegates.glIglooInterfaceSGIX((GL.Enums.GLenum)pname, (void*)@params); }
|
||||
unsafe { Delegates.glIglooInterfaceSGIX((GL.Enums.All)pname, (void*)@params); }
|
||||
}
|
||||
|
||||
public static
|
||||
void IglooInterfaceSGIX(GL.Enums.GLenum pname, [In, Out] object @params)
|
||||
void IglooInterfaceSGIX(GL.Enums.All pname, [In, Out] object @params)
|
||||
{
|
||||
System.Runtime.InteropServices.GCHandle @params_ptr = System.Runtime.InteropServices.GCHandle.Alloc(@params, System.Runtime.InteropServices.GCHandleType.Pinned);
|
||||
unsafe
|
||||
{
|
||||
try
|
||||
{
|
||||
Delegates.glIglooInterfaceSGIX((GL.Enums.GLenum)pname, (void*)@params_ptr.AddrOfPinnedObject());
|
||||
Delegates.glIglooInterfaceSGIX((GL.Enums.All)pname, (void*)@params_ptr.AddrOfPinnedObject());
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -48811,9 +48811,9 @@ namespace OpenTK.OpenGL
|
|||
public static class INGR
|
||||
{
|
||||
public static
|
||||
void BlendFuncSeparateINGR(GL.Enums.GLenum sfactorRGB, GL.Enums.GLenum dfactorRGB, GL.Enums.GLenum sfactorAlpha, GL.Enums.GLenum dfactorAlpha)
|
||||
void BlendFuncSeparateINGR(GL.Enums.All sfactorRGB, GL.Enums.All dfactorRGB, GL.Enums.All sfactorAlpha, GL.Enums.All dfactorAlpha)
|
||||
{
|
||||
Delegates.glBlendFuncSeparateINGR((GL.Enums.GLenum)sfactorRGB, (GL.Enums.GLenum)dfactorRGB, (GL.Enums.GLenum)sfactorAlpha, (GL.Enums.GLenum)dfactorAlpha);
|
||||
Delegates.glBlendFuncSeparateINGR((GL.Enums.All)sfactorRGB, (GL.Enums.All)dfactorRGB, (GL.Enums.All)sfactorAlpha, (GL.Enums.All)dfactorAlpha);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -792,7 +792,7 @@ namespace OpenTK.OpenGL
|
|||
internal extern static unsafe void GetDoublev(GL.Enums.GetPName pname, [Out] Double* @params);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glGetError", ExactSpelling = true)]
|
||||
internal extern static GL.Enums.GLenum GetError();
|
||||
internal extern static GL.Enums.All GetError();
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glGetFloatv", ExactSpelling = true)]
|
||||
internal extern static unsafe void GetFloatv(GL.Enums.GetPName pname, [Out] Single* @params);
|
||||
|
@ -939,7 +939,7 @@ namespace OpenTK.OpenGL
|
|||
internal extern static void DrawArrays(GL.Enums.BeginMode mode, Int32 first, Int32 count);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDrawElements", ExactSpelling = true)]
|
||||
internal extern static unsafe void DrawElements(GL.Enums.BeginMode mode, Int32 count, GL.Enums.GLenum type, void* indices);
|
||||
internal extern static unsafe void DrawElements(GL.Enums.BeginMode mode, Int32 count, GL.Enums.All type, void* indices);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glEdgeFlagPointer", ExactSpelling = true)]
|
||||
internal extern static unsafe void EdgeFlagPointer(Int32 stride, void* pointer);
|
||||
|
@ -3159,7 +3159,7 @@ namespace OpenTK.OpenGL
|
|||
internal extern static void BlendFuncSeparateEXT(GL.Enums.EXT_blend_func_separate sfactorRGB, GL.Enums.EXT_blend_func_separate dfactorRGB, GL.Enums.EXT_blend_func_separate sfactorAlpha, GL.Enums.EXT_blend_func_separate dfactorAlpha);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glBlendFuncSeparateINGR", ExactSpelling = true)]
|
||||
internal extern static void BlendFuncSeparateINGR(GL.Enums.GLenum sfactorRGB, GL.Enums.GLenum dfactorRGB, GL.Enums.GLenum sfactorAlpha, GL.Enums.GLenum dfactorAlpha);
|
||||
internal extern static void BlendFuncSeparateINGR(GL.Enums.All sfactorRGB, GL.Enums.All dfactorRGB, GL.Enums.All sfactorAlpha, GL.Enums.All dfactorAlpha);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glVertexWeightfEXT", ExactSpelling = true)]
|
||||
internal extern static void VertexWeightfEXT(Single weight);
|
||||
|
@ -3333,7 +3333,7 @@ namespace OpenTK.OpenGL
|
|||
internal extern static void TextureColorMaskSGIS(GL.Enums.Boolean red, GL.Enums.Boolean green, GL.Enums.Boolean blue, GL.Enums.Boolean alpha);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glIglooInterfaceSGIX", ExactSpelling = true)]
|
||||
internal extern static unsafe void IglooInterfaceSGIX(GL.Enums.GLenum pname, void* @params);
|
||||
internal extern static unsafe void IglooInterfaceSGIX(GL.Enums.All pname, void* @params);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDeleteFencesNV", ExactSpelling = true)]
|
||||
internal extern static unsafe void DeleteFencesNV(Int32 n, UInt32* fences);
|
||||
|
@ -4269,7 +4269,7 @@ namespace OpenTK.OpenGL
|
|||
internal extern static unsafe void GenFramebuffersEXT(Int32 n, [Out] UInt32* framebuffers);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glCheckFramebufferStatusEXT", ExactSpelling = true)]
|
||||
internal extern static GL.Enums.GLenum CheckFramebufferStatusEXT(GL.Enums.EXT_framebuffer_object target);
|
||||
internal extern static GL.Enums.All CheckFramebufferStatusEXT(GL.Enums.EXT_framebuffer_object target);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glFramebufferTexture1DEXT", ExactSpelling = true)]
|
||||
internal extern static void FramebufferTexture1DEXT(GL.Enums.EXT_framebuffer_object target, GL.Enums.EXT_framebuffer_object attachment, GL.Enums.EXT_framebuffer_object textarget, UInt32 texture, Int32 level);
|
||||
|
|
|
@ -793,7 +793,7 @@ namespace OpenTK.OpenGL
|
|||
internal unsafe delegate void GetDoublev(GL.Enums.GetPName pname, [Out] Double* @params);
|
||||
internal unsafe static GetDoublev glGetDoublev = (GetDoublev)GL.GetDelegateForExtensionMethod("glGetDoublev", typeof(GetDoublev)) ?? new GetDoublev(Imports.GetDoublev);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate GL.Enums.GLenum GetError();
|
||||
internal delegate GL.Enums.All GetError();
|
||||
internal static GetError glGetError = (GetError)GL.GetDelegateForExtensionMethod("glGetError", typeof(GetError)) ?? new GetError(Imports.GetError);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate void GetFloatv(GL.Enums.GetPName pname, [Out] Single* @params);
|
||||
|
@ -940,7 +940,7 @@ namespace OpenTK.OpenGL
|
|||
internal delegate void DrawArrays(GL.Enums.BeginMode mode, Int32 first, Int32 count);
|
||||
internal static DrawArrays glDrawArrays = (DrawArrays)GL.GetDelegateForExtensionMethod("glDrawArrays", typeof(DrawArrays)) ?? new DrawArrays(Imports.DrawArrays);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate void DrawElements(GL.Enums.BeginMode mode, Int32 count, GL.Enums.GLenum type, void* indices);
|
||||
internal unsafe delegate void DrawElements(GL.Enums.BeginMode mode, Int32 count, GL.Enums.All type, void* indices);
|
||||
internal unsafe static DrawElements glDrawElements = (DrawElements)GL.GetDelegateForExtensionMethod("glDrawElements", typeof(DrawElements)) ?? new DrawElements(Imports.DrawElements);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate void EdgeFlagPointer(Int32 stride, void* pointer);
|
||||
|
@ -3160,7 +3160,7 @@ namespace OpenTK.OpenGL
|
|||
internal delegate void BlendFuncSeparateEXT(GL.Enums.EXT_blend_func_separate sfactorRGB, GL.Enums.EXT_blend_func_separate dfactorRGB, GL.Enums.EXT_blend_func_separate sfactorAlpha, GL.Enums.EXT_blend_func_separate dfactorAlpha);
|
||||
internal static BlendFuncSeparateEXT glBlendFuncSeparateEXT = (BlendFuncSeparateEXT)GL.GetDelegateForExtensionMethod("glBlendFuncSeparateEXT", typeof(BlendFuncSeparateEXT));
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void BlendFuncSeparateINGR(GL.Enums.GLenum sfactorRGB, GL.Enums.GLenum dfactorRGB, GL.Enums.GLenum sfactorAlpha, GL.Enums.GLenum dfactorAlpha);
|
||||
internal delegate void BlendFuncSeparateINGR(GL.Enums.All sfactorRGB, GL.Enums.All dfactorRGB, GL.Enums.All sfactorAlpha, GL.Enums.All dfactorAlpha);
|
||||
internal static BlendFuncSeparateINGR glBlendFuncSeparateINGR = (BlendFuncSeparateINGR)GL.GetDelegateForExtensionMethod("glBlendFuncSeparateINGR", typeof(BlendFuncSeparateINGR));
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void VertexWeightfEXT(Single weight);
|
||||
|
@ -3334,7 +3334,7 @@ namespace OpenTK.OpenGL
|
|||
internal delegate void TextureColorMaskSGIS(GL.Enums.Boolean red, GL.Enums.Boolean green, GL.Enums.Boolean blue, GL.Enums.Boolean alpha);
|
||||
internal static TextureColorMaskSGIS glTextureColorMaskSGIS = (TextureColorMaskSGIS)GL.GetDelegateForExtensionMethod("glTextureColorMaskSGIS", typeof(TextureColorMaskSGIS));
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate void IglooInterfaceSGIX(GL.Enums.GLenum pname, void* @params);
|
||||
internal unsafe delegate void IglooInterfaceSGIX(GL.Enums.All pname, void* @params);
|
||||
internal unsafe static IglooInterfaceSGIX glIglooInterfaceSGIX = (IglooInterfaceSGIX)GL.GetDelegateForExtensionMethod("glIglooInterfaceSGIX", typeof(IglooInterfaceSGIX));
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate void DeleteFencesNV(Int32 n, UInt32* fences);
|
||||
|
@ -4270,7 +4270,7 @@ namespace OpenTK.OpenGL
|
|||
internal unsafe delegate void GenFramebuffersEXT(Int32 n, [Out] UInt32* framebuffers);
|
||||
internal unsafe static GenFramebuffersEXT glGenFramebuffersEXT = (GenFramebuffersEXT)GL.GetDelegateForExtensionMethod("glGenFramebuffersEXT", typeof(GenFramebuffersEXT));
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate GL.Enums.GLenum CheckFramebufferStatusEXT(GL.Enums.EXT_framebuffer_object target);
|
||||
internal delegate GL.Enums.All CheckFramebufferStatusEXT(GL.Enums.EXT_framebuffer_object target);
|
||||
internal static CheckFramebufferStatusEXT glCheckFramebufferStatusEXT = (CheckFramebufferStatusEXT)GL.GetDelegateForExtensionMethod("glCheckFramebufferStatusEXT", typeof(CheckFramebufferStatusEXT));
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void FramebufferTexture1DEXT(GL.Enums.EXT_framebuffer_object target, GL.Enums.EXT_framebuffer_object attachment, GL.Enums.EXT_framebuffer_object textarget, UInt32 texture, Int32 level);
|
||||
|
|
|
@ -2580,7 +2580,7 @@ namespace OpenTK.OpenGL
|
|||
UNPACK_SUBSAMPLE_RATE_SGIX = ((int)0x85A1),
|
||||
}
|
||||
|
||||
public enum GLenum
|
||||
public enum All
|
||||
{
|
||||
MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT = ((int)0x8DE4),
|
||||
T4F_V4F = ((int)0x2A28),
|
||||
|
@ -2820,7 +2820,7 @@ namespace OpenTK.OpenGL
|
|||
DONT_CARE = ((int)0x1100),
|
||||
ALPHA_FLOAT16_ATI = ((int)0x881C),
|
||||
LINEAR_MIPMAP_LINEAR = ((int)0x2703),
|
||||
MODELVIEW0_STACK_DEPTH_EXT = ((int)GetPName.MODELVIEW_STACK_DEPTH),
|
||||
MODELVIEW0_STACK_DEPTH_EXT = ((int)All.MODELVIEW_STACK_DEPTH),
|
||||
POINT_TOKEN = ((int)0x0701),
|
||||
COMPRESSED_SRGB_EXT = ((int)0x8C48),
|
||||
EVAL_VERTEX_ATTRIB0_NV = ((int)0x86C6),
|
||||
|
@ -5227,7 +5227,7 @@ namespace OpenTK.OpenGL
|
|||
VERTEX4_BIT_PGI = ((int)0x00000008),
|
||||
TEXTURE_INDEX_SIZE_EXT = ((int)0x80ED),
|
||||
MAP2_TEXTURE_COORD_3 = ((int)0x0DB5),
|
||||
MODELVIEW0_MATRIX_EXT = ((int)GetPName.MODELVIEW_MATRIX),
|
||||
MODELVIEW0_MATRIX_EXT = ((int)All.MODELVIEW_MATRIX),
|
||||
TEXTURE_DEPTH = ((int)0x8071),
|
||||
POLYGON_OFFSET_BIAS_EXT = ((int)0x8039),
|
||||
OFFSET_TEXTURE_SCALE_NV = ((int)0x86E2),
|
||||
|
@ -5462,7 +5462,7 @@ namespace OpenTK.OpenGL
|
|||
FLOAT_RG16_NV = ((int)0x8886),
|
||||
INTENSITY8 = ((int)0x804B),
|
||||
PIXEL_COUNT_NV = ((int)0x8866),
|
||||
MODELVIEW0_EXT = ((int)MatrixMode.MODELVIEW),
|
||||
MODELVIEW0_EXT = ((int)All.MODELVIEW),
|
||||
MAX_ELEMENTS_VERTICES = ((int)0x80E8),
|
||||
VERTEX_ARRAY_SIZE = ((int)0x807A),
|
||||
BGRA_EXT = ((int)0x80E1),
|
||||
|
@ -6959,13 +6959,13 @@ namespace OpenTK.OpenGL
|
|||
MODELVIEW1_MATRIX_EXT = ((int)0x8506),
|
||||
VERTEX_WEIGHT_ARRAY_EXT = ((int)0x850C),
|
||||
VERTEX_WEIGHT_ARRAY_POINTER_EXT = ((int)0x8510),
|
||||
MODELVIEW0_STACK_DEPTH_EXT = ((int)GetPName.MODELVIEW_STACK_DEPTH),
|
||||
MODELVIEW0_STACK_DEPTH_EXT = ((int)All.MODELVIEW_STACK_DEPTH),
|
||||
VERTEX_WEIGHT_ARRAY_TYPE_EXT = ((int)0x850E),
|
||||
CURRENT_VERTEX_WEIGHT_EXT = ((int)0x850B),
|
||||
VERTEX_WEIGHT_ARRAY_SIZE_EXT = ((int)0x850D),
|
||||
MODELVIEW0_MATRIX_EXT = ((int)GetPName.MODELVIEW_MATRIX),
|
||||
MODELVIEW0_MATRIX_EXT = ((int)All.MODELVIEW_MATRIX),
|
||||
VERTEX_WEIGHT_ARRAY_STRIDE_EXT = ((int)0x850F),
|
||||
MODELVIEW0_EXT = ((int)MatrixMode.MODELVIEW),
|
||||
MODELVIEW0_EXT = ((int)All.MODELVIEW),
|
||||
}
|
||||
|
||||
public enum NV_light_max_exponent
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using OpenTK.Input;
|
||||
|
||||
namespace OpenTK.Platform
|
||||
{
|
||||
|
@ -15,8 +14,6 @@ namespace OpenTK.Platform
|
|||
|
||||
event UpdateFrameEvent UpdateFrameNotify;
|
||||
event RenderFrameEvent RenderFrameNotify;
|
||||
|
||||
IKeyboard Key { get; }
|
||||
}
|
||||
|
||||
public delegate void UpdateFrameEvent(EventArgs e);
|
||||
|
|
|
@ -13,7 +13,6 @@ namespace OpenTK.Platform
|
|||
bool IsIdle { get; }
|
||||
bool Quit { get; set; }
|
||||
bool Fullscreen { get; set; }
|
||||
OpenTK.Input.IKeyboard Key { get; }
|
||||
IGLContext Context { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ namespace OpenTK.Platform.Windows
|
|||
RawInputHeaderSize = (uint)Marshal.SizeOf(typeof(RawInputHeader));
|
||||
RawInputSize = (uint)Marshal.SizeOf(typeof(RawInput));
|
||||
RawInputDeviceSize = (uint)Marshal.SizeOf(typeof(RawInputDevice));
|
||||
RawInputDeviceListSize = (uint)Marshal.SizeOf(typeof(RawInputDeviceList));
|
||||
}
|
||||
|
||||
#region Constants
|
||||
|
@ -159,8 +160,6 @@ namespace OpenTK.Platform.Windows
|
|||
// (found in winuser.h)
|
||||
internal const int ENUM_REGISTRY_SETTINGS = -2;
|
||||
internal const int ENUM_CURRENT_SETTINGS = -1;
|
||||
|
||||
public const int VK_ESCAPE = 0x1B;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -171,18 +170,6 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
#region PeekMessage
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct Message
|
||||
{
|
||||
internal IntPtr hWnd;
|
||||
internal int msg;
|
||||
internal IntPtr wParam;
|
||||
internal IntPtr lParam;
|
||||
internal int time;
|
||||
internal System.Drawing.Point p;
|
||||
//System.Drawing.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Low-level WINAPI function that checks the next message in the queue.
|
||||
/// </summary>
|
||||
|
@ -796,7 +783,41 @@ namespace OpenTK.Platform.Windows
|
|||
/// </returns>
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
public static extern UINT GetRawInputDeviceList(
|
||||
[Out] RawInputDeviceList[] RawInputDeviceList,
|
||||
[In, Out] RawInputDeviceList[] RawInputDeviceList,
|
||||
[In, Out] ref UINT NumDevices,
|
||||
UINT Size
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Enumerates the raw input devices attached to the system.
|
||||
/// </summary>
|
||||
/// <param name="RawInputDeviceList">
|
||||
/// ointer to buffer that holds an array of RawInputDeviceList structures
|
||||
/// for the devices attached to the system.
|
||||
/// If NULL, the number of devices are returned in NumDevices.
|
||||
/// </param>
|
||||
/// <param name="NumDevices">
|
||||
/// Pointer to a variable. If RawInputDeviceList is NULL, it specifies the number
|
||||
/// of devices attached to the system. Otherwise, it contains the size, in bytes,
|
||||
/// of the preallocated buffer pointed to by pRawInputDeviceList.
|
||||
/// However, if NumDevices is smaller than needed to contain RawInputDeviceList structures,
|
||||
/// the required buffer size is returned here.
|
||||
/// </param>
|
||||
/// <param name="Size">
|
||||
/// Size of a RawInputDeviceList structure.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// If the function is successful, the return value is the number of devices stored in the buffer
|
||||
/// pointed to by RawInputDeviceList.
|
||||
/// If RawInputDeviceList is NULL, the return value is zero.
|
||||
/// If NumDevices is smaller than needed to contain all the RawInputDeviceList structures,
|
||||
/// the return value is (UINT) -1 and the required buffer is returned in NumDevices.
|
||||
/// Calling GetLastError returns ERROR_INSUFFICIENT_BUFFER.
|
||||
/// On any other error, the function returns (UINT) -1 and GetLastError returns the error indication.
|
||||
/// </returns>
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
public static extern UINT GetRawInputDeviceList(
|
||||
[In, Out] IntPtr RawInputDeviceList,
|
||||
[In, Out] ref UINT NumDevices,
|
||||
UINT Size
|
||||
);
|
||||
|
@ -919,6 +940,24 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
#region --- Structures ---
|
||||
|
||||
#region Message
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct Message
|
||||
{
|
||||
internal IntPtr HWnd;
|
||||
internal int Msg;
|
||||
internal IntPtr WParam;
|
||||
internal IntPtr LParam;
|
||||
internal IntPtr Result;
|
||||
|
||||
//internal int Time;
|
||||
//internal System.Drawing.Point p;
|
||||
//System.Drawing.
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CreateStruct
|
||||
|
||||
internal struct CreateStruct
|
||||
|
@ -1358,11 +1397,13 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
#region RawInputDeviceList
|
||||
|
||||
public static readonly uint RawInputDeviceListSize;
|
||||
|
||||
/// <summary>
|
||||
/// Contains information about a raw input device.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class RawInputDeviceList
|
||||
public struct RawInputDeviceList
|
||||
{
|
||||
/// <summary>
|
||||
/// Handle to the raw input device.
|
||||
|
@ -1372,6 +1413,11 @@ namespace OpenTK.Platform.Windows
|
|||
/// Type of device.
|
||||
/// </summary>
|
||||
public RawInputDeviceType Type;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("{0}, Handle: {1}", Type, Device);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -11,7 +11,6 @@ using System.Collections.Generic;
|
|||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
using OpenTK.Input;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -21,11 +20,11 @@ namespace OpenTK.Platform.Windows
|
|||
{
|
||||
private WinGLContext glContext;
|
||||
private DisplayMode mode = new DisplayMode();
|
||||
|
||||
private Input.IInputDriver inputDriver;
|
||||
|
||||
private bool disposed;
|
||||
|
||||
private WinRawKeyboard key;
|
||||
|
||||
#region --- Contructors ---
|
||||
|
||||
/// <summary>
|
||||
|
@ -46,7 +45,6 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
private void CreateWindow(DisplayMode mode)
|
||||
{
|
||||
|
||||
CreateParams cp = new CreateParams();
|
||||
cp.ClassStyle =
|
||||
(int)API.WindowClassStyle.OwnDC |
|
||||
|
@ -74,12 +72,6 @@ namespace OpenTK.Platform.Windows
|
|||
0.0f
|
||||
)
|
||||
);
|
||||
|
||||
if (Environment.OSVersion.Version.Major > 5 ||
|
||||
(Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor >= 1))
|
||||
key = new WinRawKeyboard(this.Handle); // WinXP and higher support raw input.
|
||||
else
|
||||
throw new PlatformNotSupportedException("Input is not implemented for platforms prior to Windows XP, yet.");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -179,17 +171,9 @@ namespace OpenTK.Platform.Windows
|
|||
case API.Constants.WM_KEYUP:
|
||||
break;
|
||||
|
||||
case API.Constants.WM_INPUT: // Raw input
|
||||
API.RawInput rin = WinRawInput.ProcessEvent(ref msg);
|
||||
if (rin.Header.Type == API.RawInputDeviceType.KEYBOARD)
|
||||
{
|
||||
if (this.key.ProcessEvent(rin))
|
||||
return;
|
||||
else
|
||||
break;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
//case API.Constants.WM_INPUT: // Raw input
|
||||
// WinRawInput.ProcessEvent(ref msg, key);
|
||||
// break;
|
||||
|
||||
case API.Constants.WM_CLOSE:
|
||||
API.PostQuitMessage(0);
|
||||
|
@ -203,18 +187,6 @@ namespace OpenTK.Platform.Windows
|
|||
base.WndProc(ref m);
|
||||
}
|
||||
|
||||
private bool ProcessKey(ref Message m)
|
||||
{
|
||||
switch ((int)m.WParam)
|
||||
{
|
||||
case API.Constants.VK_ESCAPE:
|
||||
//= (m.Msg == API.Constants.WM_KEYDOWN) ? true : false;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- INativeWindow Members ---
|
||||
|
@ -247,15 +219,6 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
#endregion
|
||||
|
||||
#region public IKeyboard Key
|
||||
|
||||
public IKeyboard Key
|
||||
{
|
||||
get { return this.key; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public bool Quit
|
||||
|
||||
private bool quit;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#region --- License ---
|
||||
/* Copyright (c) 2007 Stefanos Apostolopoulos
|
||||
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
|
||||
* See license.txt for license info
|
||||
*/
|
||||
#endregion
|
||||
|
@ -9,53 +9,206 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using OpenTK.Input;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace OpenTK.Platform.Windows
|
||||
{
|
||||
static class WinRawInput
|
||||
internal class WinRawInput : NativeWindow, Input.IInputDriver
|
||||
{
|
||||
private static API.RawInput data = new API.RawInput();
|
||||
internal static API.RawInput ProcessEvent(ref System.Windows.Forms.Message msg)
|
||||
/// <summary>
|
||||
/// Input event data.
|
||||
/// </summary>
|
||||
private API.RawInput data = new API.RawInput();
|
||||
|
||||
/// <summary>
|
||||
/// The list of keyboards connected to this system.
|
||||
/// </summary>
|
||||
private List<WinRawKeyboard> keyboards = new List<WinRawKeyboard>();
|
||||
|
||||
WinRawKeyboard key;
|
||||
|
||||
internal IEnumerable<Input.IInputDevice> InputDevices
|
||||
{
|
||||
get
|
||||
{
|
||||
return (IEnumerable<Input.IInputDevice>)key;
|
||||
}
|
||||
}
|
||||
|
||||
internal WinRawInput()
|
||||
{
|
||||
CreateParams cp = new CreateParams();
|
||||
/*cp.ClassStyle =
|
||||
(int)API.WindowClassStyle.ParentDC;
|
||||
cp.Style =
|
||||
(int)API.WindowStyle.Disabled |
|
||||
(int)API.WindowStyle.ChildWindow;*/
|
||||
|
||||
cp.Caption = "OpenTK hidden input handler window";
|
||||
base.CreateHandle(cp);
|
||||
//key = new WinRawKeyboard(this.Handle);
|
||||
|
||||
uint numKeyboards = WinRawKeyboard.Count;
|
||||
}
|
||||
|
||||
|
||||
private static uint deviceCount;
|
||||
|
||||
internal static uint DeviceCount
|
||||
{
|
||||
get { return DeviceListChanged ? deviceCount : deviceCount; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the Device list has changed, for example
|
||||
/// by removing or adding a device.
|
||||
/// </summary>
|
||||
internal static bool DeviceListChanged
|
||||
{
|
||||
get
|
||||
{
|
||||
uint count = 0;
|
||||
if (API.GetRawInputDeviceList(null, ref count, API.RawInputDeviceListSize) == 0)
|
||||
{
|
||||
if (deviceCount == count)
|
||||
return true;
|
||||
|
||||
deviceCount = count;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ApplicationException(String.Format(
|
||||
"Could not retrieve the count of Keyboard devices. Windows error: {0}",
|
||||
Marshal.GetLastWin32Error()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region protected override void WndProc(ref Message msg)
|
||||
|
||||
/// <summary>
|
||||
/// Processes the input Windows Message, routing the data to the correct Keyboard, Mouse or HID.
|
||||
/// </summary>
|
||||
/// <param name="msg">The WM_INPUT message, containing the data on the input event.</param>
|
||||
protected override void WndProc(ref Message msg)
|
||||
{
|
||||
if (msg.Msg == API.Constants.WM_INPUT)
|
||||
{
|
||||
uint size = 0;
|
||||
// Get the size of the input data
|
||||
API.GetRawInputData(
|
||||
msg.LParam,
|
||||
API.GetRawInputDataEnum.INPUT,
|
||||
IntPtr.Zero,
|
||||
ref size,
|
||||
API.RawInputHeaderSize
|
||||
);
|
||||
API.GetRawInputData(msg.LParam, API.GetRawInputDataEnum.INPUT,
|
||||
IntPtr.Zero, ref size, API.RawInputHeaderSize);
|
||||
|
||||
if (data == null || API.RawInputSize < size)
|
||||
{
|
||||
throw new Exception("WTF?!");
|
||||
throw new ApplicationException("Critical error when processing raw windows input.");
|
||||
}
|
||||
|
||||
if (size ==
|
||||
API.GetRawInputData(
|
||||
msg.LParam,
|
||||
API.GetRawInputDataEnum.INPUT,
|
||||
data,
|
||||
ref size,
|
||||
API.RawInputHeaderSize))
|
||||
if (size == API.GetRawInputData(msg.LParam, API.GetRawInputDataEnum.INPUT,
|
||||
data, ref size, API.RawInputHeaderSize))
|
||||
{
|
||||
return data;
|
||||
switch (data.Header.Type)
|
||||
{
|
||||
case API.RawInputDeviceType.KEYBOARD:
|
||||
ProcessKeyboardEvent(data);
|
||||
break;
|
||||
|
||||
case API.RawInputDeviceType.MOUSE:
|
||||
throw new NotImplementedException();
|
||||
|
||||
case API.RawInputDeviceType.HID:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(
|
||||
"GetRawInputData returned invalid data. Please file a bug in http://opentk.sourceforge.net"
|
||||
throw new ApplicationException(
|
||||
"GetRawInputData returned invalid data. Please file a bug at http://opentk.sourceforge.net"
|
||||
);
|
||||
}
|
||||
}
|
||||
throw new Exception("Never reach this!");
|
||||
|
||||
base.WndProc(ref msg);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region internal bool ProcessKeyboardEvent(API.RawInput rin)
|
||||
|
||||
/// <summary>
|
||||
/// Processes raw input events.
|
||||
/// </summary>
|
||||
/// <param name="rin"></param>
|
||||
/// <returns></returns>
|
||||
internal bool ProcessKeyboardEvent(API.RawInput rin)
|
||||
{
|
||||
switch (rin.Header.Type)
|
||||
{
|
||||
case API.RawInputDeviceType.KEYBOARD:
|
||||
bool pressed =
|
||||
rin.Data.Keyboard.Message == API.Constants.WM_KEYDOWN ||
|
||||
rin.Data.Keyboard.Message == API.Constants.WM_SYSKEYDOWN;
|
||||
|
||||
// Generic control, shift, alt keys may be sent instead of left/right.
|
||||
// It seems you have to explicitly register left/right events.
|
||||
switch (rin.Data.Keyboard.VKey)
|
||||
{
|
||||
case API.VirtualKeys.SHIFT:
|
||||
key[Input.Keys.LeftShift] = key[Input.Keys.RightShift] = pressed;
|
||||
return false;
|
||||
|
||||
case API.VirtualKeys.CONTROL:
|
||||
key[Input.Keys.LeftControl] = key[Input.Keys.RightControl] = pressed;
|
||||
return false;
|
||||
|
||||
case API.VirtualKeys.MENU:
|
||||
key[Input.Keys.LeftAlt] = key[Input.Keys.RightAlt] = pressed;
|
||||
return false;
|
||||
|
||||
default:
|
||||
if (!WinRawKeyboard.KeyMap.ContainsKey(rin.Data.Keyboard.VKey))
|
||||
{
|
||||
Debug.Print("Virtual key {0} not mapped.", rin.Data.Keyboard.VKey);
|
||||
OpenTK.OpenGL.GL.ClearColor(1.0f, 0.3f, 0.3f, 0.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
key[WinRawKeyboard.KeyMap[rin.Data.Keyboard.VKey]] = pressed;
|
||||
OpenTK.OpenGL.GL.ClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case API.RawInputDeviceType.MOUSE:
|
||||
break;
|
||||
|
||||
case API.RawInputDeviceType.HID:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- IInputDriver Members ---
|
||||
|
||||
IList<Input.IInputDevice> Input.IInputDriver.InputDevices
|
||||
{
|
||||
get { throw new Exception("The method or operation is not implemented."); }
|
||||
}
|
||||
|
||||
public IList<IKeyboard> Keyboards
|
||||
{
|
||||
get { return (IList<IKeyboard>)keyboards; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,16 +10,158 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using OpenTK.Input;
|
||||
using System.Diagnostics;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace OpenTK.Platform.Windows
|
||||
{
|
||||
internal class WinRawKeyboard : OpenTK.Input.IKeyboard
|
||||
internal class WinRawKeyboard : Input.IKeyboard
|
||||
{
|
||||
private bool[] keys = new bool[(int)Keys.MaxKeys];
|
||||
private bool[] keys = new bool[(int)Input.Keys.MaxKeys];
|
||||
|
||||
#region internal static Dictionary<API.VirtualKeys, Input.Keys> KeyMap
|
||||
|
||||
internal static Dictionary<API.VirtualKeys, Input.Keys> KeyMap =
|
||||
new Dictionary<API.VirtualKeys, Input.Keys>((int)API.VirtualKeys.Last);
|
||||
|
||||
private static bool keyMapExists;
|
||||
/// <summary>
|
||||
/// Initializes the map between VirtualKeys and OpenTK.Keys
|
||||
/// </summary>
|
||||
private static void InitKeyMap()
|
||||
{
|
||||
if (!keyMapExists)
|
||||
{
|
||||
try
|
||||
{
|
||||
KeyMap.Add(API.VirtualKeys.ESCAPE, Input.Keys.Escape);
|
||||
|
||||
// Function keys
|
||||
for (int i = 0; i < 24; i++)
|
||||
{
|
||||
KeyMap.Add((API.VirtualKeys)((int)API.VirtualKeys.F1 + i), Input.Keys.F1 + i);
|
||||
}
|
||||
|
||||
// Number keys (0-9)
|
||||
for (int i = 0; i <= 9; i++)
|
||||
{
|
||||
KeyMap.Add((API.VirtualKeys)(0x30 + i), Input.Keys.Number0 + i);
|
||||
}
|
||||
|
||||
// Letters (A-Z)
|
||||
for (int i = 0; i < 26; i++)
|
||||
{
|
||||
KeyMap.Add((API.VirtualKeys)(0x41 + i), Input.Keys.A + i);
|
||||
}
|
||||
|
||||
KeyMap.Add(API.VirtualKeys.TAB, Input.Keys.Tab);
|
||||
KeyMap.Add(API.VirtualKeys.CAPITAL, Input.Keys.CapsLock);
|
||||
KeyMap.Add(API.VirtualKeys.LCONTROL, Input.Keys.LeftControl);
|
||||
KeyMap.Add(API.VirtualKeys.LSHIFT, Input.Keys.LeftShift);
|
||||
KeyMap.Add(API.VirtualKeys.LWIN, Input.Keys.LeftApp);
|
||||
KeyMap.Add(API.VirtualKeys.LMENU, Input.Keys.LeftAlt);
|
||||
KeyMap.Add(API.VirtualKeys.SPACE, Input.Keys.Space);
|
||||
KeyMap.Add(API.VirtualKeys.RMENU, Input.Keys.RightAlt);
|
||||
KeyMap.Add(API.VirtualKeys.RWIN, Input.Keys.RightApp);
|
||||
KeyMap.Add(API.VirtualKeys.APPS, Input.Keys.Menu);
|
||||
KeyMap.Add(API.VirtualKeys.RCONTROL, Input.Keys.RightControl);
|
||||
KeyMap.Add(API.VirtualKeys.RSHIFT, Input.Keys.RightShift);
|
||||
KeyMap.Add(API.VirtualKeys.RETURN, Input.Keys.Enter);
|
||||
KeyMap.Add(API.VirtualKeys.BACK, Input.Keys.Backspace);
|
||||
|
||||
KeyMap.Add(API.VirtualKeys.OEM_1, Input.Keys.Semicolon); // Varies by keyboard, ;: on Win2K/US
|
||||
KeyMap.Add(API.VirtualKeys.OEM_2, Input.Keys.Slash); // Varies by keyboard, /? on Win2K/US
|
||||
KeyMap.Add(API.VirtualKeys.OEM_3, Input.Keys.Tilde); // Varies by keyboard, `~ on Win2K/US
|
||||
KeyMap.Add(API.VirtualKeys.OEM_4, Input.Keys.LeftBracket); // Varies by keyboard, [{ on Win2K/US
|
||||
KeyMap.Add(API.VirtualKeys.OEM_5, Input.Keys.BackSlash); // Varies by keyboard, \| on Win2K/US
|
||||
KeyMap.Add(API.VirtualKeys.OEM_6, Input.Keys.RightBracket); // Varies by keyboard, ]} on Win2K/US
|
||||
KeyMap.Add(API.VirtualKeys.OEM_7, Input.Keys.Quote); // Varies by keyboard, '" on Win2K/US
|
||||
KeyMap.Add(API.VirtualKeys.OEM_PLUS, Input.Keys.Plus); // Invariant: +
|
||||
KeyMap.Add(API.VirtualKeys.OEM_COMMA, Input.Keys.Comma); // Invariant: ,
|
||||
KeyMap.Add(API.VirtualKeys.OEM_MINUS, Input.Keys.Minus); // Invariant: -
|
||||
KeyMap.Add(API.VirtualKeys.OEM_PERIOD, Input.Keys.Period); // Invariant: .
|
||||
|
||||
KeyMap.Add(API.VirtualKeys.HOME, Input.Keys.Home);
|
||||
KeyMap.Add(API.VirtualKeys.END, Input.Keys.End);
|
||||
KeyMap.Add(API.VirtualKeys.DELETE, Input.Keys.Delete);
|
||||
KeyMap.Add(API.VirtualKeys.PRIOR, Input.Keys.PageUp);
|
||||
KeyMap.Add(API.VirtualKeys.NEXT, Input.Keys.PageDown);
|
||||
KeyMap.Add(API.VirtualKeys.PRINT, Input.Keys.PrintScreen);
|
||||
KeyMap.Add(API.VirtualKeys.PAUSE, Input.Keys.Pause);
|
||||
KeyMap.Add(API.VirtualKeys.NUMLOCK, Input.Keys.NumLock);
|
||||
|
||||
KeyMap.Add(API.VirtualKeys.SLEEP, Input.Keys.Sleep);
|
||||
|
||||
// Keypad
|
||||
for (int i = 0; i <= 9; i++)
|
||||
{
|
||||
KeyMap.Add((API.VirtualKeys)((int)API.VirtualKeys.NUMPAD0 + i), Input.Keys.Keypad0 + i);
|
||||
|
||||
}
|
||||
KeyMap.Add(API.VirtualKeys.DECIMAL, Input.Keys.KeypadDecimal);
|
||||
KeyMap.Add(API.VirtualKeys.ADD, Input.Keys.KeypadAdd);
|
||||
KeyMap.Add(API.VirtualKeys.SUBTRACT, Input.Keys.KeypadSubtract);
|
||||
KeyMap.Add(API.VirtualKeys.DIVIDE, Input.Keys.KeypadDivide);
|
||||
KeyMap.Add(API.VirtualKeys.MULTIPLY, Input.Keys.KeypadMultiply);
|
||||
|
||||
// Navigation
|
||||
KeyMap.Add(API.VirtualKeys.UP, Input.Keys.Up);
|
||||
KeyMap.Add(API.VirtualKeys.DOWN, Input.Keys.Down);
|
||||
KeyMap.Add(API.VirtualKeys.LEFT, Input.Keys.Left);
|
||||
KeyMap.Add(API.VirtualKeys.RIGHT, Input.Keys.Right);
|
||||
}
|
||||
catch (ArgumentException e)
|
||||
{
|
||||
Debug.Print("Exception while creating keymap: '{0}'.", e.ToString());
|
||||
System.Windows.Forms.MessageBox.Show(
|
||||
String.Format("Exception while creating keymap: '{0}'.", e.ToString()));
|
||||
}
|
||||
finally
|
||||
{
|
||||
keyMapExists = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The count of physical keyboards connected to this computer.
|
||||
/// </summary>
|
||||
private static uint keyboardCount;
|
||||
internal static uint Count
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!WinRawInput.DeviceListChanged && keyboardCount != 0)
|
||||
{
|
||||
return keyboardCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateKeyboardList();
|
||||
return keyboardCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal static void UpdateKeyboardList()
|
||||
{
|
||||
uint count = WinRawInput.DeviceCount;
|
||||
API.RawInputDeviceList[] ridl = new API.RawInputDeviceList[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
ridl[i] = new API.RawInputDeviceList();
|
||||
API.GetRawInputDeviceList(ridl, ref count, API.RawInputDeviceListSize);
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//do something with the information (see section on GetRawInputDeviceInfo)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#region --- Constructors ---
|
||||
|
||||
internal WinRawKeyboard()
|
||||
: this(IntPtr.Zero)
|
||||
|
@ -28,6 +170,7 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
internal WinRawKeyboard(IntPtr windowHandle)
|
||||
{
|
||||
Debug.WriteLine("Keyboard driver: Windows raw input");
|
||||
API.RawInputDevice[] rid = new API.RawInputDevice[1];
|
||||
// Keyboard is 1/6 (page/id). See http://www.microsoft.com/whdc/device/input/HID_HWID.mspx
|
||||
rid[0] = new API.RawInputDevice();
|
||||
|
@ -48,67 +191,37 @@ namespace OpenTK.Platform.Windows
|
|||
);
|
||||
}
|
||||
|
||||
// Set the VirtualKey -> OpenTK.Key map
|
||||
keyMap.Add(API.VirtualKeys.ESCAPE, Keys.Escape);
|
||||
keyMap.Add(API.VirtualKeys.F1, Keys.F1);
|
||||
keyMap.Add(API.VirtualKeys.F2, Keys.F2);
|
||||
keyMap.Add(API.VirtualKeys.F3, Keys.F3);
|
||||
keyMap.Add(API.VirtualKeys.F4, Keys.F4);
|
||||
keyMap.Add(API.VirtualKeys.F5, Keys.F5);
|
||||
keyMap.Add(API.VirtualKeys.F6, Keys.F6);
|
||||
keyMap.Add(API.VirtualKeys.F7, Keys.F7);
|
||||
keyMap.Add(API.VirtualKeys.F8, Keys.F8);
|
||||
keyMap.Add(API.VirtualKeys.F9, Keys.F9);
|
||||
keyMap.Add(API.VirtualKeys.F10, Keys.F10);
|
||||
keyMap.Add(API.VirtualKeys.F11, Keys.F11);
|
||||
keyMap.Add(API.VirtualKeys.F12, Keys.F12);
|
||||
InitKeyMap();
|
||||
}
|
||||
|
||||
internal bool ProcessEvent(API.RawInput rin)
|
||||
{
|
||||
switch (rin.Header.Type)
|
||||
{
|
||||
case API.RawInputDeviceType.KEYBOARD:
|
||||
this[keyMap[rin.Data.Keyboard.VKey]] =
|
||||
rin.Data.Keyboard.Message == API.Constants.WM_KEYDOWN ||
|
||||
rin.Data.Keyboard.Message == API.Constants.WM_SYSKEYDOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#region KeyMap
|
||||
|
||||
internal static Dictionary<API.VirtualKeys, Keys> keyMap =
|
||||
new Dictionary<API.VirtualKeys, Keys>((int)API.VirtualKeys.Last);
|
||||
|
||||
/*
|
||||
internal static List<KeyValuePair<API.VirtualKeys, Keys>> keyMap =
|
||||
new List<KeyValuePair<API.VirtualKeys, Keys>>(
|
||||
new KeyValuePair<API.VirtualKeys, Keys>[]
|
||||
{
|
||||
new KeyValuePair<API.VirtualKeys, Keys>(API.VirtualKeys.ESCAPE, Keys.Escape),
|
||||
new KeyValuePair<API.VirtualKeys, Keys>(API.VirtualKeys.F1, Keys.F1)
|
||||
}
|
||||
);
|
||||
*/
|
||||
#endregion
|
||||
|
||||
#region --- IKeyboard members ---
|
||||
|
||||
public bool this[Keys k]
|
||||
public bool this[Input.Keys k]
|
||||
{
|
||||
get { return keys[(int)k]; }
|
||||
internal set
|
||||
{
|
||||
Debug.Print("OpenTK key {0} {1}.", k, value ? "pressed" : "released");
|
||||
keys[(int)k] = value;
|
||||
//throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- IInputDevice Members ---
|
||||
|
||||
public string Description
|
||||
{
|
||||
get { throw new Exception("The method or operation is not implemented."); }
|
||||
}
|
||||
|
||||
public Input.InputDeviceType DeviceType
|
||||
{
|
||||
get { return Input.InputDeviceType.Keyboard; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ using System.Collections.Generic;
|
|||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Diagnostics;
|
||||
using OpenTK.Input;
|
||||
|
||||
//using OpenTK.OpenGL;
|
||||
|
||||
|
@ -273,7 +272,7 @@ namespace OpenTK.Platform.X11
|
|||
|
||||
#region public Keyboard Key
|
||||
|
||||
public IKeyboard Key
|
||||
public Input.IKeyboard Key
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
|
|
@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
|
|||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("OpenTK Framework")]
|
||||
[assembly: AssemblyDescription("Create OpenGL applications in C#.")]
|
||||
[assembly: AssemblyTitle("OpenTK")]
|
||||
[assembly: AssemblyDescription("An open-source game development toolkit for .Net/Mono")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("OpenTK.Framework")]
|
||||
[assembly: AssemblyProduct("OpenTK")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2006-2007 Stefanos Apostolopoulos")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
|
Loading…
Reference in a new issue