diff --git a/ANX.Framework.sln b/ANX.Framework.sln index 06d999f2..249f4989 100644 --- a/ANX.Framework.sln +++ b/ANX.Framework.sln @@ -79,8 +79,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "XNA", "XNA", "{BD648BB8-EF2 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.InputSystem.Windows.Kinect", "InputSystems\ANX.InputSystem.Windows.Kinect\ANX.InputSystem.Windows.Kinect.csproj", "{E5D69E75-D77C-493F-BBDA-6F9E73B82549}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.InputDevices.Windows.XInput", "InputSystems\ANX.InputSystem.Windows.XInput\ANX.InputDevices.Windows.XInput.csproj", "{60D08399-244F-46A3-91F1-4CFD26D961A3}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.Framework.Windows.DX10", "RenderSystems\ANX.Framework.Windows.DX10\ANX.Framework.Windows.DX10.csproj", "{5BE49183-2F6F-4527-AC90-D816911FCF90}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.Framework.Windows.GL3", "RenderSystems\ANX.Framework.Windows.GL3\ANX.Framework.Windows.GL3.csproj", "{EB8258E0-6741-4DB9-B756-1EBDF67B1ED6}" @@ -130,6 +128,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DX11", "DX11", "{6285F3EF-0 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.InputSystem.Standard", "InputSystems\ANX.InputSystem.Standard\ANX.InputSystem.Standard.csproj", "{49066074-3B7B-4A55-B122-6BD33AB73558}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.InputDevices.Windows.XInput", "InputSystems\ANX.InputDevices.Windows.XInput\ANX.InputDevices.Windows.XInput.csproj", "{60D08399-244F-46A3-91F1-4CFD26D961A3}" +EndProject Global GlobalSection(SubversionScc) = preSolution Svn-Managed = True @@ -292,16 +292,6 @@ Global {E5D69E75-D77C-493F-BBDA-6F9E73B82549}.Release|Mixed Platforms.Build.0 = Release|x86 {E5D69E75-D77C-493F-BBDA-6F9E73B82549}.Release|x86.ActiveCfg = Release|x86 {E5D69E75-D77C-493F-BBDA-6F9E73B82549}.Release|x86.Build.0 = Release|x86 - {60D08399-244F-46A3-91F1-4CFD26D961A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {60D08399-244F-46A3-91F1-4CFD26D961A3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {60D08399-244F-46A3-91F1-4CFD26D961A3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {60D08399-244F-46A3-91F1-4CFD26D961A3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {60D08399-244F-46A3-91F1-4CFD26D961A3}.Debug|x86.ActiveCfg = Debug|Any CPU - {60D08399-244F-46A3-91F1-4CFD26D961A3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {60D08399-244F-46A3-91F1-4CFD26D961A3}.Release|Any CPU.Build.0 = Release|Any CPU - {60D08399-244F-46A3-91F1-4CFD26D961A3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {60D08399-244F-46A3-91F1-4CFD26D961A3}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {60D08399-244F-46A3-91F1-4CFD26D961A3}.Release|x86.ActiveCfg = Release|Any CPU {5BE49183-2F6F-4527-AC90-D816911FCF90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5BE49183-2F6F-4527-AC90-D816911FCF90}.Debug|Any CPU.Build.0 = Debug|Any CPU {5BE49183-2F6F-4527-AC90-D816911FCF90}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -432,6 +422,16 @@ Global {49066074-3B7B-4A55-B122-6BD33AB73558}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {49066074-3B7B-4A55-B122-6BD33AB73558}.Release|Mixed Platforms.Build.0 = Release|Any CPU {49066074-3B7B-4A55-B122-6BD33AB73558}.Release|x86.ActiveCfg = Release|Any CPU + {60D08399-244F-46A3-91F1-4CFD26D961A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {60D08399-244F-46A3-91F1-4CFD26D961A3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {60D08399-244F-46A3-91F1-4CFD26D961A3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {60D08399-244F-46A3-91F1-4CFD26D961A3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {60D08399-244F-46A3-91F1-4CFD26D961A3}.Debug|x86.ActiveCfg = Debug|Any CPU + {60D08399-244F-46A3-91F1-4CFD26D961A3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {60D08399-244F-46A3-91F1-4CFD26D961A3}.Release|Any CPU.Build.0 = Release|Any CPU + {60D08399-244F-46A3-91F1-4CFD26D961A3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {60D08399-244F-46A3-91F1-4CFD26D961A3}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {60D08399-244F-46A3-91F1-4CFD26D961A3}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -457,10 +457,10 @@ Global {57097B7A-A283-4409-8AAC-35BF0F458657} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} {160150D5-38E6-482D-97F5-2624F322A854} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} {E5D69E75-D77C-493F-BBDA-6F9E73B82549} = {7AD65E6B-2A48-437F-81D9-4CA9C9A85C64} - {60D08399-244F-46A3-91F1-4CFD26D961A3} = {7AD65E6B-2A48-437F-81D9-4CA9C9A85C64} {5CA3CDF5-4D2C-42AC-AD08-641BD3992B75} = {7AD65E6B-2A48-437F-81D9-4CA9C9A85C64} {DB88DDEB-7281-405D-8FCA-5681B6B2BD7A} = {7AD65E6B-2A48-437F-81D9-4CA9C9A85C64} {49066074-3B7B-4A55-B122-6BD33AB73558} = {7AD65E6B-2A48-437F-81D9-4CA9C9A85C64} + {60D08399-244F-46A3-91F1-4CFD26D961A3} = {7AD65E6B-2A48-437F-81D9-4CA9C9A85C64} {6A582788-C4D2-410C-96CD-177F75712D65} = {5725DA44-4F5C-4E93-A957-AC5C85603EE9} {14EF49AB-6D3F-458D-9D5C-D120B86EDD7A} = {5725DA44-4F5C-4E93-A957-AC5C85603EE9} {CCB4679D-11AF-4EC6-AAA4-36619FCE70FA} = {60824BDB-AC8A-42ED-9B79-111FB44669FF} diff --git a/InputSystems/ANX.InputSystem.Windows.XInput/ANX.InputDevices.Windows.XInput.csproj b/InputSystems/ANX.InputSystem.Windows.XInput/ANX.InputDevices.Windows.XInput.csproj deleted file mode 100644 index 985fb8e5..00000000 --- a/InputSystems/ANX.InputSystem.Windows.XInput/ANX.InputDevices.Windows.XInput.csproj +++ /dev/null @@ -1,94 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {60D08399-244F-46A3-91F1-4CFD26D961A3} - Library - Properties - ANX.InputDevices.Windows.XInput - ANX.InputDevices.Windows.XInput - v4.0 - 512 - - - true - full - false - ..\..\bin\Debug\ - TRACE;DEBUG;XNAEXT - prompt - 4 - - - pdbonly - true - ..\..\bin\Debug\ - TRACE - prompt - 4 - - - - False - ..\..\lib\NLog\NLog.dll - - - ..\..\lib\SharpDX\Bin\SharpDX.dll - - - ..\..\lib\SharpDX\Bin\SharpDX.Diagnostics.dll - - - ..\..\lib\SharpDX\Bin\SharpDX.DirectInput.dll - - - ..\..\lib\SharpDX\Bin\SharpDX.XInput.dll - - - - - - - - - - - - - - - - - - Metadata.resx - True - True - - - - - - - - {6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35} - ANX.Framework - - - - - PublicResXFileCodeGenerator - Metadata.Designer.cs - - - - - \ No newline at end of file diff --git a/InputSystems/ANX.InputSystem.Windows.XInput/FormatConverter.cs b/InputSystems/ANX.InputSystem.Windows.XInput/FormatConverter.cs deleted file mode 100644 index cb739425..00000000 --- a/InputSystems/ANX.InputSystem.Windows.XInput/FormatConverter.cs +++ /dev/null @@ -1,405 +0,0 @@ -#region Using Statements -using System; -using ANX.Framework.Input; -using SharpDX.XInput; - -#endregion // Using Statements - -#region License - -// -// This file is part of the ANX.Framework created by the "ANX.Framework developer group". -// -// This file is released under the Ms-PL license. -// -// -// -// Microsoft Public License (Ms-PL) -// -// This license governs use of the accompanying software. If you use the software, you accept this license. -// If you do not accept the license, do not use the software. -// -// 1.Definitions -// The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning -// here as under U.S. copyright law. -// A "contribution" is the original software, or any additions or changes to the software. -// A "contributor" is any person that distributes its contribution under this license. -// "Licensed patents" are a contributor's patent claims that read directly on its contribution. -// -// 2.Grant of Rights -// (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations -// in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to -// reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution -// or any derivative works that you create. -// (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in -// section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed -// patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution -// in the software or derivative works of the contribution in the software. -// -// 3.Conditions and Limitations -// (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. -// (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your -// patent license from such contributor to the software ends automatically. -// (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution -// notices that are present in the software. -// (D) If you distribute any portion of the software in source code form, you may do so only under this license by including -// a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or -// object code form, you may only do so under a license that complies with this license. -// (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees, -// or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the -// extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a -// particular purpose and non-infringement. - -#endregion // License - -namespace ANX.InputDevices.Windows.XInput -{ - internal class FormatConverter - { - public static ANX.Framework.Input.Keys Translate(SharpDX.DirectInput.Key key) - { - //TODO: implement all keys - //TODO: test if a array with the mapping which is constructed once is faster - - - switch (key) - { - case SharpDX.DirectInput.Key.A: - return Keys.A; - case SharpDX.DirectInput.Key.AT: - break; - case SharpDX.DirectInput.Key.AX: - break; - case SharpDX.DirectInput.Key.AbntC1: - break; - case SharpDX.DirectInput.Key.AbntC2: - break; - case SharpDX.DirectInput.Key.Add: - return Keys.Add; - case SharpDX.DirectInput.Key.Apostrophe: - break; - case SharpDX.DirectInput.Key.Applications: - //check - return Keys.Apps; - case SharpDX.DirectInput.Key.B: - return Keys.B; - case SharpDX.DirectInput.Key.Back: - return Keys.Back; - case SharpDX.DirectInput.Key.Backslash: - return Keys.OemBackslash; - case SharpDX.DirectInput.Key.C: - return Keys.C; - case SharpDX.DirectInput.Key.Calculator: - break; - case SharpDX.DirectInput.Key.Capital: - //check - return Keys.CapsLock; - case SharpDX.DirectInput.Key.Colon: - break; - case SharpDX.DirectInput.Key.Comma: - return Keys.OemComma; - case SharpDX.DirectInput.Key.Convert: - return Keys.ImeConvert; - case SharpDX.DirectInput.Key.D: - return Keys.D; - case SharpDX.DirectInput.Key.D0: - return Keys.D0; - case SharpDX.DirectInput.Key.D1: - return Keys.D1; - case SharpDX.DirectInput.Key.D2: - return Keys.D2; - case SharpDX.DirectInput.Key.D3: - return Keys.D3; - case SharpDX.DirectInput.Key.D4: - return Keys.D4; - case SharpDX.DirectInput.Key.D5: - return Keys.D5; - case SharpDX.DirectInput.Key.D6: - return Keys.D6; - case SharpDX.DirectInput.Key.D7: - return Keys.D7; - case SharpDX.DirectInput.Key.D8: - return Keys.D8; - case SharpDX.DirectInput.Key.D9: - return Keys.D9; - case SharpDX.DirectInput.Key.Decimal: - return Keys.Decimal; - case SharpDX.DirectInput.Key.Delete: - return Keys.Delete; - case SharpDX.DirectInput.Key.Divide: - return Keys.Divide; - case SharpDX.DirectInput.Key.Down: - return Keys.Down; - case SharpDX.DirectInput.Key.E: - return Keys.E; - case SharpDX.DirectInput.Key.End: - return Keys.End; - case SharpDX.DirectInput.Key.Equals: - break; - case SharpDX.DirectInput.Key.Escape: - return Keys.Escape; - case SharpDX.DirectInput.Key.F: - return Keys.F; - case SharpDX.DirectInput.Key.F1: - return Keys.F1; - case SharpDX.DirectInput.Key.F10: - return Keys.F10; - case SharpDX.DirectInput.Key.F11: - return Keys.F11; - case SharpDX.DirectInput.Key.F12: - return Keys.F12; - case SharpDX.DirectInput.Key.F13: - return Keys.F13; - case SharpDX.DirectInput.Key.F14: - return Keys.F14; - case SharpDX.DirectInput.Key.F15: - return Keys.F15; - case SharpDX.DirectInput.Key.F2: - return Keys.F2; - case SharpDX.DirectInput.Key.F3: - return Keys.F3; - case SharpDX.DirectInput.Key.F4: - return Keys.F4; - case SharpDX.DirectInput.Key.F5: - return Keys.F5; - case SharpDX.DirectInput.Key.F6: - return Keys.F6; - case SharpDX.DirectInput.Key.F7: - return Keys.F7; - case SharpDX.DirectInput.Key.F8: - return Keys.F8; - case SharpDX.DirectInput.Key.F9: - return Keys.F9; - case SharpDX.DirectInput.Key.G: - return Keys.G; - case SharpDX.DirectInput.Key.Grave: - break; - case SharpDX.DirectInput.Key.H: - return Keys.H; - case SharpDX.DirectInput.Key.Home: - return Keys.Home; - case SharpDX.DirectInput.Key.I: - return Keys.I; - case SharpDX.DirectInput.Key.Insert: - return Keys.Insert; - case SharpDX.DirectInput.Key.J: - return Keys.J; - case SharpDX.DirectInput.Key.K: - return Keys.K; - case SharpDX.DirectInput.Key.Kana: - return Keys.Kana; - case SharpDX.DirectInput.Key.Kanji: - return Keys.Kanji; - case SharpDX.DirectInput.Key.L: - return Keys.L; - case SharpDX.DirectInput.Key.Left: - return Keys.Left; - case SharpDX.DirectInput.Key.LeftAlt: - return Keys.LeftAlt; - case SharpDX.DirectInput.Key.LeftBracket: - return Keys.OemOpenBrackets; - case SharpDX.DirectInput.Key.LeftControl: - return Keys.LeftControl; - case SharpDX.DirectInput.Key.LeftShift: - return Keys.LeftShift; - case SharpDX.DirectInput.Key.LeftWindowsKey: - return Keys.LeftWindows; - case SharpDX.DirectInput.Key.M: - return Keys.M; - case SharpDX.DirectInput.Key.Mail: - return Keys.LaunchMail; - case SharpDX.DirectInput.Key.MediaSelect: - return Keys.SelectMedia; - case SharpDX.DirectInput.Key.MediaStop: - return Keys.MediaStop; - case SharpDX.DirectInput.Key.Minus: - break; - case SharpDX.DirectInput.Key.Multiply: - return Keys.Multiply; - case SharpDX.DirectInput.Key.Mute: - return Keys.VolumeMute; - case SharpDX.DirectInput.Key.MyComputer: - break; - case SharpDX.DirectInput.Key.N: - return Keys.N; - case SharpDX.DirectInput.Key.NextTrack: - return Keys.MediaNextTrack; - case SharpDX.DirectInput.Key.NoConvert: - return Keys.ImeNoConvert; - case SharpDX.DirectInput.Key.NumberLock: - return Keys.NumLock; - case SharpDX.DirectInput.Key.NumberPad0: - return Keys.NumPad0; - case SharpDX.DirectInput.Key.NumberPad1: - return Keys.NumPad1; - case SharpDX.DirectInput.Key.NumberPad2: - return Keys.NumPad2; - case SharpDX.DirectInput.Key.NumberPad3: - return Keys.NumPad3; - case SharpDX.DirectInput.Key.NumberPad4: - return Keys.NumPad4; - case SharpDX.DirectInput.Key.NumberPad5: - return Keys.NumPad5; - case SharpDX.DirectInput.Key.NumberPad6: - return Keys.NumPad6;; - case SharpDX.DirectInput.Key.NumberPad7: - return Keys.NumPad7; - case SharpDX.DirectInput.Key.NumberPad8: - return Keys.NumPad8; - case SharpDX.DirectInput.Key.NumberPad9: - return Keys.NumPad9; - case SharpDX.DirectInput.Key.NumberPadComma: - return Keys.OemComma; - case SharpDX.DirectInput.Key.NumberPadEnter: - return Keys.Enter; - case SharpDX.DirectInput.Key.NumberPadEquals: - break; - case SharpDX.DirectInput.Key.O: - return Keys.O; - case SharpDX.DirectInput.Key.Oem102: - break; - case SharpDX.DirectInput.Key.P: - return Keys.P; - case SharpDX.DirectInput.Key.PageDown: - return Keys.PageDown; - case SharpDX.DirectInput.Key.PageUp: - return Keys.PageUp; - case SharpDX.DirectInput.Key.Pause: - return Keys.Pause; - case SharpDX.DirectInput.Key.Period: - return Keys.OemPeriod; - case SharpDX.DirectInput.Key.PlayPause: - return Keys.MediaPlayPause; - case SharpDX.DirectInput.Key.Power: - break; - case SharpDX.DirectInput.Key.PreviousTrack: - return Keys.MediaPreviousTrack; - case SharpDX.DirectInput.Key.PrintScreen: - return Keys.PrintScreen; - case SharpDX.DirectInput.Key.Q: - return Keys.Q; - case SharpDX.DirectInput.Key.R: - return Keys.R; - case SharpDX.DirectInput.Key.Return: - //check - return Keys.Enter; - case SharpDX.DirectInput.Key.Right: - return Keys.Right; - case SharpDX.DirectInput.Key.RightAlt: - return Keys.RightAlt; - case SharpDX.DirectInput.Key.RightBracket: - return Keys.OemCloseBrackets; - case SharpDX.DirectInput.Key.RightControl: - return Keys.RightControl; - case SharpDX.DirectInput.Key.RightShift: - return Keys.RightShift; - case SharpDX.DirectInput.Key.RightWindowsKey: - return Keys.RightWindows; - case SharpDX.DirectInput.Key.S: - return Keys.S; - case SharpDX.DirectInput.Key.ScrollLock: - //check - return Keys.Scroll; - case SharpDX.DirectInput.Key.Semicolon: - return Keys.OemSemicolon; - case SharpDX.DirectInput.Key.Slash: - break; - case SharpDX.DirectInput.Key.Sleep: - return Keys.Sleep; - case SharpDX.DirectInput.Key.Space: - return Keys.Space; - case SharpDX.DirectInput.Key.Stop: - break; - case SharpDX.DirectInput.Key.Subtract: - return Keys.Subtract; - case SharpDX.DirectInput.Key.T: - return Keys.T; - case SharpDX.DirectInput.Key.Tab: - return Keys.Tab; - case SharpDX.DirectInput.Key.U: - return Keys.U; - case SharpDX.DirectInput.Key.Underline: - break; - case SharpDX.DirectInput.Key.Unknown: - break; - case SharpDX.DirectInput.Key.Unlabeled: - break; - case SharpDX.DirectInput.Key.UpArrow: - return Keys.Up; - case SharpDX.DirectInput.Key.V: - return Keys.V; - case SharpDX.DirectInput.Key.VolumeDown: - return Keys.VolumeDown; - case SharpDX.DirectInput.Key.VolumeUp: - return Keys.VolumeUp; - case SharpDX.DirectInput.Key.W: - return Keys.W; - case SharpDX.DirectInput.Key.Wake: - break; - case SharpDX.DirectInput.Key.WebBack: - return Keys.BrowserBack; - case SharpDX.DirectInput.Key.WebFavorites: - return Keys.BrowserFavorites; - case SharpDX.DirectInput.Key.WebForward: - return Keys.BrowserForward; - case SharpDX.DirectInput.Key.WebHome: - return Keys.BrowserHome; - case SharpDX.DirectInput.Key.WebRefresh: - return Keys.BrowserRefresh; - case SharpDX.DirectInput.Key.WebSearch: - return Keys.BrowserSearch; - case SharpDX.DirectInput.Key.WebStop: - return Keys.BrowserStop; - case SharpDX.DirectInput.Key.X: - return Keys.X; - case SharpDX.DirectInput.Key.Y: - return Keys.Y; - case SharpDX.DirectInput.Key.Yen: - break; - case SharpDX.DirectInput.Key.Z: - return Keys.Z; - default: - break; - } - - throw new NotImplementedException(); - } - - public static KeyboardState Translate(SharpDX.DirectInput.KeyboardState keyboardState) - { - int keyCount = keyboardState.PressedKeys.Count; - Keys[] keys = new Keys[keyCount]; - - for (int i = 0; i < keyCount; i++) - { - keys[i] = Translate(keyboardState.PressedKeys[i]); - } - - KeyboardState ks = new KeyboardState(keys); - - return ks; - } - - public static Buttons Translate(SharpDX.XInput.GamepadButtonFlags buttons) - { - Buttons tb = 0; - - tb |= (buttons & GamepadButtonFlags.A) == GamepadButtonFlags.A ? Buttons.A : 0; - tb |= (buttons & GamepadButtonFlags.B) == GamepadButtonFlags.B ? Buttons.B : 0; - tb |= (buttons & GamepadButtonFlags.Back) == GamepadButtonFlags.Back ? Buttons.Back : 0; - tb |= (buttons & GamepadButtonFlags.DPadDown) == GamepadButtonFlags.DPadDown ? Buttons.DPadDown : 0; - tb |= (buttons & GamepadButtonFlags.DPadLeft) == GamepadButtonFlags.DPadLeft ? Buttons.DPadLeft : 0; - tb |= (buttons & GamepadButtonFlags.DPadRight) == GamepadButtonFlags.DPadRight ? Buttons.DPadRight : 0; - tb |= (buttons & GamepadButtonFlags.DPadUp) == GamepadButtonFlags.DPadUp ? Buttons.DPadUp : 0; - tb |= (buttons & GamepadButtonFlags.LeftShoulder) == GamepadButtonFlags.LeftShoulder ? Buttons.LeftShoulder : 0; - tb |= (buttons & GamepadButtonFlags.LeftThumb) == GamepadButtonFlags.LeftThumb ? Buttons.LeftTrigger : 0; - tb |= (buttons & GamepadButtonFlags.RightShoulder) == GamepadButtonFlags.RightShoulder ? Buttons.RightShoulder : 0; - tb |= (buttons & GamepadButtonFlags.RightThumb) == GamepadButtonFlags.RightThumb ? Buttons.RightTrigger : 0; - tb |= (buttons & GamepadButtonFlags.Start) == GamepadButtonFlags.Start ? Buttons.Start : 0; - tb |= (buttons & GamepadButtonFlags.X) == GamepadButtonFlags.X ? Buttons.X : 0; - tb |= (buttons & GamepadButtonFlags.Y) == GamepadButtonFlags.Y ? Buttons.Y : 0; - - return tb; - } - } -} diff --git a/InputSystems/ANX.InputSystem.Windows.XInput/GamePad.cs b/InputSystems/ANX.InputSystem.Windows.XInput/GamePad.cs deleted file mode 100644 index 5e609ee7..00000000 --- a/InputSystems/ANX.InputSystem.Windows.XInput/GamePad.cs +++ /dev/null @@ -1,156 +0,0 @@ -#region Using Statements -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Runtime.InteropServices; -using ANX.Framework.NonXNA; -using ANX.Framework.Input; -using ANX.Framework; -using SharpDX.XInput; - -#endregion // Using Statements - -#region License - -// -// This file is part of the ANX.Framework created by the "ANX.Framework developer group". -// -// This file is released under the Ms-PL license. -// -// -// -// Microsoft Public License (Ms-PL) -// -// This license governs use of the accompanying software. If you use the software, you accept this license. -// If you do not accept the license, do not use the software. -// -// 1.Definitions -// The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning -// here as under U.S. copyright law. -// A "contribution" is the original software, or any additions or changes to the software. -// A "contributor" is any person that distributes its contribution under this license. -// "Licensed patents" are a contributor's patent claims that read directly on its contribution. -// -// 2.Grant of Rights -// (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations -// in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to -// reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution -// or any derivative works that you create. -// (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in -// section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed -// patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution -// in the software or derivative works of the contribution in the software. -// -// 3.Conditions and Limitations -// (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. -// (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your -// patent license from such contributor to the software ends automatically. -// (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution -// notices that are present in the software. -// (D) If you distribute any portion of the software in source code form, you may do so only under this license by including -// a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or -// object code form, you may only do so under a license that complies with this license. -// (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees, -// or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the -// extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a -// particular purpose and non-infringement. - -#endregion // License - -namespace ANX.InputDevices.Windows.XInput -{ - public class GamePad : IGamePad - { - private Controller[] controller; - private const float thumbstickRangeFactor = 1.0f / short.MaxValue; - - public GamePad() - { - controller = new Controller[4]; - controller[0] = new Controller(UserIndex.One); - controller[1] = new Controller(UserIndex.Two); - controller[2] = new Controller(UserIndex.Three); - controller[3] = new Controller(UserIndex.Four); - } - public GamePadCapabilities GetCapabilities(PlayerIndex playerIndex) - { - Capabilities result; - GamePadCapabilities returnres; - //SharpDX.XInput.Capabilities = new SharpDX.XInput.Capabilities(); - try - { - result = controller[(int)playerIndex].GetCapabilities(DeviceQueryType.Gamepad); - returnres = new GamePadCapabilities(); - - } - catch (Exception) - { - - returnres = new GamePadCapabilities(); - } return returnres; - } - - public GamePadState GetState(PlayerIndex playerIndex, out bool isConnected, out int packetNumber) - { - State result; - GamePadState returnres; - if(controller[(int)playerIndex].IsConnected) - { - result = controller[(int)playerIndex].GetState(); - //returnres = new GamePadCapabilities(result.Type,result.Gamepad.Buttons.) - returnres = new GamePadState(new Vector2(result.Gamepad.LeftThumbX * thumbstickRangeFactor, result.Gamepad.LeftThumbY * thumbstickRangeFactor), new Vector2(result.Gamepad.RightThumbX * thumbstickRangeFactor, result.Gamepad.RightThumbY * thumbstickRangeFactor), (float)result.Gamepad.LeftTrigger, (float)result.Gamepad.RightTrigger, FormatConverter.Translate(result.Gamepad.Buttons)); - packetNumber = result.PacketNumber; - isConnected = true; - } - else - { - isConnected = false; - packetNumber = 0; - returnres = new GamePadState(); - } - - - return returnres; - } - - public GamePadState GetState(PlayerIndex playerIndex, GamePadDeadZone deadZoneMode, out bool isConnected, out int packetNumber) - { - throw new NotImplementedException(); - } - - public bool SetVibration(PlayerIndex playerIndex, float leftMotor, float rightMotor) - { - short left; - short right; - if (Math.Abs(leftMotor)>1) - { - left = 1; - } - else - { - left = Convert.ToInt16(Math.Abs(leftMotor) * short.MaxValue); - } - if (Math.Abs(rightMotor) > 1) - { - right = 1; - } - else - { - right = Convert.ToInt16(Math.Abs(rightMotor) * short.MaxValue); - } - - if (controller[(int)playerIndex].IsConnected) - { - Vibration vib = new Vibration(); - vib.LeftMotorSpeed = left; - vib.RightMotorSpeed = right; - controller[(int)playerIndex].SetVibration(vib); - return true; - } - return false; - - } - } -} diff --git a/InputSystems/ANX.InputSystem.Windows.XInput/GamePadCreator.cs b/InputSystems/ANX.InputSystem.Windows.XInput/GamePadCreator.cs deleted file mode 100644 index 5f963e2b..00000000 --- a/InputSystems/ANX.InputSystem.Windows.XInput/GamePadCreator.cs +++ /dev/null @@ -1,85 +0,0 @@ -#region Using Statements -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Runtime.InteropServices; -using ANX.Framework.NonXNA; -using NLog; -using ANX.Framework.NonXNA.InputSystem; - -#endregion // Using Statements - -#region License - -// -// This file is part of the ANX.Framework created by the "ANX.Framework developer group". -// -// This file is released under the Ms-PL license. -// -// -// -// Microsoft Public License (Ms-PL) -// -// This license governs use of the accompanying software. If you use the software, you accept this license. -// If you do not accept the license, do not use the software. -// -// 1.Definitions -// The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning -// here as under U.S. copyright law. -// A "contribution" is the original software, or any additions or changes to the software. -// A "contributor" is any person that distributes its contribution under this license. -// "Licensed patents" are a contributor's patent claims that read directly on its contribution. -// -// 2.Grant of Rights -// (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations -// in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to -// reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution -// or any derivative works that you create. -// (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in -// section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed -// patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution -// in the software or derivative works of the contribution in the software. -// -// 3.Conditions and Limitations -// (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. -// (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your -// patent license from such contributor to the software ends automatically. -// (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution -// notices that are present in the software. -// (D) If you distribute any portion of the software in source code form, you may do so only under this license by including -// a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or -// object code form, you may only do so under a license that complies with this license. -// (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees, -// or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the -// extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a -// particular purpose and non-infringement. - -#endregion // License - -namespace ANX.InputDevices.Windows.XInput -{ - public class GamePadCreator : IGamePadCreator - { - public string Name - { - get { return "XInput.GamePad"; } - } - - public void RegisterCreator(InputDeviceFactory factory) - { - factory.AddCreator(this); - } - - public int Priority - { - get { return 10; } - } - - public IGamePad CreateGamePadInstance() - { - return new GamePad(); - } - } -} diff --git a/InputSystems/ANX.InputSystem.Windows.XInput/Keyboard.cs b/InputSystems/ANX.InputSystem.Windows.XInput/Keyboard.cs deleted file mode 100644 index eb77c905..00000000 --- a/InputSystems/ANX.InputSystem.Windows.XInput/Keyboard.cs +++ /dev/null @@ -1,127 +0,0 @@ -#region Using Statements -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ANX.InputDevices; -using ANX.Framework.NonXNA; -using SharpDX.DirectInput; -using DXKeyboard=SharpDX.DirectInput.Keyboard; -#endregion // Using Statements - -#region License - -// -// This file is part of the ANX.Framework created by the "ANX.Framework developer group". -// -// This file is released under the Ms-PL license. -// -// -// -// Microsoft Public License (Ms-PL) -// -// This license governs use of the accompanying software. If you use the software, you accept this license. -// If you do not accept the license, do not use the software. -// -// 1.Definitions -// The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning -// here as under U.S. copyright law. -// A "contribution" is the original software, or any additions or changes to the software. -// A "contributor" is any person that distributes its contribution under this license. -// "Licensed patents" are a contributor's patent claims that read directly on its contribution. -// -// 2.Grant of Rights -// (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations -// in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to -// reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution -// or any derivative works that you create. -// (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in -// section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed -// patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution -// in the software or derivative works of the contribution in the software. -// -// 3.Conditions and Limitations -// (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. -// (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your -// patent license from such contributor to the software ends automatically. -// (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution -// notices that are present in the software. -// (D) If you distribute any portion of the software in source code form, you may do so only under this license by including -// a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or -// object code form, you may only do so under a license that complies with this license. -// (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees, -// or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the -// extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a -// particular purpose and non-infringement. - -#endregion // License - -namespace ANX.InputDevices.Windows.XInput -{ - public class Keyboard : IKeyboard - { - #region Private Members - private DirectInput directInput; - private DXKeyboard nativeKeyboard; - private KeyboardState nativeState; - - #endregion // Private Members - - public IntPtr WindowHandle - { - get; - set; - } - - public Keyboard() - { - this.nativeState = new KeyboardState(); - } - - public Framework.Input.KeyboardState GetState(Framework.PlayerIndex playerIndex) - { - //TODO: prevent new - - // only available on XBox, behaviour regarding MSDN: empty keystate - return new Framework.Input.KeyboardState(); - } - - public Framework.Input.KeyboardState GetState() - { - if (this.nativeKeyboard == null && this.WindowHandle != null && this.WindowHandle != IntPtr.Zero) - { - this.directInput = new DirectInput(); - this.nativeKeyboard = new DXKeyboard(this.directInput); - this.nativeKeyboard.SetCooperativeLevel(this.WindowHandle, CooperativeLevel.NonExclusive | CooperativeLevel.Background); - this.nativeKeyboard.Acquire(); - } - - if (this.nativeKeyboard != null) - { - nativeKeyboard.GetCurrentState(ref this.nativeState); - if (this.nativeState.PressedKeys.Count > 0) - { - return FormatConverter.Translate(this.nativeState); - } - } - - return new Framework.Input.KeyboardState(); - } - - public void Dispose() - { - if (this.nativeKeyboard != null) - { - this.nativeKeyboard.Unacquire(); - this.nativeKeyboard.Dispose(); - this.nativeKeyboard = null; - } - - if (this.directInput != null) - { - this.directInput.Dispose(); - this.directInput = null; - } - } - } -} diff --git a/InputSystems/ANX.InputSystem.Windows.XInput/KeyboardCreator.cs b/InputSystems/ANX.InputSystem.Windows.XInput/KeyboardCreator.cs deleted file mode 100644 index 9efd34f8..00000000 --- a/InputSystems/ANX.InputSystem.Windows.XInput/KeyboardCreator.cs +++ /dev/null @@ -1,85 +0,0 @@ -#region Using Statements -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Runtime.InteropServices; -using ANX.Framework.NonXNA; -using NLog; -using ANX.Framework.NonXNA.InputSystem; - -#endregion // Using Statements - -#region License - -// -// This file is part of the ANX.Framework created by the "ANX.Framework developer group". -// -// This file is released under the Ms-PL license. -// -// -// -// Microsoft Public License (Ms-PL) -// -// This license governs use of the accompanying software. If you use the software, you accept this license. -// If you do not accept the license, do not use the software. -// -// 1.Definitions -// The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning -// here as under U.S. copyright law. -// A "contribution" is the original software, or any additions or changes to the software. -// A "contributor" is any person that distributes its contribution under this license. -// "Licensed patents" are a contributor's patent claims that read directly on its contribution. -// -// 2.Grant of Rights -// (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations -// in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to -// reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution -// or any derivative works that you create. -// (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in -// section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed -// patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution -// in the software or derivative works of the contribution in the software. -// -// 3.Conditions and Limitations -// (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. -// (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your -// patent license from such contributor to the software ends automatically. -// (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution -// notices that are present in the software. -// (D) If you distribute any portion of the software in source code form, you may do so only under this license by including -// a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or -// object code form, you may only do so under a license that complies with this license. -// (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees, -// or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the -// extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a -// particular purpose and non-infringement. - -#endregion // License - -namespace ANX.InputDevices.Windows.XInput -{ - public class KeyboardCreator : IKeyboardCreator - { - public string Name - { - get { return "DirectInput.DXKeyboard"; } - } - - public void RegisterCreator(InputDeviceFactory factory) - { - factory.AddCreator(this); - } - - public int Priority - { - get { return 10; } - } - - public IKeyboard CreateKeyboardInstance() - { - return new Keyboard(); - } - } -} diff --git a/InputSystems/ANX.InputSystem.Windows.XInput/Metadata.Designer.cs b/InputSystems/ANX.InputSystem.Windows.XInput/Metadata.Designer.cs deleted file mode 100644 index 5b92a760..00000000 --- a/InputSystems/ANX.InputSystem.Windows.XInput/Metadata.Designer.cs +++ /dev/null @@ -1,72 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Dieser Code wurde von einem Tool generiert. -// Laufzeitversion:4.0.30319.239 -// -// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -// der Code erneut generiert wird. -// -//------------------------------------------------------------------------------ - -namespace ANX.InputDevices.Windows.XInput { - using System; - - - /// - /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. - /// - // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert - // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. - // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen - // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - public class Metadata { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Metadata() { - } - - /// - /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ANX.InputDevices.Windows.XInput.Metadata", typeof(Metadata).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle - /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Sucht eine lokalisierte Zeichenfolge, die Win32NT ähnelt. - /// - public static string SupportedPlatforms { - get { - return ResourceManager.GetString("SupportedPlatforms", resourceCulture); - } - } - } -} diff --git a/InputSystems/ANX.InputSystem.Windows.XInput/Metadata.resx b/InputSystems/ANX.InputSystem.Windows.XInput/Metadata.resx deleted file mode 100644 index c90f8c84..00000000 --- a/InputSystems/ANX.InputSystem.Windows.XInput/Metadata.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Win32NT - - \ No newline at end of file diff --git a/InputSystems/ANX.InputSystem.Windows.XInput/Mouse.cs b/InputSystems/ANX.InputSystem.Windows.XInput/Mouse.cs deleted file mode 100644 index 199cec19..00000000 --- a/InputSystems/ANX.InputSystem.Windows.XInput/Mouse.cs +++ /dev/null @@ -1,136 +0,0 @@ -#region Using Statements -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ANX.Framework.NonXNA; -using ANX.Framework.Input; -using SharpDX.DirectInput; -using System.Runtime.InteropServices; -using ANX.Framework; - -#endregion // Using Statements - -#region License - -// -// This file is part of the ANX.Framework created by the "ANX.Framework developer group". -// -// This file is released under the Ms-PL license. -// -// -// -// Microsoft Public License (Ms-PL) -// -// This license governs use of the accompanying software. If you use the software, you accept this license. -// If you do not accept the license, do not use the software. -// -// 1.Definitions -// The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning -// here as under U.S. copyright law. -// A "contribution" is the original software, or any additions or changes to the software. -// A "contributor" is any person that distributes its contribution under this license. -// "Licensed patents" are a contributor's patent claims that read directly on its contribution. -// -// 2.Grant of Rights -// (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations -// in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to -// reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution -// or any derivative works that you create. -// (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in -// section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed -// patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution -// in the software or derivative works of the contribution in the software. -// -// 3.Conditions and Limitations -// (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. -// (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your -// patent license from such contributor to the software ends automatically. -// (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution -// notices that are present in the software. -// (D) If you distribute any portion of the software in source code form, you may do so only under this license by including -// a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or -// object code form, you may only do so under a license that complies with this license. -// (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees, -// or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the -// extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a -// particular purpose and non-infringement. - -#endregion // License - -using MouseX = SharpDX.DirectInput.Mouse; - -namespace ANX.InputDevices.Windows.XInput -{ - class Mouse : IMouse - { - #region Interop - [DllImport("user32.dll")] - static extern bool GetCursorPos(ref Point lpPoint); - - [DllImport("user32.dll")] - static extern void SetCursorPos(int x, int y); - - [DllImport("user32.dll")] - static extern bool ScreenToClient(IntPtr hWnd, ref Point lpPoint); - - #endregion // Interop - - #region Private Members - private DirectInput directInput; - private MouseX mouse; - - #endregion // Private Members - - public IntPtr WindowHandle - { - get; - set; - } - - public Mouse() - { - this.directInput = new DirectInput(); - this.mouse = new MouseX(this.directInput); - this.mouse.Properties.AxisMode = DeviceAxisMode.Absolute; - this.mouse.Acquire(); - } - - public ANX.Framework.Input.MouseState GetState() - { - var state = this.mouse.GetCurrentState(); - - Point cursorPos = new Point(); - GetCursorPos(ref cursorPos); - if (WindowHandle != IntPtr.Zero) - { - ScreenToClient(WindowHandle, ref cursorPos); - } - state.X = cursorPos.X; - state.Y = cursorPos.Y; - - ButtonState left = new ButtonState(); - ButtonState middle = new ButtonState(); - ButtonState right = new ButtonState(); - ButtonState x1 = new ButtonState(); - ButtonState x2 = new ButtonState(); - if(state.Buttons[0]){left=ButtonState.Pressed;} - if(state.Buttons[1]){middle=ButtonState.Pressed;} - if(state.Buttons[2]){right=ButtonState.Pressed;} - if(state.Buttons[3]){x1=ButtonState.Pressed;} - if(state.Buttons[4]){x2=ButtonState.Pressed;} - return new ANX.Framework.Input.MouseState(state.X,state.Y,state.Z,left,middle,right,x1,x2); - } - - public void SetPosition(int x, int y) - { - Point currentPosition = new Point(x, y); - GetCursorPos(ref currentPosition); - if (WindowHandle != IntPtr.Zero) - { - ScreenToClient(WindowHandle, ref currentPosition); - } - SetCursorPos(currentPosition.X, currentPosition.Y); - } - } -} diff --git a/InputSystems/ANX.InputSystem.Windows.XInput/MouseCreator.cs b/InputSystems/ANX.InputSystem.Windows.XInput/MouseCreator.cs deleted file mode 100644 index 25ff33be..00000000 --- a/InputSystems/ANX.InputSystem.Windows.XInput/MouseCreator.cs +++ /dev/null @@ -1,85 +0,0 @@ -#region Using Statements -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Runtime.InteropServices; -using ANX.Framework.NonXNA; -using NLog; -using ANX.Framework.NonXNA.InputSystem; - -#endregion // Using Statements - -#region License - -// -// This file is part of the ANX.Framework created by the "ANX.Framework developer group". -// -// This file is released under the Ms-PL license. -// -// -// -// Microsoft Public License (Ms-PL) -// -// This license governs use of the accompanying software. If you use the software, you accept this license. -// If you do not accept the license, do not use the software. -// -// 1.Definitions -// The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning -// here as under U.S. copyright law. -// A "contribution" is the original software, or any additions or changes to the software. -// A "contributor" is any person that distributes its contribution under this license. -// "Licensed patents" are a contributor's patent claims that read directly on its contribution. -// -// 2.Grant of Rights -// (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations -// in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to -// reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution -// or any derivative works that you create. -// (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in -// section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed -// patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution -// in the software or derivative works of the contribution in the software. -// -// 3.Conditions and Limitations -// (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. -// (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your -// patent license from such contributor to the software ends automatically. -// (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution -// notices that are present in the software. -// (D) If you distribute any portion of the software in source code form, you may do so only under this license by including -// a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or -// object code form, you may only do so under a license that complies with this license. -// (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees, -// or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the -// extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a -// particular purpose and non-infringement. - -#endregion // License - -namespace ANX.InputDevices.Windows.XInput -{ - public class MouseCreator : IMouseCreator - { - public string Name - { - get { return "DirectInput.Mouse"; } - } - - public void RegisterCreator(InputDeviceFactory factory) - { - factory.AddCreator(this); - } - - public int Priority - { - get { return 10; } - } - - public IMouse CreateMouseInstance() - { - return new Mouse(); - } - } -} diff --git a/RecordingSample/RecordingSample/RecordingSample.csproj b/RecordingSample/RecordingSample/RecordingSample.csproj index 439eaf00..45aac4ac 100644 --- a/RecordingSample/RecordingSample/RecordingSample.csproj +++ b/RecordingSample/RecordingSample/RecordingSample.csproj @@ -87,10 +87,6 @@ {DB88DDEB-7281-405D-8FCA-5681B6B2BD7A} ANX.InputSystem.Recording - - {60D08399-244F-46A3-91F1-4CFD26D961A3} - ANX.InputDevices.Windows.XInput - {5BE49183-2F6F-4527-AC90-D816911FCF90} ANX.Framework.Windows.DX10 diff --git a/Samples/KeyboardSample/KeyboardSample.csproj b/Samples/KeyboardSample/KeyboardSample.csproj index 9b010164..c2f54a99 100644 --- a/Samples/KeyboardSample/KeyboardSample.csproj +++ b/Samples/KeyboardSample/KeyboardSample.csproj @@ -83,10 +83,6 @@ {6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35} ANX.Framework - - {60D08399-244F-46A3-91F1-4CFD26D961A3} - ANX.InputDevices.Windows.XInput - {5BE49183-2F6F-4527-AC90-D816911FCF90} ANX.Framework.Windows.DX10 diff --git a/Samples/RenderTarget/RenderTarget.csproj b/Samples/RenderTarget/RenderTarget.csproj index c10e2be9..73f6bc1f 100644 --- a/Samples/RenderTarget/RenderTarget.csproj +++ b/Samples/RenderTarget/RenderTarget.csproj @@ -83,10 +83,6 @@ {6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35} ANX.Framework - - {60D08399-244F-46A3-91F1-4CFD26D961A3} - ANX.InputDevices.Windows.XInput - {5BE49183-2F6F-4527-AC90-D816911FCF90} ANX.Framework.Windows.DX10 diff --git a/Samples/SimpleSprite/SimpleSprite.csproj b/Samples/SimpleSprite/SimpleSprite.csproj index 3ad9b768..1672938b 100644 --- a/Samples/SimpleSprite/SimpleSprite.csproj +++ b/Samples/SimpleSprite/SimpleSprite.csproj @@ -83,10 +83,6 @@ {6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35} ANX.Framework - - {60D08399-244F-46A3-91F1-4CFD26D961A3} - ANX.InputDevices.Windows.XInput - {5BE49183-2F6F-4527-AC90-D816911FCF90} ANX.Framework.Windows.DX10 diff --git a/Samples/StencilBuffer/StencilBuffer.csproj b/Samples/StencilBuffer/StencilBuffer.csproj index 221292b6..d7d99658 100644 --- a/Samples/StencilBuffer/StencilBuffer.csproj +++ b/Samples/StencilBuffer/StencilBuffer.csproj @@ -120,10 +120,6 @@ {6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35} ANX.Framework - - {60D08399-244F-46A3-91F1-4CFD26D961A3} - ANX.InputDevices.Windows.XInput - {5BE49183-2F6F-4527-AC90-D816911FCF90} ANX.Framework.Windows.DX10 diff --git a/Samples/TextRendering/TextRendering.csproj b/Samples/TextRendering/TextRendering.csproj index c636320f..ce5325d8 100644 --- a/Samples/TextRendering/TextRendering.csproj +++ b/Samples/TextRendering/TextRendering.csproj @@ -83,10 +83,6 @@ {6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35} ANX.Framework - - {60D08399-244F-46A3-91F1-4CFD26D961A3} - ANX.InputDevices.Windows.XInput - {5BE49183-2F6F-4527-AC90-D816911FCF90} ANX.Framework.Windows.DX10 diff --git a/Samples/VertexIndexBuffer/VertexIndexBuffer.csproj b/Samples/VertexIndexBuffer/VertexIndexBuffer.csproj index aae322ef..c44a9ab1 100644 --- a/Samples/VertexIndexBuffer/VertexIndexBuffer.csproj +++ b/Samples/VertexIndexBuffer/VertexIndexBuffer.csproj @@ -83,10 +83,6 @@ {6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35} ANX.Framework - - {60D08399-244F-46A3-91F1-4CFD26D961A3} - ANX.InputDevices.Windows.XInput - {5BE49183-2F6F-4527-AC90-D816911FCF90} ANX.Framework.Windows.DX10 diff --git a/Samples/WindowsGame/WindowsGame.csproj b/Samples/WindowsGame/WindowsGame.csproj index f0d64817..becc7657 100644 --- a/Samples/WindowsGame/WindowsGame.csproj +++ b/Samples/WindowsGame/WindowsGame.csproj @@ -115,10 +115,6 @@ {E5D69E75-D77C-493F-BBDA-6F9E73B82549} ANX.InputSystem.Windows.Kinect - - {60D08399-244F-46A3-91F1-4CFD26D961A3} - ANX.InputDevices.Windows.XInput - {5BE49183-2F6F-4527-AC90-D816911FCF90} ANX.Framework.Windows.DX10