From ab90e2c890bf16674e0f5699729f114877a6f7a4 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 19 Feb 2020 23:28:37 -0500 Subject: rename InputStatus to SButtonState for consistency --- src/SMAPI/SButtonState.cs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/SMAPI/SButtonState.cs (limited to 'src/SMAPI/SButtonState.cs') diff --git a/src/SMAPI/SButtonState.cs b/src/SMAPI/SButtonState.cs new file mode 100644 index 00000000..2b78da27 --- /dev/null +++ b/src/SMAPI/SButtonState.cs @@ -0,0 +1,29 @@ +namespace StardewModdingAPI +{ + /// The input state for a button during an update frame. + public enum SButtonState + { + /// The button was neither pressed, held, nor released. + None, + + /// The button was pressed in this frame. + Pressed, + + /// The button has been held since the last frame. + Held, + + /// The button was released in this frame. + Released + } + + /// Extension methods for . + internal static class InputStatusExtensions + { + /// Whether the button was pressed or held. + /// The button state. + public static bool IsDown(this SButtonState state) + { + return state == SButtonState.Held || state == SButtonState.Pressed; + } + } +} -- cgit