Changes

Jump to navigation Jump to search
→‎Events (SMAPI 3.0): use layout template
Line 264: Line 264:  
<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.
 
<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">
+
{| class="wikitable"
<tr>
+
|-
<th>event</th>
+
! event
<th>summary</th>
+
! summary
</tr>
+
{{/event
<tr>
+
|name = ButtonPressed<br />ButtonReleased
<td>ButtonPressed<br />ButtonReleased</td>
+
|desc = Raised after the player pressed/released a keyboard, mouse, or controller button. This includes mouse clicks.
<td>Raised after the player pressed/released a keyboard, mouse, or controller button. This includes mouse clicks.
     −
Event arguments:
+
|arg name 1 = <tt>e.Button</tt>
* <tt>e.Button</tt>: the button pressed or released, as [[Modding:Modder Guide/APIs/Input#SButton|an <tt>SButton</tt> constant]].
+
|arg type 1 = [[Modding:Modder Guide/APIs/Input#SButton|<tt>SButton</tt>]]
* <tt>e.Cursor</tt>: the [[Modding:Modder Guide/APIs/Input#Check cursor position|cursor position and grab tile]].
+
|arg desc 1 = The button pressed or released.
* <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.
+
|arg name 2 = <tt>e.Cursor</tt>
 +
|arg type 2 = [[Modding:Modder Guide/APIs/Input#Check cursor position|<tt>ICursorPosition</tt>]]
 +
|arg desc 2 = The cursor position and grab tile.
 +
 
 +
|arg name 3 = <tt>e.IsDown</tt>
 +
|arg type 3 = ''method'' returns <tt>bool</tt>
 +
|arg desc 3 = Indicates whether a given button is currently pressed.
 +
 
 +
|arg name 4 = <tt>e.IsSuppressed</tt>
 +
|arg type 4 = ''method'' returns <tt>bool</tt>
 +
|arg desc 4 = 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.
 
'''Note:''' mods won't receive input sent to the chatbox.
</tr>
+
}}
<tr>
+
{{/event
<td>CursorMoved</td>
+
|name = CursorMoved
<td>Raised after the player moves the in-game cursor.
+
|desc = Raised after the player moves the in-game cursor.
 +
 
 +
|arg name 1 = <tt>e.OldPosition</tt>
 +
|arg type 1 = [[Modding:Modder Guide/APIs/Input#Check cursor position|ICursorPosition]]
 +
|arg desc 1 = The previous cursor position and grab tile.
 +
 
 +
|arg name 2 = <tt>e.NewPosition</tt>
 +
|arg type 2 = [[Modding:Modder Guide/APIs/Input#Check cursor position|ICursorPosition]]
 +
|arg desc 2 = The current cursor position and grab tile.
 +
}}
 +
{{/event
 +
|name = MouseWheelScrolled
 +
|desc = Raised after the player scrolls the mouse wheel.
 +
 
 +
|arg name 1 = <tt>e.Position</tt>
 +
|arg type 1 = [[Modding:Modder Guide/APIs/Input#Check cursor position|ICursorPosition]]
 +
|arg desc 1 = The current cursor position and grab tile.
   −
Event arguments:
+
|arg name 2 = <tt>e.Delta</tt>
* <tt>e.OldPosition</tt>: the previous [[Modding:Modder Guide/APIs/Input#Check cursor position|cursor position and grab tile]].
+
|arg type 2 = <tt>int</tt>
* <tt>e.NewPosition</tt>: the current [[Modding:Modder Guide/APIs/Input#Check cursor position|cursor position and grab tile]].
+
|arg desc 2 = The amount by which the mouse wheel was scrolled since the last update.
</td>
  −
</tr>
  −
<tr>
  −
<td>MouseWheelScrolled</td>
  −
<td>Raised after the player scrolls the mouse wheel.
     −
Event arguments:
+
|arg name 3 = <tt>e.OldValue</tt><br /><tt>e.NewValue</tt>
* <tt>e.Position</tt>: the current [[Modding:Modder Guide/APIs/Input#Check cursor position|cursor position and grab tile]].
+
|arg type 3 = <tt>int</tt>
* <tt>e.Delta</tt>: the amount by which the mouse wheel was scrolled since the last update.
+
|arg desc 3 = The previous and current scroll value, cumulative since the game started. Mods should generally use <tt>e.Delta</tt> instead.
* <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
translators
8,441

edits

Navigation menu