diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-02-22 12:03:39 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-02-22 12:03:39 -0500 |
commit | 66079f2253a0c81bb33c1fee848a6cd2222d43d9 (patch) | |
tree | ca5fdd5f27c24f8d90665cb369e50f4580ce24fc /src/SMAPI/SButtonState.cs | |
parent | c8d627cdf2ae3126584ec2500877ff19987db17f (diff) | |
parent | 585b23797e262073e0738069eff61e90819216b7 (diff) | |
download | SMAPI-66079f2253a0c81bb33c1fee848a6cd2222d43d9.tar.gz SMAPI-66079f2253a0c81bb33c1fee848a6cd2222d43d9.tar.bz2 SMAPI-66079f2253a0c81bb33c1fee848a6cd2222d43d9.zip |
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/SButtonState.cs')
-rw-r--r-- | src/SMAPI/SButtonState.cs | 29 |
1 files changed, 29 insertions, 0 deletions
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 +{ + /// <summary>The input state for a button during an update frame.</summary> + public enum SButtonState + { + /// <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="SButtonState"/>.</summary> + internal static class InputStatusExtensions + { + /// <summary>Whether the button was pressed or held.</summary> + /// <param name="state">The button state.</param> + public static bool IsDown(this SButtonState state) + { + return state == SButtonState.Held || state == SButtonState.Pressed; + } + } +} |