Changes

Jump to navigation Jump to search
→‎KeybindList: switch to ButtonsChanged event, add note about ButtonPressed
Line 142: Line 142:  
</source>
 
</source>
   −
And you can then check whether it's pressed directly in your code. For example, in a [[../Events|<tt>ButtonPressed</tt> event handler]]:
+
And you can then check whether it's pressed directly in your code. For example, in a [[../Events|<tt>ButtonsChanged</tt> event handler]]:
    
<source lang="c#">
 
<source lang="c#">
private void Input_ButtonPressed(object sender, ButtonPressedEventArgs e)
+
private void OnButtonsChanged(object sender, ButtonsChangedEventArgs e)
 
{
 
{
 
   if (this.Config.ToggleKey.JustPressed())
 
   if (this.Config.ToggleKey.JustPressed())
Line 185: Line 185:  
| Get a string representation of the input binding (e.g. <code>"F2, LeftShift + S"</code>).
 
| Get a string representation of the input binding (e.g. <code>"F2, LeftShift + S"</code>).
 
|}
 
|}
 +
 +
Caveats:
 +
* '''Don't use the <tt>ButtonPressed</tt> [[../Events|event]] to check keybinds''', since it's raised once for each button pressed. If the player presses two keys at once, your keybind would be activated twice. Use <tt>ButtonsChanged</tt> instead.
    
===ICursorPosition===
 
===ICursorPosition===
translators
8,437

edits

Navigation menu