Class InputListener

java.lang.Object
com.mg105.user_interface.InputListener
All Implemented Interfaces:
EventListener, javafx.event.EventHandler<javafx.scene.input.KeyEvent>

public class InputListener extends Object implements javafx.event.EventHandler<javafx.scene.input.KeyEvent>
InputListener takes keyboard inputs and passes them on to an appropriate interpreter.

This class is given to JavaFX and is only called by it.

  • Constructor Details

    • InputListener

      public InputListener(@NotNull @NotNull InputInterpreter interpreter)
      Create an InputListener.
      Parameters:
      interpreter - the interpreter responsible for interpreting the keyboard inputs.
  • Method Details

    • handle

      public void handle(javafx.scene.input.KeyEvent event)
      Pass the keyevent onto the input interpreter.
      Specified by:
      handle in interface javafx.event.EventHandler<javafx.scene.input.KeyEvent>
      Parameters:
      event - the event which occurred