summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI/Framework')
-rw-r--r--src/SMAPI/Framework/Input/InputStatus.cs29
-rw-r--r--src/SMAPI/Framework/Input/SInputState.cs7
-rw-r--r--src/SMAPI/Framework/ModHelpers/InputHelper.cs7
3 files changed, 14 insertions, 29 deletions
diff --git a/src/SMAPI/Framework/Input/InputStatus.cs b/src/SMAPI/Framework/Input/InputStatus.cs
deleted file mode 100644
index 99b0006c..00000000
--- a/src/SMAPI/Framework/Input/InputStatus.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace StardewModdingAPI.Framework.Input
-{
- /// <summary>The input status for a button during an update frame.</summary>
- internal enum InputStatus
- {
- /// <summary>The button was neither pressed, held, nor released.</summary>
- None,
-
- /// <summary>The button was pressed in this frame.</summary>
- Pressed,
-
- /// <summary>The button has been held since the last frame.</summary>
- Held,
-
- /// <summary>The button was released in this frame.</summary>
- Released
- }
-
- /// <summary>Extension methods for <see cref="InputStatus"/>.</summary>
- internal static class InputStatusExtensions
- {
- /// <summary>Whether the button was pressed or held.</summary>
- /// <param name="status">The button status.</param>
- public static bool IsDown(this InputStatus status)
- {
- return status == InputStatus.Held || status == InputStatus.Pressed;
- }
- }
-}
diff --git a/src/SMAPI/Framework/Input/SInputState.cs b/src/SMAPI/Framework/Input/SInputState.cs
index 84cea36c..f54d3124 100644
--- a/src/SMAPI/Framework/Input/SInputState.cs
+++ b/src/SMAPI/Framework/Input/SInputState.cs
@@ -169,6 +169,13 @@ namespace StardewModdingAPI.Framework.Input
return buttons.Any(button => this.IsDown(button.ToSButton()));
}
+ /// <summary>Get the status of a button.</summary>
+ /// <param name="button">The button to check.</param>
+ public InputStatus GetStatus(SButton button)
+ {
+ return this.GetStatus(this.ActiveButtons, button);
+ }
+
/*********
** Private methods
diff --git a/src/SMAPI/Framework/ModHelpers/InputHelper.cs b/src/SMAPI/Framework/ModHelpers/InputHelper.cs
index f4cd12b6..5858cddd 100644
--- a/src/SMAPI/Framework/ModHelpers/InputHelper.cs
+++ b/src/SMAPI/Framework/ModHelpers/InputHelper.cs
@@ -50,5 +50,12 @@ namespace StardewModdingAPI.Framework.ModHelpers
{
this.InputState.SuppressButtons.Add(button);
}
+
+ /// <summary>Get the status of a button.</summary>
+ /// <param name="button">The button to check.</param>
+ public InputStatus GetStatus(SButton button)
+ {
+ return this.InputState.GetStatus(button);
+ }
}
}