mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-04-30 02:56:32 +00:00
[Input] Added Source and Target to GamePadConfigurationItem
This commit is contained in:
parent
bf5d2a738d
commit
0593ea62e6
41
Source/OpenTK/Input/ConfigurationType.cs
Normal file
41
Source/OpenTK/Input/ConfigurationType.cs
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
#region License
|
||||||
|
//
|
||||||
|
// ConfigurationType.cs
|
||||||
|
//
|
||||||
|
// Author:
|
||||||
|
// Stefanos A. <stapostol@gmail.com>
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -31,51 +31,28 @@ using System;
|
||||||
|
|
||||||
namespace OpenTK.Input
|
namespace OpenTK.Input
|
||||||
{
|
{
|
||||||
enum ConfigurationType
|
|
||||||
{
|
|
||||||
Unmapped = 0,
|
|
||||||
Axis,
|
|
||||||
Button
|
|
||||||
}
|
|
||||||
|
|
||||||
class GamePadConfigurationItem
|
class GamePadConfigurationItem
|
||||||
{
|
{
|
||||||
ConfigurationType map_type;
|
GamePadConfigurationSource source;
|
||||||
Nullable<JoystickButton> map_button;
|
GamePadConfigurationTarget target;
|
||||||
Nullable<JoystickAxis> map_axis;
|
|
||||||
|
|
||||||
public GamePadConfigurationItem()
|
public GamePadConfigurationItem(GamePadConfigurationSource source, GamePadConfigurationTarget target)
|
||||||
{
|
{
|
||||||
|
Source = source;
|
||||||
|
Target = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GamePadConfigurationItem(JoystickAxis axis)
|
public GamePadConfigurationSource Source
|
||||||
{
|
{
|
||||||
Type = ConfigurationType.Axis;
|
get { return source; }
|
||||||
Axis = axis;
|
private set { source = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public GamePadConfigurationItem(JoystickButton button)
|
public GamePadConfigurationTarget Target
|
||||||
{
|
{
|
||||||
Type = ConfigurationType.Button;
|
get { return target; }
|
||||||
Button = button;
|
private set { target = value; }
|
||||||
}
|
|
||||||
|
|
||||||
public ConfigurationType Type
|
|
||||||
{
|
|
||||||
get { return map_type; }
|
|
||||||
private set { map_type = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public Nullable<JoystickAxis> Axis
|
|
||||||
{
|
|
||||||
get { return map_axis; }
|
|
||||||
private set { map_axis = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public Nullable<JoystickButton> Button
|
|
||||||
{
|
|
||||||
get { return map_button; }
|
|
||||||
private set { map_button = value; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
72
Source/OpenTK/Input/GamePadConfigurationSource.cs
Normal file
72
Source/OpenTK/Input/GamePadConfigurationSource.cs
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
#region License
|
||||||
|
//
|
||||||
|
// GamePadConfigurationItem.cs
|
||||||
|
//
|
||||||
|
// Author:
|
||||||
|
// Stefanos A. <stapostol@gmail.com>
|
||||||
|
//
|
||||||
|
// 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<JoystickButton> map_button;
|
||||||
|
Nullable<JoystickAxis> 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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
72
Source/OpenTK/Input/GamePadConfigurationTarget.cs
Normal file
72
Source/OpenTK/Input/GamePadConfigurationTarget.cs
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
#region License
|
||||||
|
//
|
||||||
|
// GamePadConfigurationTarget.cs
|
||||||
|
//
|
||||||
|
// Author:
|
||||||
|
// Stefanos A. <stapostol@gmail.com>
|
||||||
|
//
|
||||||
|
// 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<Buttons> map_button;
|
||||||
|
Nullable<GamePadAxes> 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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -793,6 +793,9 @@
|
||||||
<Compile Include="Input\Buttons.cs" />
|
<Compile Include="Input\Buttons.cs" />
|
||||||
<Compile Include="Input\GamePadConfigurationDatabase.cs" />
|
<Compile Include="Input\GamePadConfigurationDatabase.cs" />
|
||||||
<Compile Include="Input\GamePadConfiguration.cs" />
|
<Compile Include="Input\GamePadConfiguration.cs" />
|
||||||
|
<Compile Include="Input\GamePadConfigurationTarget.cs" />
|
||||||
|
<Compile Include="Input\ConfigurationType.cs" />
|
||||||
|
<Compile Include="Input\GamePadConfigurationSource.cs" />
|
||||||
<Compile Include="Input\GamePadConfigurationItem.cs" />
|
<Compile Include="Input\GamePadConfigurationItem.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
|
|
Loading…
Reference in a new issue