Open main menu
Home
Random
Log in
Settings
About Stardew Valley Wiki
Disclaimers
Stardew Valley Wiki
Search
Changes
← Older edit
Newer edit →
Modding:Modder Guide/APIs/Input
(view source)
Revision as of 04:19, 20 February 2020
642 bytes added
,
04:19, 20 February 2020
→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===
Pathoschild
translators
8,437
edits