Changes

Jump to navigation Jump to search
→‎Check button state: + SButtonState
Line 66: Line 66:  
bool isShiftPressed = this.Helper.Input.IsDown(SButton.LeftShift) || this.Helper.Input.IsDown(SButton.RightShift);
 
bool isShiftPressed = this.Helper.Input.IsDown(SButton.LeftShift) || this.Helper.Input.IsDown(SButton.RightShift);
 
</source>
 
</source>
 +
 +
{{SMAPI upcoming|3.3|content=For more finetuned control, you can check the button state relative to the previous game tick:
 +
<source lang="c#">
 +
SButtonState state = this.Helper.Input.GetState(SButton.LeftShift);
 +
bool isDown = (state == SButtonState.Pressed || state == SButtonState.Held);
 +
</source>
 +
Available button states:
 +
{{{!}} class="wikitable"
 +
{{!}}-
 +
! previous tick
 +
! current tick
 +
! resulting state
 +
{{!}}-
 +
{{!}} ☐ up
 +
{{!}} ☐ up
 +
{{!}} <tt>None</tt>
 +
{{!}}-
 +
{{!}} ☐ up
 +
{{!}} ☑ down
 +
{{!}} <tt>Pressed</tt>
 +
{{!}}-
 +
{{!}} ☑ down
 +
{{!}} ☑ down
 +
{{!}} <tt>Held</tt>
 +
{{!}}-
 +
{{!}} ☑ down
 +
{{!}} ☐ up
 +
{{!}} <tt>Released</tt>
 +
{{!}}}
 +
}}
    
===Check cursor position===
 
===Check cursor position===
translators
8,403

edits

Navigation menu