Urho3D
|
The Input subsystem provides keyboard, mouse, joystick and touch input via both a polled interface and events. It is always instantiated, even in headless mode, but is active only once the application window has been created. Once active, the subsystem takes over the operating system mouse cursor. It will be hidden by default, so the UI should be used to render a software cursor if necessary. For editor-like applications the operating system cursor can be made visible by calling SetMouseVisible().
The input events include:
The input polling API differentiates between the initiation of a key/mouse button press, and holding the key or button down. GetKeyPress() and GetMouseButtonPress() return true only for one frame (the initiation) while GetKeyDown() and GetMouseButtonDown() return true as long as the key or button is held down.
In script, the polling API is accessed via properties: input.keyDown[], input.keyPress[], input.mouseButtonDown[], input.mouseButtonPress[], input.mouseMove.
To get joystick input, the joystick(s) must first be explicitly opened using OpenJoystick(). Accessing the polled joystick state using GetJoystick() also automatically opens the joystick. The plugged in joysticks are detected on application start and must be manually redetected using DetectJoysticks() if they are plugged in or disconnected during runtime.
From the input subsystem you can also query whether the application is active/inactive, or minimized.