Skip to content

Input and Input Devices

Christoph Mueller edited this page Dec 19, 2015 · 6 revisions

#Input FUSEE's Input is prepared to handle arbitrary input devices and provide their values in a consistent and centralized way to user code. Users can easily integrate existing handlers for supported input devices and also can provide input device handlers ("drivers") for new hardware.

#Concepts ##The Input singleton From the user code point of view all input access starts at the Input singleton obect Input.Instance. Use this object for the following use cases:

  • Directly access the most usual input devices: Mouse, Keyboard and Touch
  • Enumerate all currently present input devices
  • Filter for well-known input device types.
  • Listen to events about connecting and disconnecting devices.
  • Add device handlers ("drivers")
  • Add well-known input device types.

##Input Devices An instance of the class InputDevice represents a single, typically physical, input device. Input devices expose axes and buttons represeinting their input state. Axes provide single precision floating point values while buttons provide a boolean value representing the button state (pressed: true, released: false). Input devices are involved in the following use cases.

  • Get current axis values and current button state (poll values).
  • Alternatively: Listen to axis change or button change events.

Both access methods (listen to events and polling) work with all axes and buttons provided by an input device, no matter how the respective information is created and delivered by the underlying device handler ("driver"). Additional use cases around Input Devices include

  • Register user-defined calculated axes. Values provided by these axes are calculated from existing axes or buttons. Typical calculated axes are
    • Button Axes: Pressing and releasing one or two buttons drives an axis value to range between [0, 1] (single button axis) or [-1, 1] (two button axis).
    • Derived Axes: A physical device provides absolute positional values but users are interested in the speed of the changes of this values.
Clone this wiki locally