Even more documentation.

This commit is contained in:
2019-01-14 01:26:46 -06:00
parent 40c7772559
commit b019b7cf10
16 changed files with 368 additions and 46 deletions

View File

@@ -4,8 +4,14 @@ using System.Collections.Generic;
namespace RecrownedAthenaeum.Input
{
/// <summary>
/// Utilities to better manage input for the game.
/// </summary>
public static class InputUtilities
{
/// <summary>
/// Listeners for changes in input.
/// </summary>
public static List<IInputListener> InputListeners;
static KeyboardState keyboardState;
static MouseState mouseState;
@@ -15,6 +21,10 @@ namespace RecrownedAthenaeum.Input
InputListeners = new List<IInputListener>();
}
/// <summary>
/// Updates inputs.
/// Should be called once every game update to be up to date with new states of inputs.
/// </summary>
public static void Update()
{
KeyboardState updatedKeyboardState = Keyboard.GetState();
@@ -40,6 +50,10 @@ namespace RecrownedAthenaeum.Input
UpdateStates();
}
/// <summary>
/// Poll used to check if mouse was clicked.
/// </summary>
/// <returns>True if clicked.</returns>
public static bool MouseClicked()
{
if (mouseState.LeftButton == ButtonState.Pressed)
@@ -55,6 +69,11 @@ namespace RecrownedAthenaeum.Input
mouseState = Mouse.GetState();
}
/// <summary>
/// Checks whether mouse is within boundaries.
/// </summary>
/// <param name="bounds">Boundaries to check.</param>
/// <returns></returns>
public static bool MouseWithinBoundries(Rectangle bounds)
{
MouseState mouseState = Mouse.GetState();