diff --git a/src/OpenTK/Input/GamePadConfiguration.cs b/src/OpenTK/Input/GamePadConfiguration.cs
index e2f35293..b82bcdfc 100644
--- a/src/OpenTK/Input/GamePadConfiguration.cs
+++ b/src/OpenTK/Input/GamePadConfiguration.cs
@@ -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
+ ///
+ /// Parses a GamePad configuration string.
+ /// This string must follow the rules for SDL2
+ /// GameController outlined here:
+ /// http://wiki.libsdl.org/SDL_GameControllerAddMapping
+ ///
+ ///
void ParseConfiguration(string configuration)
{
if (String.IsNullOrEmpty(configuration))
@@ -86,6 +88,11 @@ namespace OpenTK.Input
}
}
+ ///
+ /// Parses a gamepad configuration target string
+ ///
+ /// The string to parse
+ /// The configuration target (Button index, axis index etc.)
static GamePadConfigurationTarget ParseTarget(string target)
{
switch (target)
@@ -145,6 +152,11 @@ namespace OpenTK.Input
}
}
+ ///
+ /// Creates a new gamepad configuration source from the given string
+ ///
+ /// The string to parse
+ /// The new gamepad configuration source
static GamePadConfigurationSource ParseSource(string item)
{
if (String.IsNullOrEmpty(item))
@@ -172,6 +184,12 @@ namespace OpenTK.Input
}
}
+ ///
+ /// Parses a string in the format a#" where:
+ /// - # is a zero-based integer number
+ ///
+ /// The string to parse
+ /// The index of the axis
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;
}
+ ///
+ /// Parses a string in the format "b#" where:
+ /// - # is a zero-based integer number
+ ///
+ /// The string to parse
+ /// The index of the button
static int ParseButton(string item)
{
// item is in the format "b#" where # a zero-based integer number
return Int32.Parse(item.Substring(1));
}
+ ///
+ /// 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
+ ///
+ /// The string to parse
+ /// The hat position assigned via 'out'
+ /// The new joystick hat
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));
diff --git a/src/OpenTK/Input/GamePadConfigurationSource.cs b/src/OpenTK/Input/GamePadConfigurationSource.cs
index 19c1a4cd..3c45f625 100644
--- a/src/OpenTK/Input/GamePadConfigurationSource.cs
+++ b/src/OpenTK/Input/GamePadConfigurationSource.cs
@@ -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;
+ ///
+ /// Creates a new gamepad configuration source from an axis or a button
+ ///
+ /// Whether this source is an axis or a button
+ /// The index of this source
public GamePadConfigurationSource(bool isAxis, int index)
: this()
{
@@ -51,6 +54,11 @@ namespace OpenTK.Input
}
}
+ ///
+ /// Creates a new gamepad configuration source from a hat
+ ///
+ /// The hat
+ /// The starting hat position
public GamePadConfigurationSource(JoystickHat hat, HatPosition pos)
: this()
{
@@ -61,24 +69,36 @@ namespace OpenTK.Input
public ConfigurationType Type { get; private set; }
+ ///
+ /// Represents a gamepad axis
+ ///
public int Axis
{
get { return map_axis.Value; }
private set { map_axis = value; }
}
+ ///
+ /// Represents a gamepad button
+ ///
public int Button
{
get { return map_button.Value; }
private set { map_button = value; }
}
+ ///
+ /// Represents a gamepad hat
+ ///
public JoystickHat Hat
{
get { return map_hat.Value; }
private set { map_hat = value; }
}
+ ///
+ /// Represents the position of a gamepad hat
+ ///
public HatPosition HatPosition
{
get { return map_hat_position.Value; }