From 7d4d116ce9efd280e4d21533f85998203c3221ad Mon Sep 17 00:00:00 2001 From: thefiddler Date: Tue, 31 Dec 2013 01:01:52 +0100 Subject: [PATCH] [Input] Renamed GamePadMapping to GamePadMap --- Source/OpenTK/Input/GamePadMap.cs | 148 ++++++++++++++++++++++++++ Source/OpenTK/Input/GamePadMapping.cs | 39 ------- Source/OpenTK/OpenTK.csproj | 2 +- 3 files changed, 149 insertions(+), 40 deletions(-) create mode 100644 Source/OpenTK/Input/GamePadMap.cs delete mode 100644 Source/OpenTK/Input/GamePadMapping.cs diff --git a/Source/OpenTK/Input/GamePadMap.cs b/Source/OpenTK/Input/GamePadMap.cs new file mode 100644 index 00000000..c67ca8c2 --- /dev/null +++ b/Source/OpenTK/Input/GamePadMap.cs @@ -0,0 +1,148 @@ +#region License +// +// GamePadMapping.cs +// +// Author: +// Stefanos A. +// +// Copyright (c) 2006-2013 Stefanos Apostolopoulos +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +#endregion + +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenTK.Input +{ + enum MapType + { + Axis = 0, + Button = 1 + } + + class MapItem + { + MapType map_type; + Nullable map_button; + Nullable map_axis; + + public MapItem(JoystickAxis axis) + { + Type = MapType.Axis; + Axis = axis; + } + + public MapItem(JoystickButton button) + { + Type = MapType.Button; + Button = button; + } + + public MapType Type + { + get { return map_type; } + private set { map_type = value; } + } + + public Nullable Axis + { + get { return map_axis; } + private set { map_axis = value; } + } + + public Nullable Button + { + get { return map_button; } + private set { map_button = value; } + } + } + + class GamePadMap + { + static readonly GamePadMap default_map; + + MapItem a, b, x, y; + MapItem lshoulder, rshoulder; + MapItem lstick, rstick; + MapItem start, back; + MapItem home; + MapItem axis_lx, axis_ly; + MapItem axis_rx, axis_ry; + MapItem ltrigger, rtrigger; + MapItem dpad_u, dpad_d; + MapItem dpad_l, dpad_r; + + public MapItem A { get { return a; } set { a = value; } } + public MapItem B { get { return b; } set { b = value; } } + public MapItem X { get { return x; } set { x = value; } } + public MapItem Y { get { return y; } set { y = value; } } + public MapItem LeftShoulder { get { return lshoulder; } set { lshoulder = value; } } + public MapItem RightShoulder { get { return rshoulder; } set { rshoulder = value; } } + public MapItem LeftStick { get { return lstick; } set { lstick = value; } } + public MapItem RightStick { get { return rstick; } set { rstick = value; } } + public MapItem Start { get { return start; } set { start = value; } } + public MapItem Back { get { return back; } set { back = value; } } + public MapItem BigButton { get { return home; } set { home = value; } } + public MapItem LeftAxisX { get { return axis_lx; } set { axis_lx = value; } } + public MapItem LeftAxisY { get { return axis_ly; } set { axis_ly = value; } } + public MapItem RightAxisX { get { return axis_rx; } set { axis_rx = value; } } + public MapItem RightAxisY { get { return axis_ry; } set { axis_ry = value; } } + public MapItem LeftTrigger { get { return ltrigger; } set { ltrigger = value; } } + public MapItem RightTrigger { get { return rtrigger; } set { rtrigger = value; } } + public MapItem DPadUp { get { return dpad_u; } set { dpad_u = value; } } + public MapItem DPadDown { get { return dpad_d; } set { dpad_d = value; } } + public MapItem DPadLeft { get { return dpad_l; } set { dpad_l = value; } } + public MapItem DPadRight { get { return dpad_r; } set { dpad_r = value; } } + + static GamePadMap() + { + GamePadMap map = new GamePadMap(); + map.A = new MapItem(JoystickButton.Button0); + map.B = new MapItem(JoystickButton.Button1); + map.X = new MapItem(JoystickButton.Button2); + map.Y = new MapItem(JoystickButton.Button3); + map.LeftShoulder = new MapItem(JoystickButton.Button4); + map.RightShoulder = new MapItem(JoystickButton.Button5); + map.LeftStick = new MapItem(JoystickButton.Button6); + map.RightStick = new MapItem(JoystickButton.Button7); + map.Start = new MapItem(JoystickButton.Button8); + map.Back = new MapItem(JoystickButton.Button9); + map.BigButton = new MapItem(JoystickButton.Button10); + map.DPadUp = new MapItem(JoystickButton.Button11); + map.DPadDown = new MapItem(JoystickButton.Button12); + map.DPadLeft = new MapItem(JoystickButton.Button13); + map.DPadRight = new MapItem(JoystickButton.Button14); + map.LeftAxisX = new MapItem(JoystickAxis.Axis0); + map.LeftAxisY = new MapItem(JoystickAxis.Axis1); + map.RightAxisX = new MapItem(JoystickAxis.Axis2); + map.RightAxisY = new MapItem(JoystickAxis.Axis3); + map.LeftTrigger = new MapItem(JoystickAxis.Axis4); + map.RightTrigger = new MapItem(JoystickAxis.Axis5); + default_map = map; + } + + public static GamePadMap Default + { + get { return default_map; } + } + } +} diff --git a/Source/OpenTK/Input/GamePadMapping.cs b/Source/OpenTK/Input/GamePadMapping.cs deleted file mode 100644 index 9ddca29f..00000000 --- a/Source/OpenTK/Input/GamePadMapping.cs +++ /dev/null @@ -1,39 +0,0 @@ -#region License -// -// GamePadMapping.cs -// -// Author: -// Stefanos A. -// -// Copyright (c) 2006-2013 Stefanos Apostolopoulos -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -#endregion - -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenTK.Input -{ - class GamePadMapping - { - } -} diff --git a/Source/OpenTK/OpenTK.csproj b/Source/OpenTK/OpenTK.csproj index a378e483..af108d7a 100644 --- a/Source/OpenTK/OpenTK.csproj +++ b/Source/OpenTK/OpenTK.csproj @@ -133,7 +133,6 @@ - @@ -792,6 +791,7 @@ +