TopDown Engine  v3.6
MoreMountains.Tools.MMInput.IMButton Class Reference

IM button, short for InputManager button, a class used to handle button states, whether mobile or actual keys More...

Public Member Functions

delegate void ButtonDownMethodDelegate ()
 
delegate void ButtonPressedMethodDelegate ()
 
delegate void ButtonUpMethodDelegate ()
 
virtual bool ButtonDownRecently (float time)
 returns true if this button was pressed down within the time (in unscaled seconds) passed in parameters More...
 
virtual bool ButtonUpRecently (float time)
 returns true if this button was released within the time (in unscaled seconds) passed in parameters More...
 
 IMButton (string playerID, string buttonID, ButtonDownMethodDelegate btnDown=null, ButtonPressedMethodDelegate btnPressed=null, ButtonUpMethodDelegate btnUp=null)
 Constructor More...
 
virtual void TriggerButtonDown ()
 Presses the button for the first time, putting it in ButtonDown state More...
 
virtual void TriggerButtonPressed ()
 Puts the button in the Pressed state, potentially bypassing the Down state More...
 
virtual void TriggerButtonUp ()
 Puts the button in the Up state More...
 

Public Attributes

string ButtonID
 the unique ID of this button More...
 
ButtonDownMethodDelegate ButtonDownMethod
 
ButtonPressedMethodDelegate ButtonPressedMethod
 
ButtonUpMethodDelegate ButtonUpMethod
 
virtual bool IsPressed => State.CurrentState == MMInput.ButtonStates.ButtonPressed
 Returns true if the button is currently pressed More...
 
virtual bool IsDown => State.CurrentState == MMInput.ButtonStates.ButtonDown
 Returns true if the button is down this frame More...
 
virtual bool IsUp => State.CurrentState == MMInput.ButtonStates.ButtonUp
 Returns true if the button is up this frame More...
 
virtual bool IsOff => State.CurrentState == MMInput.ButtonStates.Off
 Returns true if the button is neither pressed, down or up this frame More...
 

Protected Attributes

float _lastButtonDownAt
 
float _lastButtonUpAt
 

Properties

MMStateMachine< MMInput.ButtonStatesState [get, protected set]
 a state machine used to store button states More...
 
virtual float TimeSinceLastButtonDown [get]
 returns the time (in unscaled seconds) since the last time the button was pressed down More...
 
virtual float TimeSinceLastButtonUp [get]
 returns the time (in unscaled seconds) since the last time the button was released More...
 

Detailed Description

IM button, short for InputManager button, a class used to handle button states, whether mobile or actual keys

Constructor & Destructor Documentation

◆ IMButton()

MoreMountains.Tools.MMInput.IMButton.IMButton ( string  playerID,
string  buttonID,
ButtonDownMethodDelegate  btnDown = null,
ButtonPressedMethodDelegate  btnPressed = null,
ButtonUpMethodDelegate  btnUp = null 
)

Constructor

Parameters
playerID
buttonID
btnDown
btnPressed
btnUp

Member Function Documentation

◆ ButtonDownMethodDelegate()

delegate void MoreMountains.Tools.MMInput.IMButton.ButtonDownMethodDelegate ( )

◆ ButtonDownRecently()

virtual bool MoreMountains.Tools.MMInput.IMButton.ButtonDownRecently ( float  time)
virtual

returns true if this button was pressed down within the time (in unscaled seconds) passed in parameters

◆ ButtonPressedMethodDelegate()

delegate void MoreMountains.Tools.MMInput.IMButton.ButtonPressedMethodDelegate ( )

◆ ButtonUpMethodDelegate()

delegate void MoreMountains.Tools.MMInput.IMButton.ButtonUpMethodDelegate ( )

◆ ButtonUpRecently()

virtual bool MoreMountains.Tools.MMInput.IMButton.ButtonUpRecently ( float  time)
virtual

returns true if this button was released within the time (in unscaled seconds) passed in parameters

◆ TriggerButtonDown()

virtual void MoreMountains.Tools.MMInput.IMButton.TriggerButtonDown ( )
virtual

Presses the button for the first time, putting it in ButtonDown state

◆ TriggerButtonPressed()

virtual void MoreMountains.Tools.MMInput.IMButton.TriggerButtonPressed ( )
virtual

Puts the button in the Pressed state, potentially bypassing the Down state

◆ TriggerButtonUp()

virtual void MoreMountains.Tools.MMInput.IMButton.TriggerButtonUp ( )
virtual

Puts the button in the Up state

Member Data Documentation

◆ _lastButtonDownAt

float MoreMountains.Tools.MMInput.IMButton._lastButtonDownAt
protected

◆ _lastButtonUpAt

float MoreMountains.Tools.MMInput.IMButton._lastButtonUpAt
protected

◆ ButtonDownMethod

ButtonDownMethodDelegate MoreMountains.Tools.MMInput.IMButton.ButtonDownMethod

◆ ButtonID

string MoreMountains.Tools.MMInput.IMButton.ButtonID

the unique ID of this button

◆ ButtonPressedMethod

ButtonPressedMethodDelegate MoreMountains.Tools.MMInput.IMButton.ButtonPressedMethod

◆ ButtonUpMethod

ButtonUpMethodDelegate MoreMountains.Tools.MMInput.IMButton.ButtonUpMethod

◆ IsDown

virtual bool MoreMountains.Tools.MMInput.IMButton.IsDown => State.CurrentState == MMInput.ButtonStates.ButtonDown

Returns true if the button is down this frame

◆ IsOff

virtual bool MoreMountains.Tools.MMInput.IMButton.IsOff => State.CurrentState == MMInput.ButtonStates.Off

Returns true if the button is neither pressed, down or up this frame

◆ IsPressed

virtual bool MoreMountains.Tools.MMInput.IMButton.IsPressed => State.CurrentState == MMInput.ButtonStates.ButtonPressed

Returns true if the button is currently pressed

◆ IsUp

virtual bool MoreMountains.Tools.MMInput.IMButton.IsUp => State.CurrentState == MMInput.ButtonStates.ButtonUp

Returns true if the button is up this frame

Property Documentation

◆ State

MMStateMachine<MMInput.ButtonStates> MoreMountains.Tools.MMInput.IMButton.State
getprotected set

a state machine used to store button states

◆ TimeSinceLastButtonDown

virtual float MoreMountains.Tools.MMInput.IMButton.TimeSinceLastButtonDown
get

returns the time (in unscaled seconds) since the last time the button was pressed down

◆ TimeSinceLastButtonUp

virtual float MoreMountains.Tools.MMInput.IMButton.TimeSinceLastButtonUp
get

returns the time (in unscaled seconds) since the last time the button was released


The documentation for this class was generated from the following file: