Module hanyaeger

Interface KeyListener

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface KeyListener
A KeyListener is notified when the set of pressed keys changes. Because of the way the Operating System handles consecutive key-pressed events, the event handler onPressedKeysChange(Set) is called on the first GWU when a key is pressed, but is not called in several of the consecutive GWU's if the key has not been released. Only after a short period, the event handler receives the consecutive calls and is the called each GWU.

If the motion of a YaegerEntity is controlled through keystrokes and this Interface is used, this behaviour might cause unwanted side effects (such as input lag) and should not be used.

This interface can be implemented by either an YaegerEntity or an YaegerScene.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onPressedKeysChange(Set<javafx.scene.input.KeyCode> pressedKeys)
    Called when the set of pressed keys changes.
  • Method Details

    • onPressedKeysChange

      void onPressedKeysChange(Set<javafx.scene.input.KeyCode> pressedKeys)
      Called when the set of pressed keys changes. Because of the way the Operating System handles consecutive key-pressed events, this event handler is called on the first GWU when a key is pressed, but is not called in several of the consecutive GWU's if the key has not been released. Only after a short period, the event handler receives the consecutive calls and is the called each GWU.

      If the motion of a YaegerEntity is controlled through keystrokes and this Interface is used, this behaviour might cause unwanted side effects (such as input lag) and should not be used.

      Parameters:
      pressedKeys - A Set of KeyCode representations of the keys that are currently pressed