From 3bcbe67d9c8f24574b28541d84fe19e04ca70de6 Mon Sep 17 00:00:00 2001 From: "SND\\rene87_cp" Date: Fri, 20 Jan 2012 15:17:50 +0000 Subject: [PATCH] add new Inputsystem for Test add MouseTest --- .../ANX.Framework.TestCenter.csproj | 1 + ANX.Framework.TestCenter/AssertHelper.cs | 27 ++++ .../Strukturen/Input/MouseTest.cs | 91 ++++++++++++ .../Strukturen/PointTest.cs | 75 ++++++++-- ANX.Framework.sln | 13 ++ .../ANX.InputDevices.Test.csproj | 80 +++++++++++ InputSystems/ANX.InputDevices.Test/Creator.cs | 131 ++++++++++++++++++ InputSystems/ANX.InputDevices.Test/GamePad.cs | 84 +++++++++++ .../ANX.InputDevices.Test/GamePadCreator.cs | 85 ++++++++++++ .../ANX.InputDevices.Test/Keyboard.cs | 92 ++++++++++++ .../ANX.InputDevices.Test/KeyboardCreator.cs | 85 ++++++++++++ .../Metadata.Designer.cs | 72 ++++++++++ .../ANX.InputDevices.Test/Metadata.resx | 124 +++++++++++++++++ InputSystems/ANX.InputDevices.Test/Mouse.cs | 96 +++++++++++++ .../ANX.InputDevices.Test/MouseCreator.cs | 85 ++++++++++++ .../Properties/AssemblyInfo.cs | 36 +++++ 16 files changed, 1167 insertions(+), 10 deletions(-) create mode 100644 ANX.Framework.TestCenter/Strukturen/Input/MouseTest.cs create mode 100644 InputSystems/ANX.InputDevices.Test/ANX.InputDevices.Test.csproj create mode 100644 InputSystems/ANX.InputDevices.Test/Creator.cs create mode 100644 InputSystems/ANX.InputDevices.Test/GamePad.cs create mode 100644 InputSystems/ANX.InputDevices.Test/GamePadCreator.cs create mode 100644 InputSystems/ANX.InputDevices.Test/Keyboard.cs create mode 100644 InputSystems/ANX.InputDevices.Test/KeyboardCreator.cs create mode 100644 InputSystems/ANX.InputDevices.Test/Metadata.Designer.cs create mode 100644 InputSystems/ANX.InputDevices.Test/Metadata.resx create mode 100644 InputSystems/ANX.InputDevices.Test/Mouse.cs create mode 100644 InputSystems/ANX.InputDevices.Test/MouseCreator.cs create mode 100644 InputSystems/ANX.InputDevices.Test/Properties/AssemblyInfo.cs diff --git a/ANX.Framework.TestCenter/ANX.Framework.TestCenter.csproj b/ANX.Framework.TestCenter/ANX.Framework.TestCenter.csproj index 160d12dc..f5e8f75d 100644 --- a/ANX.Framework.TestCenter/ANX.Framework.TestCenter.csproj +++ b/ANX.Framework.TestCenter/ANX.Framework.TestCenter.csproj @@ -72,6 +72,7 @@ + diff --git a/ANX.Framework.TestCenter/AssertHelper.cs b/ANX.Framework.TestCenter/AssertHelper.cs index 6708fd83..593451bc 100644 --- a/ANX.Framework.TestCenter/AssertHelper.cs +++ b/ANX.Framework.TestCenter/AssertHelper.cs @@ -55,6 +55,12 @@ using NUnit.Framework; #endregion // License #region Datatype Usings +using XNAMouseState = Microsoft.Xna.Framework.Input.MouseState; +using ANXMouseState = ANX.Framework.Input.MouseState; + +using XNAPoint = Microsoft.Xna.Framework.Point; +using ANXPoint = ANX.Framework.Point; + using XNAColor = Microsoft.Xna.Framework.Color; using ANXColor = ANX.Framework.Color; @@ -965,8 +971,29 @@ namespace ANX.Framework.TestCenter } Assert.Pass(test + " passed"); } + + public static void ConvertEquals(XNAPoint xna, ANXPoint anx, String test) + { + if (xna.X == anx.X && + xna.Y == anx.Y) + Assert.Pass(String.Format("{0} passed", test)); + else + Assert.Fail(String.Format("{0} failed: xna({1}) anx({2})", test, xna.ToString(), anx.ToString())); + } + public static void ConvertEquals(ANXMouseState referenz, ANXMouseState toTest, String test) + { + if ((referenz.X == toTest.X) && (referenz.Y == toTest.Y) && (referenz.ScrollWheelValue == toTest.ScrollWheelValue) && (referenz.LeftButton == toTest.LeftButton) && (referenz.MiddleButton == toTest.MiddleButton) && (referenz.RightButton == toTest.RightButton) && (referenz.XButton1 == toTest.XButton1) && (referenz.XButton2 == toTest.XButton2)) + { + Assert.Pass(String.Format("{0} passed", test)); + } + else { + Assert.Fail(String.Format("{0} failed: xna({1}) anx({2})", test, referenz.ToString(), toTest.ToString())); + } + } #endregion + + } } diff --git a/ANX.Framework.TestCenter/Strukturen/Input/MouseTest.cs b/ANX.Framework.TestCenter/Strukturen/Input/MouseTest.cs new file mode 100644 index 00000000..afe5dec7 --- /dev/null +++ b/ANX.Framework.TestCenter/Strukturen/Input/MouseTest.cs @@ -0,0 +1,91 @@ +#region Using Statements +using System; +using System.IO; +using ANX.Framework.NonXNA; +using NUnit.Framework; +#endregion // Using Statements + +using XNAButtonState = Microsoft.Xna.Framework.Input.ButtonState; +using ANXButtonState = ANX.Framework.Input.ButtonState; + +using XNAMouseState = Microsoft.Xna.Framework.Input.MouseState; +using ANXMouseState = ANX.Framework.Input.MouseState; + +using ANXMouse = ANX.Framework.Input.Mouse; + + + +#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.Framework.TestCenter.Strukturen.Input +{ + [TestFixture] + class MouseTest + { + static object[] twoInt = + { + new int[]{DataFactory.RandomBitPlus,DataFactory.RandomBitPlus}, + new int[]{0,0} + }; + + [TestFixtureSetUp] + public void Setup() + { + AddInSystemFactory.Instance.Initialize(); + AddInSystemFactory.Instance.PreferredInputSystem = "Test"; + + } + + [TestCaseSource("twoInt")] + public void GetState(int x, int y) + { + ANXMouse.SetPosition(x, y); + AssertHelper.ConvertEquals(new ANXMouseState(x, y, 0, ANXButtonState.Released, ANXButtonState.Released, ANXButtonState.Released, ANXButtonState.Released, ANXButtonState.Released), ANXMouse.GetState(), "GetState"); + + } + } +} diff --git a/ANX.Framework.TestCenter/Strukturen/PointTest.cs b/ANX.Framework.TestCenter/Strukturen/PointTest.cs index 94123aea..e700dd6c 100644 --- a/ANX.Framework.TestCenter/Strukturen/PointTest.cs +++ b/ANX.Framework.TestCenter/Strukturen/PointTest.cs @@ -80,14 +80,7 @@ namespace ANX.Framework.TestCenter.Strukturen }; - public void ConvertEquals(XNAPoint xna, ANXPoint anx, String test) - { - if (xna.X == anx.X && - xna.Y == anx.Y) - Assert.Pass(String.Format("{0} passed", test)); - else - Assert.Fail(String.Format("{0} failed: xna({1}) anx({2})", test, xna.ToString(), anx.ToString())); - } + #endregion #region Constructors @@ -98,7 +91,7 @@ namespace ANX.Framework.TestCenter.Strukturen ANXPoint anx = new ANXPoint(); - ConvertEquals(xna, anx, "constructor0"); + AssertHelper.ConvertEquals(xna, anx, "constructor0"); } [Test, TestCaseSource("twoint")] @@ -108,7 +101,7 @@ namespace ANX.Framework.TestCenter.Strukturen ANXPoint anx = new ANXPoint(x, y); - ConvertEquals(xna, anx, "constructor1"); + AssertHelper.ConvertEquals(xna, anx, "constructor1"); } #endregion @@ -144,6 +137,68 @@ namespace ANX.Framework.TestCenter.Strukturen else Assert.Fail(String.Format("Y failed: xna({0}) anx({1})", xna.ToString(), anx.ToString())); } + + [Test] + public void Zero() + { + AssertHelper.ConvertEquals(XNAPoint.Zero, ANXPoint.Zero, "Zero"); + } + + [TestCaseSource("twoint")] + public void OpEqual(int x, int y) + { + XNAPoint xna = new XNAPoint(x, y); + ANXPoint anx = new ANXPoint(x, y); + XNAPoint xna2 = new XNAPoint(x, y); + ANXPoint anx2 = new ANXPoint(x, y); + + AssertHelper.ConvertEquals(xna == xna2, anx == anx2, "OpEqual"); + } + + [TestCaseSource("twoint")] + public void OpUnEqual(int x, int y) + { + XNAPoint xna = new XNAPoint(x, y); + ANXPoint anx = new ANXPoint(x, y); + XNAPoint xna2 = new XNAPoint(x, y); + ANXPoint anx2 = new ANXPoint(x, y); + + AssertHelper.ConvertEquals(xna != xna2, anx != anx2, "OpUnEqual"); + } + [TestCaseSource("twoint")] + public void Equals(int x, int y) + { + XNAPoint xna = new XNAPoint(x, y); + ANXPoint anx = new ANXPoint(x, y); + XNAPoint xna2 = new XNAPoint(x, y); + ANXPoint anx2 = new ANXPoint(x, y); + + AssertHelper.ConvertEquals(xna.Equals(xna2), anx.Equals(anx2), "Equals"); + } + [TestCaseSource("twoint")] + public void Equals2(int x, int y) + { + XNAPoint xna = new XNAPoint(x, y); + ANXPoint anx = new ANXPoint(x, y); + + AssertHelper.ConvertEquals(xna.Equals(null), anx.Equals(null), "Equals2"); + } + [TestCaseSource("twoint")] + public void ToString(int x, int y) + { + XNAPoint xna = new XNAPoint(x, y); + ANXPoint anx = new ANXPoint(x, y); + + AssertHelper.ConvertEquals(xna.ToString(), anx.ToString(), "ToString"); + } + [TestCaseSource("twoint")] + public void GetHashCode(int x, int y) + { + XNAPoint xna = new XNAPoint(x, y); + ANXPoint anx = new ANXPoint(x, y); + + AssertHelper.ConvertEquals(xna.GetHashCode(), anx.GetHashCode(), "GetHashCode"); + } #endregion } } diff --git a/ANX.Framework.sln b/ANX.Framework.sln index f36979d2..50cd2db6 100644 --- a/ANX.Framework.sln +++ b/ANX.Framework.sln @@ -130,6 +130,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.InputDevices.OpenTK", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.InputDevices.Windows.Kinect", "InputSystems\ANX.InputDevices.Windows.Kinect\ANX.InputDevices.Windows.Kinect.csproj", "{E5D69E75-D77C-493F-BBDA-6F9E73B82549}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.InputDevices.Test", "InputSystems\ANX.InputDevices.Test\ANX.InputDevices.Test.csproj", "{5040A9C7-6DEC-4613-8586-A598C4070B35}" +EndProject Global GlobalSection(SubversionScc) = preSolution Svn-Managed = True @@ -432,6 +434,16 @@ 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 + {5040A9C7-6DEC-4613-8586-A598C4070B35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5040A9C7-6DEC-4613-8586-A598C4070B35}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5040A9C7-6DEC-4613-8586-A598C4070B35}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {5040A9C7-6DEC-4613-8586-A598C4070B35}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {5040A9C7-6DEC-4613-8586-A598C4070B35}.Debug|x86.ActiveCfg = Debug|Any CPU + {5040A9C7-6DEC-4613-8586-A598C4070B35}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5040A9C7-6DEC-4613-8586-A598C4070B35}.Release|Any CPU.Build.0 = Release|Any CPU + {5040A9C7-6DEC-4613-8586-A598C4070B35}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {5040A9C7-6DEC-4613-8586-A598C4070B35}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {5040A9C7-6DEC-4613-8586-A598C4070B35}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -461,6 +473,7 @@ Global {60D08399-244F-46A3-91F1-4CFD26D961A3} = {7AD65E6B-2A48-437F-81D9-4CA9C9A85C64} {5CA3CDF5-4D2C-42AC-AD08-641BD3992B75} = {7AD65E6B-2A48-437F-81D9-4CA9C9A85C64} {E5D69E75-D77C-493F-BBDA-6F9E73B82549} = {7AD65E6B-2A48-437F-81D9-4CA9C9A85C64} + {5040A9C7-6DEC-4613-8586-A598C4070B35} = {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.InputDevices.Test/ANX.InputDevices.Test.csproj b/InputSystems/ANX.InputDevices.Test/ANX.InputDevices.Test.csproj new file mode 100644 index 00000000..d30e6b46 --- /dev/null +++ b/InputSystems/ANX.InputDevices.Test/ANX.InputDevices.Test.csproj @@ -0,0 +1,80 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {5040A9C7-6DEC-4613-8586-A598C4070B35} + Library + Properties + ANX.InputDevices.Test + ANX.InputDevices.Test + v4.0 + 512 + + + true + full + false + ..\..\bin\Debug\ + TRACE;DEBUG;XNAEXT + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\lib\NLog\NLog.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.InputDevices.Test/Creator.cs b/InputSystems/ANX.InputDevices.Test/Creator.cs new file mode 100644 index 00000000..39bdc5cd --- /dev/null +++ b/InputSystems/ANX.InputDevices.Test/Creator.cs @@ -0,0 +1,131 @@ +#region Using Statements +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using ANX.Framework.NonXNA; + +#endregion + +#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.Test +{ + public class Creator:IInputSystemCreator + { + private Mouse _mouse; + private Keyboard _keyboard; + private GamePad _gamePad; + + + + public IGamePad GamePad + { + get + { + AddInSystemFactory.Instance.PreventInputSystemChange(); + if (_gamePad == null) + { + _gamePad = new GamePad(); + } + return _gamePad; + } + } + + public IMouse Mouse + { + get + { + AddInSystemFactory.Instance.PreventInputSystemChange(); + if (_mouse == null) + { + _mouse = new Mouse(); + } + return _mouse; + } + } + + public IKeyboard Keyboard + { + get + { + AddInSystemFactory.Instance.PreventInputSystemChange(); + if (_keyboard == null) + { + _keyboard = new Keyboard(); + } + return _keyboard; + } + } + + public IMotionSensingDevice MotionSensingDevice + { + get { throw new NotImplementedException(); } + } + + public void RegisterCreator(AddInSystemFactory factory) + { + factory.AddCreator(this); + } + + public string Name + { + get { return "Test"; } + } + + public int Priority + { + get { return int.MaxValue; } + } + + public bool IsSupported + { + get { return true; } //This is just for test, so it runs on all plattforms + } + } +} diff --git a/InputSystems/ANX.InputDevices.Test/GamePad.cs b/InputSystems/ANX.InputDevices.Test/GamePad.cs new file mode 100644 index 00000000..6d5b7503 --- /dev/null +++ b/InputSystems/ANX.InputDevices.Test/GamePad.cs @@ -0,0 +1,84 @@ +#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.Test +{ + public class GamePad:IGamePad + { + public Framework.Input.GamePadCapabilities GetCapabilities(Framework.PlayerIndex playerIndex) + { + throw new NotImplementedException(); + } + + public Framework.Input.GamePadState GetState(Framework.PlayerIndex playerIndex, out bool isConnected, out int packetNumber) + { + throw new NotImplementedException(); + } + + public Framework.Input.GamePadState GetState(Framework.PlayerIndex playerIndex, Framework.Input.GamePadDeadZone deadZoneMode, out bool isConnected, out int packetNumber) + { + throw new NotImplementedException(); + } + + public bool SetVibration(Framework.PlayerIndex playerIndex, float leftMotor, float rightMotor) + { + throw new NotImplementedException(); + } + } +} diff --git a/InputSystems/ANX.InputDevices.Test/GamePadCreator.cs b/InputSystems/ANX.InputDevices.Test/GamePadCreator.cs new file mode 100644 index 00000000..a15e4b44 --- /dev/null +++ b/InputSystems/ANX.InputDevices.Test/GamePadCreator.cs @@ -0,0 +1,85 @@ +#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.Test +{ + public class GamePadCreator:IGamePadCreator + { + public IGamePad CreateGamePadInstance() + { + return new GamePad(); + } + + public string Name + { + get { return "Test.GamePad"; } + } + + public void RegisterCreator(InputDeviceFactory factory) + { + factory.AddCreator(this); + } + + public int Priority + { + get { return 99; } + } + } +} diff --git a/InputSystems/ANX.InputDevices.Test/Keyboard.cs b/InputSystems/ANX.InputDevices.Test/Keyboard.cs new file mode 100644 index 00000000..351d33c1 --- /dev/null +++ b/InputSystems/ANX.InputDevices.Test/Keyboard.cs @@ -0,0 +1,92 @@ +#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.Test +{ + public class Keyboard:IKeyboard + { + public IntPtr WindowHandle + { + get + { + throw new NotImplementedException(); + } + set + { + throw new NotImplementedException(); + } + } + + public Framework.Input.KeyboardState GetState() + { + throw new NotImplementedException(); + } + + public Framework.Input.KeyboardState GetState(Framework.PlayerIndex playerIndex) + { + throw new NotImplementedException(); + } + + public void Dispose() + { + throw new NotImplementedException(); + } + } +} diff --git a/InputSystems/ANX.InputDevices.Test/KeyboardCreator.cs b/InputSystems/ANX.InputDevices.Test/KeyboardCreator.cs new file mode 100644 index 00000000..59737bae --- /dev/null +++ b/InputSystems/ANX.InputDevices.Test/KeyboardCreator.cs @@ -0,0 +1,85 @@ +#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.Test +{ + public class KeyboardCreator:IKeyboardCreator + { + public IKeyboard CreateKeyboardInstance() + { + return new Keyboard(); + } + + public string Name + { + get { return "Test.Keyboard"; } + } + + public void RegisterCreator(InputDeviceFactory factory) + { + factory.AddCreator(this); + } + + public int Priority + { + get { return 99; } + } + } +} diff --git a/InputSystems/ANX.InputDevices.Test/Metadata.Designer.cs b/InputSystems/ANX.InputDevices.Test/Metadata.Designer.cs new file mode 100644 index 00000000..34b37183 --- /dev/null +++ b/InputSystems/ANX.InputDevices.Test/Metadata.Designer.cs @@ -0,0 +1,72 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.239 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ANX.InputDevices.Test { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [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() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [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.Test.Metadata", typeof(Metadata).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Win32NT. + /// + public static string SupportedPlatforms { + get { + return ResourceManager.GetString("SupportedPlatforms", resourceCulture); + } + } + } +} diff --git a/InputSystems/ANX.InputDevices.Test/Metadata.resx b/InputSystems/ANX.InputDevices.Test/Metadata.resx new file mode 100644 index 00000000..65fcb871 --- /dev/null +++ b/InputSystems/ANX.InputDevices.Test/Metadata.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + test only + + \ No newline at end of file diff --git a/InputSystems/ANX.InputDevices.Test/Mouse.cs b/InputSystems/ANX.InputDevices.Test/Mouse.cs new file mode 100644 index 00000000..4ac3b129 --- /dev/null +++ b/InputSystems/ANX.InputDevices.Test/Mouse.cs @@ -0,0 +1,96 @@ +#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; +using ANX.Framework.Input; + +#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.Test +{ + public class Mouse:IMouse + { + int _x; + int _y; + IntPtr _windowHandle; + + + public IntPtr WindowHandle + { + + get + { + return _windowHandle; + } + set + { + this._windowHandle = value; + } + } + + public MouseState GetState() + { + return new MouseState(this._x, this._y, 0, ButtonState.Released, ButtonState.Released, ButtonState.Released, ButtonState.Released, ButtonState.Released); + } + + public void SetPosition(int x, int y) + { + this._x = x; + this._y = y; + } + + + } +} diff --git a/InputSystems/ANX.InputDevices.Test/MouseCreator.cs b/InputSystems/ANX.InputDevices.Test/MouseCreator.cs new file mode 100644 index 00000000..daf43afe --- /dev/null +++ b/InputSystems/ANX.InputDevices.Test/MouseCreator.cs @@ -0,0 +1,85 @@ +#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.Test +{ + public class MouseCreator:IMouseCreator + { + public IMouse CreateMouseInstance() + { + return new Mouse(); + } + + public string Name + { + get { return "Test.Mouse"; } + } + + public void RegisterCreator(InputDeviceFactory factory) + { + factory.AddCreator(this); + } + + public int Priority + { + get { return 99; } + } + } +} diff --git a/InputSystems/ANX.InputDevices.Test/Properties/AssemblyInfo.cs b/InputSystems/ANX.InputDevices.Test/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..c2502fcd --- /dev/null +++ b/InputSystems/ANX.InputDevices.Test/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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("ANX.InputDevices.Test")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ANX.InputDevices.Test")] +[assembly: AssemblyCopyright("Copyright © 2012")] +[assembly: AssemblyTrademark("")] +[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("84ed4be2-5305-45ba-9718-935d66bc74ef")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")]