From 91b52b5143cbbc660816eddf5862ede592cfcf8b Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Fri, 19 Oct 2007 20:02:34 +0000 Subject: [PATCH] Added WMInput driver. --- Source/OpenTK/Platform/Windows/WMInput.cs | 105 ++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 Source/OpenTK/Platform/Windows/WMInput.cs diff --git a/Source/OpenTK/Platform/Windows/WMInput.cs b/Source/OpenTK/Platform/Windows/WMInput.cs new file mode 100644 index 00000000..da8a8c7f --- /dev/null +++ b/Source/OpenTK/Platform/Windows/WMInput.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows.Forms; + +using OpenTK.Input; +using System.Diagnostics; + +namespace OpenTK.Platform.Windows +{ + /// + /// Input driver for legacy (pre XP) Windows platforms. + /// + internal sealed class WMInput : NativeWindow, IInputDriver + { + // Driver supports only one keyboard and mouse; + KeyboardDevice keyboard = new KeyboardDevice(); + MouseDevice mouse = new MouseDevice(); + IList keyboards = new List(1); + IList mice = new List(1); + + #region --- Constructor --- + + public WMInput(IWindowInfo parent) + { + Debug.WriteLine("Initalizing WMInput driver."); + Debug.Indent(); + + AssignHandle(parent.Handle); + Debug.Print("Input window attached to parent {0}", parent); + + Debug.Unindent(); + + keyboard.Description = "Standard Windows keyboard"; + keyboard.NumberOfFunctionKeys = 12; + keyboard.NumberOfKeys = 101; + keyboard.NumberOfLeds = 3; + + mouse.Description = "Standard Windows mouse"; + mouse.NumberOfButtons = 3; + mouse.NumberOfWheels = 1; + + keyboards.Add(keyboard); + mice.Add(mouse); + } + + #endregion + + protected override void WndProc(ref Message msg) + { + switch ((WindowMessage)msg.Msg) + { + case WindowMessage.MOUSEMOVE: + break; + + case WindowMessage.MOUSEWHEEL: + break; + + case WindowMessage.KEYDOWN: + break; + + case WindowMessage.KEYUP: + break; + } + + base.WndProc(ref msg); + } + + #region IInputDriver Members + + public void Poll() + { + // No polling needed. + } + + #endregion + + #region IKeyboardDriver Members + + public IList Keyboard + { + get { return keyboards; } + } + + #endregion + + #region IMouseDriver Members + + public IList Mouse + { + get { return mice; } + } + + #endregion + + #region IDisposable Members + + public void Dispose() + { + + } + + #endregion + } +}