Skip to content

First Look Input

Robert Campbell edited this page Jun 3, 2023 · 1 revision

Subsystem Overview

Ultraviolet’s Input subsystem is exposed through the IUltravioletInput interface, which you can retrieve an instance of by calling UltravioletContext.GetInput(). This interface allows you to enumerate and query the system's input devices, such as mice, keyboards, game controllers, and touch devices.

Check out the reference documentation for a complete run-down what what the IUltravioletInput interface is capable of. Here’s a brief overview of some of the important points.

You can query whether the current platform supports a particular class of input device using the IsDEVICESupported() family of methods. For example, the IsMouseSupported() method will tell you whether the current platform supports mouse devices.

You can query whether an input device of a particular type has been discovered by Ultraviolet using the IsDEVICERegistered() family of methods. For example, the IsMouseRegistered() method will tell you whether Ultraviolet is aware of a mouse device which has actually been connected and is available for use.

You can retrieve an object which represents a particular device using the GetDEVICE() family of methods. For example, the GetMouse() method will return an object which represents the connected mouse device, if one exists, or null if there is no connected mouse device.

Associated Resources

This list is not exhaustive, but should be enough to get you started. Check out the reference documentation for more information.

The MouseDevice class represents a mouse and allows you to query the state of the mouse's buttons.

The KeyboardDevice class represents a keyboard and allows you to query the state of the keyboard's keys.

The GamePadDevice class represents a game controller and allows you to query the state of the controller's buttons and joysticks.

The TouchDevice class represents a touch input device, such as those found on a phone, and allows you to retrieve information about any touches or taps which may be occurring.

The InputAction and InputActionCollection classes allow you to specify a set of game-specific actions (such as "move forward," "use weapon," "open door," etc.) which are associated with a particular set of input bindings.

Clone this wiki locally