Class InputEngine

java.lang.Object
fr.r1r0r0.deltaengine.model.engines.InputEngine
All Implemented Interfaces:
Engine, java.lang.Runnable

final class InputEngine
extends java.lang.Object
implements Engine
The Input Engine. Graphic API Key Binding Driver, allows to bind any keyboard keys to a specific event
See Also:
to see all supported keys
  • Field Summary

    Fields
    Modifier and Type Field Description
    private java.util.Map<javafx.scene.input.KeyCode,​InputEvent> events  
    private javafx.stage.Stage stage  
  • Constructor Summary

    Constructors
    Constructor Description
    InputEngine()
    Default constructor
  • Method Summary

    Modifier and Type Method Description
    void clearKey​(Key key)
    Remove Event from a given key.
    void init()
    Initialize the Engine.
    void run()  
    void setInput​(Key key, InputEvent event)
    Allows setting a new input keyboard event to given Keyboard with specified Event to trigger.
    void setStage​(javafx.stage.Stage stage)
    Setting the JavaFX stage.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • events

      private final java.util.Map<javafx.scene.input.KeyCode,​InputEvent> events
    • stage

      private javafx.stage.Stage stage
  • Constructor Details

    • InputEngine

      InputEngine()
      Default constructor
  • Method Details

    • init

      public void init()
      Description copied from interface: Engine
      Initialize the Engine.
      Specified by:
      init in interface Engine
    • run

      public void run()
      Specified by:
      run in interface java.lang.Runnable
    • setInput

      public void setInput​(Key key, InputEvent event) throws InputKeyStackingError
      Allows setting a new input keyboard event to given Keyboard with specified Event to trigger.
      Parameters:
      key - Key to bind
      event - Event to trigger when Key is bound
      Throws:
      InputKeyStackingError - if given Key is already bound to an Event
    • setStage

      public void setStage​(javafx.stage.Stage stage)
      Setting the JavaFX stage. Allowing to bind keyboard inputs to it.
      Parameters:
      stage - JavaFX stage.
    • clearKey

      public void clearKey​(Key key)
      Remove Event from a given key.
      Parameters:
      key - Key of event that must be removed.