From e80b7712f7e4c78a5b016289ca19efaf7d39cd8b Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 8 Mar 2020 14:53:41 -0400 Subject: encapsulate logic for each input type --- src/SMAPI/Framework/Input/IInputStateBuilder.cs | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/SMAPI/Framework/Input/IInputStateBuilder.cs (limited to 'src/SMAPI/Framework/Input/IInputStateBuilder.cs') 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 +{ + /// Manages input state. + /// The handler type. + /// The state type. + internal interface IInputStateBuilder + where TState : struct + where THandler : IInputStateBuilder + { + /********* + ** Methods + *********/ + /// Reset the tracked state. + /// The state from which to reset, or null to get the latest state. + THandler Reset(TState? state = null); + + /// Override the states for a set of buttons. + /// The button state overrides. + THandler OverrideButtons(IDictionary overrides); + + /// Get the currently pressed buttons. + IEnumerable GetPressedButtons(); + + /// Get the equivalent state. + TState GetState(); + } +} -- cgit