mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-07-04 00:18:46 +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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace OpenTK.Input
|
namespace OpenTK.Input
|
||||||
{
|
{
|
||||||
|
@ -53,9 +51,13 @@ namespace OpenTK.Input
|
||||||
return configuration_items.GetEnumerator();
|
return configuration_items.GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parses a GamePad configuration string. The string
|
/// <summary>
|
||||||
// follows the rules for SDL2 GameController, outlined here:
|
/// Parses a GamePad configuration string.
|
||||||
// http://wiki.libsdl.org/SDL_GameControllerAddMapping
|
/// 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)
|
void ParseConfiguration(string configuration)
|
||||||
{
|
{
|
||||||
if (String.IsNullOrEmpty(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)
|
static GamePadConfigurationTarget ParseTarget(string target)
|
||||||
{
|
{
|
||||||
switch (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)
|
static GamePadConfigurationSource ParseSource(string item)
|
||||||
{
|
{
|
||||||
if (String.IsNullOrEmpty(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)
|
static int ParseAxis(string item)
|
||||||
{
|
{
|
||||||
// item is in the format "a#" where # a zero-based integer number
|
// item is in the format "a#" where # a zero-based integer number
|
||||||
|
@ -180,17 +198,28 @@ namespace OpenTK.Input
|
||||||
return axis + id;
|
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)
|
static int ParseButton(string item)
|
||||||
{
|
{
|
||||||
// item is in the format "b#" where # a zero-based integer number
|
// item is in the format "b#" where # a zero-based integer number
|
||||||
return Int32.Parse(item.Substring(1));
|
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)
|
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;
|
JoystickHat hat = JoystickHat.Hat0;
|
||||||
int id = Int32.Parse(item.Substring(1, 1));
|
int id = Int32.Parse(item.Substring(1, 1));
|
||||||
int pos = Int32.Parse(item.Substring(3));
|
int pos = Int32.Parse(item.Substring(3));
|
||||||
|
|
|
@ -25,8 +25,6 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
//
|
//
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace OpenTK.Input
|
namespace OpenTK.Input
|
||||||
{
|
{
|
||||||
struct GamePadConfigurationSource
|
struct GamePadConfigurationSource
|
||||||
|
@ -36,6 +34,11 @@ namespace OpenTK.Input
|
||||||
JoystickHat? map_hat;
|
JoystickHat? map_hat;
|
||||||
HatPosition? map_hat_position;
|
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)
|
public GamePadConfigurationSource(bool isAxis, int index)
|
||||||
: this()
|
: 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)
|
public GamePadConfigurationSource(JoystickHat hat, HatPosition pos)
|
||||||
: this()
|
: this()
|
||||||
{
|
{
|
||||||
|
@ -61,24 +69,36 @@ namespace OpenTK.Input
|
||||||
|
|
||||||
public ConfigurationType Type { get; private set; }
|
public ConfigurationType Type { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a gamepad axis
|
||||||
|
/// </summary>
|
||||||
public int Axis
|
public int Axis
|
||||||
{
|
{
|
||||||
get { return map_axis.Value; }
|
get { return map_axis.Value; }
|
||||||
private set { map_axis = value; }
|
private set { map_axis = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a gamepad button
|
||||||
|
/// </summary>
|
||||||
public int Button
|
public int Button
|
||||||
{
|
{
|
||||||
get { return map_button.Value; }
|
get { return map_button.Value; }
|
||||||
private set { map_button = value; }
|
private set { map_button = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a gamepad hat
|
||||||
|
/// </summary>
|
||||||
public JoystickHat Hat
|
public JoystickHat Hat
|
||||||
{
|
{
|
||||||
get { return map_hat.Value; }
|
get { return map_hat.Value; }
|
||||||
private set { map_hat = value; }
|
private set { map_hat = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents the position of a gamepad hat
|
||||||
|
/// </summary>
|
||||||
public HatPosition HatPosition
|
public HatPosition HatPosition
|
||||||
{
|
{
|
||||||
get { return map_hat_position.Value; }
|
get { return map_hat_position.Value; }
|
||||||
|
|
Loading…
Reference in a new issue