|
| QVRDeviceEvent (const QVRDevice &device, int buttonIndex, int analogIndex) |
|
const QVRDevice & | device () const |
| Returns the device state at the time this event was generated. You can use this to identify the device that caused the event, and to inspect other button and analog element states besides the one that generated the event.
|
|
QVRButton | button () const |
| Returns the button that triggered the event. Only calid for button press and button release events. This is a convenience function, you can get the same information from device().
|
|
int | buttonIndex () const |
| Returns the index of the button that triggered the event. Only valid for button press and button release events.
|
|
QVRAnalog | analog () const |
| Returns the analog element that triggered the event. Only valid for analog change events. This is a convenience function, you can get the same information from device().
|
|
int | analogIndex () const |
| Returns the index of the analog element that triggered the event. Only valid for analog change events.
|
|
Device event.
Two approaches are common to react on device usage:
This device event class is for the second use case.
The difference between the two is this: If a user presses a digital button on a device, than it will be pressed for a certain amount of time, and therefore the device will report that button as pressed for multiple consecutive frames when queried from QVRApp::update(). This is useful if the application implements something like "move forward as long as button X is pressed". On the other hand, if the application implements something like "when button
X is pressed, trigger action Y", then it wants the action to be triggered only once. In other words, it wants to react on the event "button X was pressed".