From 801249081b822132b25a726ebcd155211352c582 Mon Sep 17 00:00:00 2001
From: Maniekko <157877453+Maniekko@users.noreply.github.com>
Date: Thu, 21 Mar 2024 11:33:00 +0300
Subject: [PATCH] Adds XML documentation to the Input namespace
---
MonoGame.Framework/Input/GamePadButtons.cs | 7 ++-
MonoGame.Framework/Input/GamePadDPad.cs | 5 +-
.../Input/GamePadThumbSticks.cs | 6 ++
MonoGame.Framework/Input/KeyboardInput.cs | 6 ++
MonoGame.Framework/Input/MessageBox.cs | 8 ++-
MonoGame.Framework/Input/MouseCursor.cs | 6 +-
.../Input/Touch/TouchLocation.cs | 62 ++++++++++++++++---
MonoGame.Framework/Input/Touch/TouchPanel.cs | 25 ++++++--
.../Input/Touch/TouchPanelCapabilities.cs | 7 ++-
.../Input/Touch/TouchPanelState.cs | 13 ++++
.../Platform/Input/GamePad.SDL.cs | 3 +
11 files changed, 128 insertions(+), 20 deletions(-)
diff --git a/MonoGame.Framework/Input/GamePadButtons.cs b/MonoGame.Framework/Input/GamePadButtons.cs
index 63f3239d490..dd8383d9930 100644
--- a/MonoGame.Framework/Input/GamePadButtons.cs
+++ b/MonoGame.Framework/Input/GamePadButtons.cs
@@ -142,7 +142,12 @@ public ButtonState BigButton
return ((_buttons & Buttons.BigButton) == Buttons.BigButton) ? ButtonState.Pressed : ButtonState.Released;
}
}
-
+
+ ///
+ /// Initializes a new instance of the structure,
+ /// setting the specified buttons to pressed in.
+ ///
+ /// Buttons to be set as pressed in.
public GamePadButtons(Buttons buttons)
{
_buttons = buttons;
diff --git a/MonoGame.Framework/Input/GamePadDPad.cs b/MonoGame.Framework/Input/GamePadDPad.cs
index 5c1c2138ba6..d5137d6c59a 100644
--- a/MonoGame.Framework/Input/GamePadDPad.cs
+++ b/MonoGame.Framework/Input/GamePadDPad.cs
@@ -3,7 +3,10 @@
// file 'LICENSE.txt', which is part of this source code package.
namespace Microsoft.Xna.Framework.Input
-{
+{
+ ///
+ /// A struct that represents which directions on the directional pad of a controller are being pressed.
+ ///
public struct GamePadDPad
{
///
diff --git a/MonoGame.Framework/Input/GamePadThumbSticks.cs b/MonoGame.Framework/Input/GamePadThumbSticks.cs
index f577b7c7066..27e8972a752 100644
--- a/MonoGame.Framework/Input/GamePadThumbSticks.cs
+++ b/MonoGame.Framework/Input/GamePadThumbSticks.cs
@@ -42,6 +42,12 @@ public Vector2 Right
get { return _right; }
}
+ ///
+ /// Initializes a new instance of the struct,
+ /// setting positions of the sticks.
+ ///
+ /// Position of the left controller stick.
+ /// Position of the right controller stick.
public GamePadThumbSticks(Vector2 leftPosition, Vector2 rightPosition)
: this(leftPosition, rightPosition, GamePadDeadZone.None, GamePadDeadZone.None)
{
diff --git a/MonoGame.Framework/Input/KeyboardInput.cs b/MonoGame.Framework/Input/KeyboardInput.cs
index 080151ad719..77d6c733675 100644
--- a/MonoGame.Framework/Input/KeyboardInput.cs
+++ b/MonoGame.Framework/Input/KeyboardInput.cs
@@ -3,8 +3,14 @@
namespace Microsoft.Xna.Framework.Input
{
+ ///
+ /// Provides access to the keyboard input user interface.
+ ///
public static partial class KeyboardInput
{
+ ///
+ /// Determines if a keyboard user interface screen is active.
+ ///
public static bool IsVisible { get; private set; }
///
diff --git a/MonoGame.Framework/Input/MessageBox.cs b/MonoGame.Framework/Input/MessageBox.cs
index ab816ce6a4e..5e89ff47b67 100644
--- a/MonoGame.Framework/Input/MessageBox.cs
+++ b/MonoGame.Framework/Input/MessageBox.cs
@@ -5,8 +5,14 @@
namespace Microsoft.Xna.Framework.Input
{
+ ///
+ /// Provides access to the message box user interface.
+ ///
public static partial class MessageBox
{
+ ///
+ /// Determines if a message box user interface screen is active.
+ ///
public static bool IsVisible { get; private set; }
///
@@ -60,4 +66,4 @@ public static void Cancel(int? result)
PlatformCancel(result);
}
}
-}
\ No newline at end of file
+}
diff --git a/MonoGame.Framework/Input/MouseCursor.cs b/MonoGame.Framework/Input/MouseCursor.cs
index ad4bcdc6afe..b2ae3a069f7 100644
--- a/MonoGame.Framework/Input/MouseCursor.cs
+++ b/MonoGame.Framework/Input/MouseCursor.cs
@@ -86,6 +86,9 @@ public static MouseCursor FromTexture2D(Texture2D texture, int originx, int orig
return PlatformFromTexture2D(texture, originx, originy);
}
+ ///
+ /// Gets a handle for this cursor.
+ ///
public IntPtr Handle { get; private set; }
private bool _disposed;
@@ -100,6 +103,7 @@ private MouseCursor(IntPtr handle)
Handle = handle;
}
+ ///
public void Dispose()
{
if (_disposed)
@@ -109,4 +113,4 @@ public void Dispose()
_disposed = true;
}
}
-}
\ No newline at end of file
+}
diff --git a/MonoGame.Framework/Input/Touch/TouchLocation.cs b/MonoGame.Framework/Input/Touch/TouchLocation.cs
index ddbef2a8827..96ffd88f473 100644
--- a/MonoGame.Framework/Input/Touch/TouchLocation.cs
+++ b/MonoGame.Framework/Input/Touch/TouchLocation.cs
@@ -10,6 +10,9 @@
namespace Microsoft.Xna.Framework.Input.Touch
{
+ ///
+ /// Provides methods and properties for interacting with a touch location on a touch screen device.
+ ///
public struct TouchLocation : IEquatable
{
///
@@ -67,6 +70,9 @@ internal Vector2 Velocity
get { return _velocity; }
}
+ ///
+ /// Gets the ID of the touch location.
+ ///
public int Id
{
get
@@ -75,6 +81,9 @@ public int Id
}
}
+ ///
+ /// Gets the position of the touch location.
+ ///
public Vector2 Position
{
get
@@ -82,7 +91,11 @@ public Vector2 Position
return _position;
}
}
-
+
+ ///
+ /// Gets the pressure of the touch location.
+ ///
+ /// Only used in Android devices
public float Pressure
{
get
@@ -90,7 +103,10 @@ public float Pressure
return _pressure;
}
}
-
+
+ ///
+ /// Gets the current state of the touch location.
+ ///
public TouchLocationState State
{
get
@@ -98,17 +114,26 @@ public TouchLocationState State
return _state;
}
}
-
- #endregion
-
- #region Constructors
+ #endregion
+
+ #region Constructors
+
+ ///
public TouchLocation(int id, TouchLocationState state, Vector2 position)
: this(id, state, position, TouchLocationState.Invalid, Vector2.Zero)
{
}
- public TouchLocation( int id, TouchLocationState state, Vector2 position,
+ ///
+ /// Initializes a new instance of the structure.
+ ///
+ /// ID of the touch location.
+ /// Current state of the touch location.
+ /// Position of the touch location.
+ /// Previous state of this touch location.
+ /// Previous position of this touch location.
+ public TouchLocation(int id, TouchLocationState state, Vector2 position,
TouchLocationState previousState, Vector2 previousPosition)
: this(id, state, position, previousState, previousPosition, TimeSpan.Zero, false)
{
@@ -234,6 +259,7 @@ public bool IsHighFrequencyEvent()
return _isHighFrequency;
}
+ ///
public override bool Equals(object obj)
{
if (obj is TouchLocation)
@@ -242,6 +268,7 @@ public override bool Equals(object obj)
return false;
}
+ ///
public bool Equals(TouchLocation other)
{
return _id.Equals(other._id) &&
@@ -250,17 +277,24 @@ public bool Equals(TouchLocation other)
}
-
+ ///
public override int GetHashCode()
{
return _id;
}
+ ///
+ /// Gets a string representation of the .
+ ///
public override string ToString()
{
return "Touch id:"+_id+" state:"+_state + " position:" + _position + " pressure:" + _pressure +" prevState:"+_previousState+" prevPosition:"+ _previousPosition + " previousPressure:" + _previousPressure;
}
+ ///
+ /// Attempts to get the previous location of this touch location object.
+ ///
+ /// Previous location data, as a .
public bool TryGetPreviousLocation(out TouchLocation aPreviousLocation)
{
if (_previousState == TouchLocationState.Invalid)
@@ -297,6 +331,12 @@ public bool TryGetPreviousLocation(out TouchLocation aPreviousLocation)
return true;
}
+ ///
+ /// Returns a value that indicates whether the two values are not equal.
+ ///
+ /// The value on the left of the inequality operator.
+ /// The value on the right of the inequality operator.
+ /// if the two values are not equal; otherwise, .
public static bool operator !=(TouchLocation value1, TouchLocation value2)
{
return value1._id != value2._id ||
@@ -306,6 +346,12 @@ public bool TryGetPreviousLocation(out TouchLocation aPreviousLocation)
value1._previousPosition != value2._previousPosition;
}
+ ///
+ /// Returns a value that indicates whether the two values are equal.
+ ///
+ /// The value on the left of the equality operator.
+ /// The value on the right of the equality operator.
+ /// if the two values are equal; otherwise, .
public static bool operator ==(TouchLocation value1, TouchLocation value2)
{
return value1._id == value2._id &&
diff --git a/MonoGame.Framework/Input/Touch/TouchPanel.cs b/MonoGame.Framework/Input/Touch/TouchPanel.cs
index 9c1f2a34a3c..86751eb15e6 100644
--- a/MonoGame.Framework/Input/Touch/TouchPanel.cs
+++ b/MonoGame.Framework/Input/Touch/TouchPanel.cs
@@ -21,12 +21,19 @@ public static TouchCollection GetState()
{
return PrimaryWindow.TouchPanelState.GetState();
}
-
+
+ ///
+ /// Gets the current state of the touch panel.
+ ///
+ /// Game windows to get state from
public static TouchPanelState GetState(GameWindow window)
{
return window.TouchPanelState;
}
-
+
+ ///
+ /// Gets the touch panel capabilities for an available device.
+ ///
public static TouchPanelCapabilities GetCapabilities()
{
return PrimaryWindow.TouchPanelState.GetCapabilities();
@@ -101,13 +108,19 @@ public static GestureType EnabledGestures
get { return PrimaryWindow.TouchPanelState.EnabledGestures; }
set { PrimaryWindow.TouchPanelState.EnabledGestures = value; }
}
-
+
+ ///
+ /// Gets or sets a value indicating whether to enable the mouse touch point.
+ ///
public static bool EnableMouseTouchPoint
{
get { return PrimaryWindow.TouchPanelState.EnableMouseTouchPoint; }
set { PrimaryWindow.TouchPanelState.EnableMouseTouchPoint = value; }
- }
-
+ }
+
+ ///
+ /// Gets or sets a value indicating whether to enable mouse gestures.
+ ///
public static bool EnableMouseGestures
{
get { return PrimaryWindow.TouchPanelState.EnableMouseGestures; }
@@ -132,4 +145,4 @@ public static bool EnableHighFrequencyTouch
set { PrimaryWindow.TouchPanelState.EnableHighFrequencyTouch = value; }
}
}
-}
\ No newline at end of file
+}
diff --git a/MonoGame.Framework/Input/Touch/TouchPanelCapabilities.cs b/MonoGame.Framework/Input/Touch/TouchPanelCapabilities.cs
index ec852304f0f..51cccbbaca3 100644
--- a/MonoGame.Framework/Input/Touch/TouchPanelCapabilities.cs
+++ b/MonoGame.Framework/Input/Touch/TouchPanelCapabilities.cs
@@ -71,7 +71,10 @@ internal void Initialize()
#endif
}
}
-
+
+ ///
+ /// Returns if a touch device supports pressure.
+ ///
public bool HasPressure
{
get
@@ -109,4 +112,4 @@ public int MaximumTouchCount
const int SM_MAXIMUMTOUCHES = 95;
#endif
}
-}
\ No newline at end of file
+}
diff --git a/MonoGame.Framework/Input/Touch/TouchPanelState.cs b/MonoGame.Framework/Input/Touch/TouchPanelState.cs
index c77fb17d133..a3b1e5bc2fc 100644
--- a/MonoGame.Framework/Input/Touch/TouchPanelState.cs
+++ b/MonoGame.Framework/Input/Touch/TouchPanelState.cs
@@ -7,6 +7,10 @@
namespace Microsoft.Xna.Framework.Input.Touch
{
+ ///
+ /// Represents specific information about the state of the touch panel,
+ /// including the current state of touch locations and gestures.
+ ///
public class TouchPanelState
{
///
@@ -141,6 +145,9 @@ private void ApplyTouch(List state, TouchLocation touch)
}
}
+ ///
+ /// Returns the current touch panel state
+ ///
public TouchCollection GetState()
{
//Clear out touches from previous frames that were released on the same frame they were touched that haven't been seen
@@ -331,8 +338,14 @@ public int DisplayWidth
///
public GestureType EnabledGestures { get; set; }
+ ///
+ /// Gets or sets whether mouse touch points are enabled.
+ ///
public bool EnableMouseTouchPoint { get; set; }
+ ///
+ /// Gets or sets whether mouse gestures are enabled.
+ ///
public bool EnableMouseGestures { get; set; }
///
diff --git a/MonoGame.Framework/Platform/Input/GamePad.SDL.cs b/MonoGame.Framework/Platform/Input/GamePad.SDL.cs
index 7ea1d9e58e8..942a697fd7c 100644
--- a/MonoGame.Framework/Platform/Input/GamePad.SDL.cs
+++ b/MonoGame.Framework/Platform/Input/GamePad.SDL.cs
@@ -20,6 +20,9 @@ private class GamePadInfo
private static readonly Dictionary Gamepads = new Dictionary();
private static readonly Dictionary _translationTable = new Dictionary();
+ ///
+ /// Initialies the internal database of gamepad mappings for an SDL context
+ ///
public static void InitDatabase()
{
using (var stream = ReflectionHelpers.GetAssembly(typeof(GamePad)).GetManifestResourceStream("gamecontrollerdb.txt"))