summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/Input/IInputStateBuilder.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-03-08 14:53:41 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-03-08 14:53:41 -0400
commite80b7712f7e4c78a5b016289ca19efaf7d39cd8b (patch)
tree5ca5277b1755504a1e95b655b16ff696114d26b8 /src/SMAPI/Framework/Input/IInputStateBuilder.cs
parente39b9e0d699079edfbcf8595d7499aff894578b6 (diff)
downloadSMAPI-e80b7712f7e4c78a5b016289ca19efaf7d39cd8b.tar.gz
SMAPI-e80b7712f7e4c78a5b016289ca19efaf7d39cd8b.tar.bz2
SMAPI-e80b7712f7e4c78a5b016289ca19efaf7d39cd8b.zip
encapsulate logic for each input type
Diffstat (limited to 'src/SMAPI/Framework/Input/IInputStateBuilder.cs')
-rw-r--r--src/SMAPI/Framework/Input/IInputStateBuilder.cs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/Input/IInputStateBuilder.cs b/src/SMAPI/Framework/Input/IInputStateBuilder.cs
new file mode 100644
index 00000000..193e5216
--- /dev/null
+++ b/src/SMAPI/Framework/Input/IInputStateBuilder.cs
@@ -0,0 +1,29 @@
+using System.Collections.Generic;
+
+namespace StardewModdingAPI.Framework.Input
+{
+ /// <summary>Manages input state.</summary>
+ /// <typeparam name="THandler">The handler type.</typeparam>
+ /// <typeparam name="TState">The state type.</typeparam>
+ internal interface IInputStateBuilder<out THandler, TState>
+ where TState : struct
+ where THandler : IInputStateBuilder<THandler, TState>
+ {
+ /*********
+ ** Methods
+ *********/
+ /// <summary>Reset the tracked state.</summary>
+ /// <param name="state">The state from which to reset, or <c>null</c> to get the latest state.</param>
+ THandler Reset(TState? state = null);
+
+ /// <summary>Override the states for a set of buttons.</summary>
+ /// <param name="overrides">The button state overrides.</param>
+ THandler OverrideButtons(IDictionary<SButton, SButtonState> overrides);
+
+ /// <summary>Get the currently pressed buttons.</summary>
+ IEnumerable<SButton> GetPressedButtons();
+
+ /// <summary>Get the equivalent state.</summary>
+ TState GetState();
+ }
+}