diff --git a/documentation/proposals/Proposal - Input.md b/documentation/proposals/Proposal - Input.md index a3207a597c..5cdb00bbe5 100644 --- a/documentation/proposals/Proposal - Input.md +++ b/documentation/proposals/Proposal - Input.md @@ -49,7 +49,7 @@ public interface IGamepad : IInputDevice event Action ButtonDown; event Action ButtonUp; event Action ThumbstickMoved; - event Action TriggerMoved; + event Action TriggerMoved; } ``` diff --git a/src/Input/Silk.NET.Input.Common/Axis.cs b/src/Input/Silk.NET.Input.Common/Axis.cs index 1a953e0647..960baf8a8f 100644 --- a/src/Input/Silk.NET.Input.Common/Axis.cs +++ b/src/Input/Silk.NET.Input.Common/Axis.cs @@ -5,11 +5,26 @@ namespace Silk.NET.Input.Common { + /// + /// Represents an axis on a joystick. + /// public struct Axis { + /// + /// The index of this axis, used to determine which axis it is. + /// public int Index { get; } + + /// + /// The position of this axis. + /// public float Position { get; } + /// + /// Creates a new instance of the Axis struct. + /// + /// The index of the new axis. + /// The position of the new axis. public Axis(int index, float position) { Index = index; diff --git a/src/Input/Silk.NET.Input.Common/Button.cs b/src/Input/Silk.NET.Input.Common/Button.cs index 45275c5080..88478a5de8 100644 --- a/src/Input/Silk.NET.Input.Common/Button.cs +++ b/src/Input/Silk.NET.Input.Common/Button.cs @@ -5,10 +5,24 @@ namespace Silk.NET.Input.Common { + /// + /// Represents a joystick button. + /// public struct Button { + /// + /// The name of this button. Only guaranteed to be valid if this comes from an . + /// public ButtonName Name { get; } + + /// + /// The index of this button. Use this if this button comes from an . + /// public int Index { get; } + + /// + /// Whether or not this button is currently pressed. + /// public bool Pressed { get; } public Button(ButtonName name, int index, bool pressed) diff --git a/src/Input/Silk.NET.Input.Common/Deadzone.cs b/src/Input/Silk.NET.Input.Common/Deadzone.cs index 9b0f1b57d0..e7b0fc39cf 100644 --- a/src/Input/Silk.NET.Input.Common/Deadzone.cs +++ b/src/Input/Silk.NET.Input.Common/Deadzone.cs @@ -5,11 +5,26 @@ namespace Silk.NET.Input.Common { + /// + /// The deadzone to use for a joystick/gamepad's sticks. + /// public struct Deadzone { + /// + /// The size of the deadzone to use. + /// public float Value { get; } + + /// + /// The deadzone method to use. + /// public DeadzoneMethod Method { get; } + /// + /// Creates a new instance of the Deadzone struct. + /// + /// The deadzone size. + /// The deadzone method. public Deadzone(float value, DeadzoneMethod method) { Value = value; diff --git a/src/Input/Silk.NET.Input.Common/Enums/ButtonName.cs b/src/Input/Silk.NET.Input.Common/Enums/ButtonName.cs index 39a7680dd2..481dac440e 100644 --- a/src/Input/Silk.NET.Input.Common/Enums/ButtonName.cs +++ b/src/Input/Silk.NET.Input.Common/Enums/ButtonName.cs @@ -5,6 +5,9 @@ namespace Silk.NET.Input.Common { + /// + /// The different names a can have. + /// public enum ButtonName { A, diff --git a/src/Input/Silk.NET.Input.Common/Enums/DeadzoneMethod.cs b/src/Input/Silk.NET.Input.Common/Enums/DeadzoneMethod.cs index cac6bfca41..005bdacff1 100644 --- a/src/Input/Silk.NET.Input.Common/Enums/DeadzoneMethod.cs +++ b/src/Input/Silk.NET.Input.Common/Enums/DeadzoneMethod.cs @@ -5,11 +5,36 @@ namespace Silk.NET.Input.Common { + /// + /// Available methods to control the deadzone of a control stick. + /// public enum DeadzoneMethod { - // y = x except where |x| is between 0 and d (the deadzone value) + /// + /// The traditional deadzone method, where the reported value is directly proportional with the actual value until the actual value is within the deadzone - the reported value will be 0 in this case. + /// + /// + /// + /// y = x except where |x| is between 0 and d + /// + /// + /// y is the output, x is the raw value, and d is the deadzone value. + /// + /// Traditional, - // y = (1 - d)x + (d * sgn(x)) + + /// + /// A deadzone method where the reported value adapts to the range of the deadzone. If the value is within the deadzone, the reported value is 0. + /// After exiting the deadzone, the reported value increases from 0 (when the actual value first exits the deadzone) to 1 (when the actual value is 1). + /// + /// + /// + /// y = (1 - d)x + (d * sgn(x)) + /// + /// + /// y is the output, x is the raw value, and d is the deadzone value. + /// + /// AdaptiveGradient } -} \ No newline at end of file +} diff --git a/src/Input/Silk.NET.Input.Common/Enums/Key.cs b/src/Input/Silk.NET.Input.Common/Enums/Key.cs index 1f4840d6c1..ca0c8f9a6a 100644 --- a/src/Input/Silk.NET.Input.Common/Enums/Key.cs +++ b/src/Input/Silk.NET.Input.Common/Enums/Key.cs @@ -5,6 +5,14 @@ namespace Silk.NET.Input.Common { + /// + /// Represents the keys on a keyboard. + /// + /// + /// + /// When using some backends, only a certain number of function keys may be available. For example, if the backend only supports up to F12, events regarding F13 through F35 will never be raised. + /// + /// public enum Key { Unknown = 0, @@ -155,4 +163,4 @@ public enum Key NonUSBackSlash, LastKey } -} \ No newline at end of file +} diff --git a/src/Input/Silk.NET.Input.Common/Enums/MouseButton.cs b/src/Input/Silk.NET.Input.Common/Enums/MouseButton.cs index e20ef5870f..3041befcad 100644 --- a/src/Input/Silk.NET.Input.Common/Enums/MouseButton.cs +++ b/src/Input/Silk.NET.Input.Common/Enums/MouseButton.cs @@ -5,6 +5,14 @@ namespace Silk.NET.Input.Common { + /// + /// Represents the indices of the mouse buttons. + /// + /// + /// + /// The number of buttons provided depends on the input backend currently being used. + /// + /// public enum MouseButton { Left, diff --git a/src/Input/Silk.NET.Input.Common/Enums/Position2D.cs b/src/Input/Silk.NET.Input.Common/Enums/Position2D.cs index 1a8d6e0da0..2e82a5ea99 100644 --- a/src/Input/Silk.NET.Input.Common/Enums/Position2D.cs +++ b/src/Input/Silk.NET.Input.Common/Enums/Position2D.cs @@ -7,13 +7,16 @@ namespace Silk.NET.Input.Common { + /// + /// Represents the position of a joystick + /// [Flags] public enum Position2D { - Up, - Down, - Left, - Right, + Up = 1, + Down = 2, + Left = 4, + Right = 8, UpLeft = Up | Left, UpRight = Up | Right, diff --git a/src/Input/Silk.NET.Input.Common/Hat.cs b/src/Input/Silk.NET.Input.Common/Hat.cs index a33676802d..0af7b7bc3a 100644 --- a/src/Input/Silk.NET.Input.Common/Hat.cs +++ b/src/Input/Silk.NET.Input.Common/Hat.cs @@ -5,11 +5,26 @@ namespace Silk.NET.Input.Common { + /// + /// Represents a joystick hat. + /// public struct Hat { + /// + /// The index of this hat. + /// public int Index { get; } + + /// + /// The position of this hat. + /// public Position2D Position { get; } + /// + /// Creates a new instance of the Hat struct. + /// + /// The index of the hat. + /// The position of the hat. public Hat(int index, Position2D position) { Index = index; diff --git a/src/Input/Silk.NET.Input.Common/Interfaces/IGamepad.cs b/src/Input/Silk.NET.Input.Common/Interfaces/IGamepad.cs index e798a64f82..e546fc4171 100644 --- a/src/Input/Silk.NET.Input.Common/Interfaces/IGamepad.cs +++ b/src/Input/Silk.NET.Input.Common/Interfaces/IGamepad.cs @@ -8,15 +8,55 @@ namespace Silk.NET.Input.Common { + /// + /// Represents a gamepad/controller with a set amount of thumbsticks, buttons, and triggers. + /// public interface IGamepad : IInputDevice { + /// + /// A list of all available buttons. + /// IReadOnlyCollection