summaryrefslogtreecommitdiff
path: root/src/SMAPI/InputStatus.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI/InputStatus.cs')
-rw-r--r--src/SMAPI/InputStatus.cs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/SMAPI/InputStatus.cs b/src/SMAPI/InputStatus.cs
new file mode 100644
index 00000000..d9cdd6b2
--- /dev/null
+++ b/src/SMAPI/InputStatus.cs
@@ -0,0 +1,29 @@
+namespace StardewModdingAPI
+{
+ /// <summary>The input status for a button during an update frame.</summary>
+ public 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;
+ }
+ }
+}