Class KeyHandler

java.lang.Object
com.realtime.crossfire.jxclient.window.KeyHandler

public class KeyHandler extends Object
Handles keyboard input processing.
  • Constructor Details

    • KeyHandler

      public KeyHandler(@Nullable @Nullable Writer debugKeyboard, @NotNull @NotNull KeybindingsManager keybindingsManager, @NotNull @NotNull CommandQueue commandQueue, @NotNull @NotNull JXCWindowRenderer windowRenderer, @NotNull @NotNull KeyHandlerListener keyHandlerListener)
      Creates a new instance.
      Parameters:
      debugKeyboard - the writer for logging keyboard debug output; may
      keybindingsManager - the keybindings manager to use
      commandQueue - the command queue to use
      windowRenderer - the window renderer to use
      keyHandlerListener - the key handler listener to notify
  • Method Details

    • setDefaultKeyBindings

      public void setDefaultKeyBindings(@NotNull @NotNull KeyBindings defaultKeyBindings)
      Sets the default KeyBindings of the currently active skin.
      Parameters:
      defaultKeyBindings - the default key bindings
    • keyPressed

      public void keyPressed(@NotNull @NotNull KeyEvent e)
      Handles a "key pressed" event.
      Parameters:
      e - the key event to handle
    • keyReleased

      public void keyReleased(@NotNull @NotNull KeyEvent e)
      Handles a "key released" event.
      Parameters:
      e - the key event to handle
    • isRunningUsingCtrl

      public boolean isRunningUsingCtrl()
      Returns whether the player is running because of the Ctrl key or not.
      Returns:
      true if the Ctrl key is pressed, false else.