mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-09 09:35:31 +00:00
Add XML-doc comments & remove unused imports.
This commit is contained in:
parent
5abbd6c57c
commit
5c11f61729
|
@ -27,8 +27,6 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenTK.Input
|
||||
{
|
||||
|
@ -53,9 +51,13 @@ namespace OpenTK.Input
|
|||
return configuration_items.GetEnumerator();
|
||||
}
|
||||
|
||||
// Parses a GamePad configuration string. The string
|
||||
// follows the rules for SDL2 GameController, outlined here:
|
||||
// http://wiki.libsdl.org/SDL_GameControllerAddMapping
|
||||
/// <summary>
|
||||
/// Parses a GamePad configuration string.
|
||||
/// This string must follow the rules for SDL2
|
||||
/// GameController outlined here:
|
||||
/// http://wiki.libsdl.org/SDL_GameControllerAddMapping
|
||||
/// </summary>
|
||||
/// <param name="configuration"></param>
|
||||
void ParseConfiguration(string configuration)
|
||||
{
|
||||
if (String.IsNullOrEmpty(configuration))
|
||||
|
@ -86,6 +88,11 @@ namespace OpenTK.Input
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses a gamepad configuration target string
|
||||
/// </summary>
|
||||
/// <param name="target">The string to parse</param>
|
||||
/// <returns>The configuration target (Button index, axis index etc.)</returns>
|
||||
static GamePadConfigurationTarget ParseTarget(string target)
|
||||
{
|
||||
switch (target)
|
||||
|
@ -145,6 +152,11 @@ namespace OpenTK.Input
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new gamepad configuration source from the given string
|
||||
/// </summary>
|
||||
/// <param name="item">The string to parse</param>
|
||||
/// <returns>The new gamepad configuration source</returns>
|
||||
static GamePadConfigurationSource ParseSource(string item)
|
||||
{
|
||||
if (String.IsNullOrEmpty(item))
|
||||
|
@ -172,6 +184,12 @@ namespace OpenTK.Input
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses a string in the format a#" where:
|
||||
/// - # is a zero-based integer number
|
||||
/// </summary>
|
||||
/// <param name="item">The string to parse</param>
|
||||
/// <returns>The index of the axis</returns>
|
||||
static int ParseAxis(string item)
|
||||
{
|
||||
// item is in the format "a#" where # a zero-based integer number
|
||||
|
@ -180,17 +198,28 @@ namespace OpenTK.Input
|
|||
return axis + id;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses a string in the format "b#" where:
|
||||
/// - # is a zero-based integer number
|
||||
/// </summary>
|
||||
/// <param name="item">The string to parse</param>
|
||||
/// <returns>The index of the button</returns>
|
||||
static int ParseButton(string item)
|
||||
{
|
||||
// item is in the format "b#" where # a zero-based integer number
|
||||
return Int32.Parse(item.Substring(1));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses a string in the format "h#.#" where:
|
||||
/// - the 1st # is the zero-based hat id
|
||||
/// - the 2nd # is a bit-flag defining the hat position
|
||||
/// </summary>
|
||||
/// <param name="item">The string to parse</param>
|
||||
/// <param name="position">The hat position assigned via 'out'</param>
|
||||
/// <returns>The new joystick hat</returns>
|
||||
static JoystickHat ParseHat(string item, out HatPosition position)
|
||||
{
|
||||
// item is in the format "h#.#" where:
|
||||
// - the 1st # is the zero-based hat id
|
||||
// - the 2nd # is a bit-flag defining the hat position
|
||||
JoystickHat hat = JoystickHat.Hat0;
|
||||
int id = Int32.Parse(item.Substring(1, 1));
|
||||
int pos = Int32.Parse(item.Substring(3));
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenTK.Input
|
||||
{
|
||||
struct GamePadConfigurationSource
|
||||
|
@ -36,6 +34,11 @@ namespace OpenTK.Input
|
|||
JoystickHat? map_hat;
|
||||
HatPosition? map_hat_position;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new gamepad configuration source from an axis or a button
|
||||
/// </summary>
|
||||
/// <param name="isAxis">Whether this source is an axis or a button</param>
|
||||
/// <param name="index">The index of this source</param>
|
||||
public GamePadConfigurationSource(bool isAxis, int index)
|
||||
: this()
|
||||
{
|
||||
|
@ -51,6 +54,11 @@ namespace OpenTK.Input
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new gamepad configuration source from a hat
|
||||
/// </summary>
|
||||
/// <param name="hat">The hat</param>
|
||||
/// <param name="pos">The starting hat position</param>
|
||||
public GamePadConfigurationSource(JoystickHat hat, HatPosition pos)
|
||||
: this()
|
||||
{
|
||||
|
@ -61,24 +69,36 @@ namespace OpenTK.Input
|
|||
|
||||
public ConfigurationType Type { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents a gamepad axis
|
||||
/// </summary>
|
||||
public int Axis
|
||||
{
|
||||
get { return map_axis.Value; }
|
||||
private set { map_axis = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a gamepad button
|
||||
/// </summary>
|
||||
public int Button
|
||||
{
|
||||
get { return map_button.Value; }
|
||||
private set { map_button = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a gamepad hat
|
||||
/// </summary>
|
||||
public JoystickHat Hat
|
||||
{
|
||||
get { return map_hat.Value; }
|
||||
private set { map_hat = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the position of a gamepad hat
|
||||
/// </summary>
|
||||
public HatPosition HatPosition
|
||||
{
|
||||
get { return map_hat_position.Value; }
|
||||
|
|
Loading…
Reference in a new issue