Line 261: |
Line 261: |
| SMAPI 3.0 will introduce a new event system that's much more powerful, flexible, and consistent. You can try these events now in SMAPI 2.6+, but '''these are preview prototypes and may change at any time'''. See [[Modding:Migrate to SMAPI 3.0]] for details. | | SMAPI 3.0 will introduce a new event system that's much more powerful, flexible, and consistent. You can try these events now in SMAPI 2.6+, but '''these are preview prototypes and may change at any time'''. See [[Modding:Migrate to SMAPI 3.0]] for details. |
| | | |
− | ''TODO'' | + | ===Input=== |
| + | <tt>this.Helper.Events.Input</tt> has events raised when the player uses a controller, keyboard, or mouse in some way. Can be used with the [[../Input|input API]] to access more info or suppress input. |
| + | |
| + | <table class="wikitable"> |
| + | <tr> |
| + | <th>event</th> |
| + | <th>summary</th> |
| + | </tr> |
| + | <tr> |
| + | <td>ButtonPressed<br />ButtonReleased</td> |
| + | <td>Raised after the player pressed/released a keyboard, mouse, or controller button. This includes mouse clicks. |
| + | |
| + | Event arguments: |
| + | * <tt>e.Button</tt>: the button pressed or released, as [[Modding:Modder Guide/APIs/Input#SButton|an <tt>SButton</tt> constant]]. |
| + | * <tt>e.Cursor</tt>: the [[Modding:Modder Guide/APIs/Input#Check cursor position|cursor position and grab tile]]. |
| + | * <tt>e.IsDown</tt>: a method which indicates whether a given button is currently pressed. |
| + | * <tt>e.IsSuppressed</tt>: a method which indicates whether a given button was suppressed by a mod, so the game itself won't see it. |
| + | |
| + | '''Note:''' mods won't receive input sent to the chatbox. |
| + | </tr> |
| + | <tr> |
| + | <td>CursorMoved</td> |
| + | <td>Raised after the player moves the in-game cursor. |
| + | |
| + | Event arguments: |
| + | * <tt>e.OldPosition</tt>: the previous [[Modding:Modder Guide/APIs/Input#Check cursor position|cursor position and grab tile]]. |
| + | * <tt>e.NewPosition</tt>: the current [[Modding:Modder Guide/APIs/Input#Check cursor position|cursor position and grab tile]]. |
| + | </td> |
| + | </tr> |
| + | <tr> |
| + | <td>MouseWheelScrolled</td> |
| + | <td>Raised after the player scrolls the mouse wheel. |
| + | |
| + | Event arguments: |
| + | * <tt>e.Position</tt>: the current [[Modding:Modder Guide/APIs/Input#Check cursor position|cursor position and grab tile]]. |
| + | * <tt>e.Delta</tt>: the amount by which the mouse wheel was scrolled since the last update. |
| + | * <tt>e.OldValue</tt> and <tt>e.NewValue</tt>: the previous and current scroll value, cumulative since the game started. Mods should generally use <tt>e.Delta</tt> instead. |
| + | </td> |
| + | </tr> |
| + | </table> |
| | | |
| {{modding guide footer | | {{modding guide footer |