Changes
Jump to navigation
Jump to search
← 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,403
edits
Navigation menu
Personal tools
Create account
Log in
Namespaces
Modding
Discussion
Variants
Views
Read
View source
View history
More
Search
Navigation
Main page
Recent changes
Admin noticeboard
Help Editing
Random page
Official Links
Official Site
Official Forums
Official Merchandise
Discord
Reddit
Tools
Upload file
Special pages
Printable version