using StardewModdingAPI.Framework.Input;
namespace StardewModdingAPI.Framework.ModHelpers
{
/// Provides an API for checking and changing input state.
internal class InputHelper : BaseHelper, IInputHelper
{
/*********
** Accessors
*********/
/// Manages the game's input state.
private readonly SInputState InputState;
/*********
** Public methods
*********/
/// Construct an instance.
/// The unique ID of the relevant mod.
/// Manages the game's input state.
public InputHelper(string modID, SInputState inputState)
: base(modID)
{
this.InputState = inputState;
}
///
public ICursorPosition GetCursorPosition()
{
return this.InputState.CursorPosition;
}
///
public bool IsDown(SButton button)
{
return this.InputState.IsDown(button);
}
///
public bool IsSuppressed(SButton button)
{
return this.InputState.IsSuppressed(button);
}
///
public void Suppress(SButton button)
{
this.InputState.OverrideButton(button, setDown: false);
}
///
public SButtonState GetState(SButton button)
{
return this.InputState.GetState(button);
}
}
}