diff --git a/Source/OpenTK/Input/ConfigurationType.cs b/Source/OpenTK/Input/ConfigurationType.cs new file mode 100644 index 00000000..0cbb649a --- /dev/null +++ b/Source/OpenTK/Input/ConfigurationType.cs @@ -0,0 +1,41 @@ +#region License +// +// ConfigurationType.cs +// +// Author: +// Stefanos A. +// +// Copyright (c) 2006-2014 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; + +namespace OpenTK.Input +{ + enum ConfigurationType + { + Unmapped = 0, + Axis, + Button + } +} + diff --git a/Source/OpenTK/Input/GamePadConfigurationItem.cs b/Source/OpenTK/Input/GamePadConfigurationItem.cs index e9841074..c2dba9f5 100644 --- a/Source/OpenTK/Input/GamePadConfigurationItem.cs +++ b/Source/OpenTK/Input/GamePadConfigurationItem.cs @@ -31,51 +31,28 @@ using System; namespace OpenTK.Input { - enum ConfigurationType - { - Unmapped = 0, - Axis, - Button - } - class GamePadConfigurationItem { - ConfigurationType map_type; - Nullable map_button; - Nullable map_axis; + GamePadConfigurationSource source; + GamePadConfigurationTarget target; - public GamePadConfigurationItem() + public GamePadConfigurationItem(GamePadConfigurationSource source, GamePadConfigurationTarget target) { + Source = source; + Target = target; } - public GamePadConfigurationItem(JoystickAxis axis) + public GamePadConfigurationSource Source { - Type = ConfigurationType.Axis; - Axis = axis; + get { return source; } + private set { source = value; } } - public GamePadConfigurationItem(JoystickButton button) + public GamePadConfigurationTarget Target { - Type = ConfigurationType.Button; - Button = button; - } - - public ConfigurationType 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; } + get { return target; } + private set { target = value; } } } } + diff --git a/Source/OpenTK/Input/GamePadConfigurationSource.cs b/Source/OpenTK/Input/GamePadConfigurationSource.cs new file mode 100644 index 00000000..c1b25b82 --- /dev/null +++ b/Source/OpenTK/Input/GamePadConfigurationSource.cs @@ -0,0 +1,72 @@ +#region License +// +// GamePadConfigurationItem.cs +// +// Author: +// Stefanos A. +// +// Copyright (c) 2006-2014 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; + +namespace OpenTK.Input +{ + struct GamePadConfigurationSource + { + ConfigurationType map_type; + Nullable map_button; + Nullable map_axis; + + public GamePadConfigurationSource(JoystickAxis axis) + : this() + { + Type = ConfigurationType.Axis; + Axis = axis; + } + + public GamePadConfigurationSource(JoystickButton button) + : this() + { + Type = ConfigurationType.Button; + Button = button; + } + + public ConfigurationType Type + { + get { return map_type; } + private set { map_type = value; } + } + + public JoystickAxis Axis + { + get { return map_axis.Value; } + private set { map_axis = value; } + } + + public JoystickButton Button + { + get { return map_button.Value; } + private set { map_button = value; } + } + } +} diff --git a/Source/OpenTK/Input/GamePadConfigurationTarget.cs b/Source/OpenTK/Input/GamePadConfigurationTarget.cs new file mode 100644 index 00000000..75199c9f --- /dev/null +++ b/Source/OpenTK/Input/GamePadConfigurationTarget.cs @@ -0,0 +1,72 @@ +#region License +// +// GamePadConfigurationTarget.cs +// +// Author: +// Stefanos A. +// +// Copyright (c) 2006-2014 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; + +namespace OpenTK.Input +{ + struct GamePadConfigurationTarget + { + ConfigurationType map_type; + Nullable map_button; + Nullable map_axis; + + public GamePadConfigurationTarget(Buttons button) + : this() + { + Type = ConfigurationType.Button; + map_button = button; + } + + public GamePadConfigurationTarget(GamePadAxes axis) + : this() + { + Type = ConfigurationType.Axis; + map_axis = axis; + } + + public ConfigurationType Type + { + get { return map_type; } + private set { map_type = value; } + } + + public GamePadAxes Axis + { + get { return map_axis.Value; } + private set { map_axis = value; } + } + + public Buttons Button + { + get { return map_button.Value; } + private set { map_button = value; } + } + } +} diff --git a/Source/OpenTK/OpenTK.csproj b/Source/OpenTK/OpenTK.csproj index 13557288..93d0a425 100644 --- a/Source/OpenTK/OpenTK.csproj +++ b/Source/OpenTK/OpenTK.csproj @@ -793,6 +793,9 @@ + + +