|
| InputManager (bool useSystemTime=true, Allocator &allocator=GetDefaultAllocator()) |
| Initializes the manager. More...
|
|
| ~InputManager () |
| Destructs the manager.
|
|
void | SetDisplaySize (int width, int height) |
| Sets the window resolution. More...
|
|
void | HandleEvent (XEvent &event) |
| [LINUX ONLY] Lets the InputManager handle the given X event. More...
|
|
void | HandleMessage (const MSG &msg) |
| [WINDOWS ONLY] Lets the InputManager handle the given Windows message. More...
|
|
int32_t | HandleInput (AInputEvent *event) |
| [ANDROID ONLY] Lets the InputManager handle the given input event.
|
|
void | HandleDeviceInput (DeviceInput const &input) |
|
void | Update () |
| Updates the input state, call this every frame. More...
|
|
void | Update (uint64_t deltaTime) |
| Updates the input state and the manager's time, call this every frame. More...
|
|
Allocator & | GetAllocator () const |
| Returns the allocator to be used for memory allocations.
|
|
uint64_t | GetTime () const |
| Returns a monotonic time in milliseconds.
|
|
template<class T > |
DeviceId | CreateDevice (unsigned index=InputDevice::AutoIndex, InputDevice::DeviceVariant variant=InputDevice::DV_STANDARD) |
| Creates an input device and registers it with the manager. More...
|
|
template<class T > |
T * | CreateAndGetDevice (unsigned index=InputDevice::AutoIndex, InputDevice::DeviceVariant variant=InputDevice::DV_STANDARD) |
| Creates an input device, registers it with the manager and returns it. More...
|
|
InputDevice * | GetDevice (DeviceId deviceId) |
| Returns the input device with the given ID. More...
|
|
const InputDevice * | GetDevice (DeviceId deviceId) const |
| Returns the input device with the given ID. More...
|
|
DeviceId | FindDeviceId (const char *typeName, unsigned index) const |
| Returns the ID of the device with the given type and index. More...
|
|
DeviceId | FindDeviceId (InputDevice::DeviceType type, unsigned index) const |
| Returns the ID of the device with the given type and index. More...
|
|
iterator | begin () |
| Returns the begin iterator over all registered devices.
|
|
iterator | end () |
| Returns the end iterator over all registered devices.
|
|
const_iterator | begin () const |
| Returns the begin iterator over all registered devices.
|
|
const_iterator | end () const |
| Returns the end iterator over all registered devices.
|
|
ListenerId | AddListener (InputListener *listener) |
| Registers a listener to be notified when a button state changes. More...
|
|
void | RemoveListener (ListenerId listenerId) |
| De-registers the given listener.
|
|
void | ReorderListeners () |
| Sorts the list of listeners which controls the order in which listeners are called. More...
|
|
size_t | GetAnyButtonDown (DeviceButtonSpec *outButtons, size_t maxButtonCount) const |
| Checks if any button on any device is down. More...
|
|
unsigned | GetDeviceCountByType (InputDevice::DeviceType type) const |
| Returns the number of devices with the given type.
|
|
int | GetDisplayWidth () const |
| Returns the graphical display's width in pixels.
|
|
int | GetDisplayHeight () const |
| Returns the graphical display's height in pixels.
|
|
ModifierId | AddDeviceStateModifier (DeviceStateModifier *modifier) |
| Registers a modifier that will be called after devices have been updated.
|
|
void | RemoveDeviceStateModifier (ModifierId modifierId) |
| De-registers the given modifier.
|
|
void | EnqueueConcurrentChange (InputDevice &device, InputState &state, InputDeltaState *delta, DeviceButtonId buttonId, bool value) |
|
void | EnqueueConcurrentChange (InputDevice &device, InputState &state, InputDeltaState *delta, DeviceButtonId buttonId, float value) |
|
void | ConnectForStateSync (const char *ip, unsigned port) |
| [IN dev BUILDS ONLY] Connect to a remote host to send device state changes to.
|
|
void | StartDeviceStateSync (DeviceId deviceId) |
| [IN dev BUILDS ONLY] Initiate sending of device state changes to the given device.
|
|
void | SetDebugRenderingEnabled (bool enabled) |
| Enable/disable debug rendering of input devices.
|
|
bool | IsDebugRenderingEnabled () const |
| Returns true if debug rendering is enabled, false otherwise.
|
|
void | SetDebugRenderer (DebugRenderer *debugRenderer) |
| Sets the debug renderer to be used if debug rendering is enabled.
|
|
DebugRenderer * | GetDebugRenderer () const |
| Returns the previously set debug renderer.
|
|
Manages all input devices and some other helpful stuff.
This manager takes care of all device-related things. Normally, you should only need one that contains all your input devices.
After instantiating an InputManager, you have to call SetDisplaySize(). You should also create some input devices using the template function CreateDevice() which returns the device ID that is needed to do anything further with the device (for example, see InputMap).
The manager has to be updated every frame by calling Update(). Depending on the platform, you may have to call another function as part of your message handling code (see HandleMessage(), HandleInput()).
Note that destruction of an InputManager invalidates all input maps based on it and all devices created through it.
- Examples:
- /samples/basic/basicsample_android.cpp, /samples/basic/basicsample_linux.cpp, /samples/basic/basicsample_win.cpp, /samples/dynamic/dynamicsample.cpp, /samples/gesture/gesturesample.cpp, /samples/listener/listenersample.cpp, /samples/recording/recordingsample.cpp, and /samples/sync/syncsample.cpp.