QVR 4.0.1
A library to build Virtual Reality applications
Public Member Functions | List of all members
QVRDeviceEvent Class Reference

Device event. More...

#include <device.hpp>

Public Member Functions

 QVRDeviceEvent (const QVRDevice &device, int buttonIndex, int analogIndex)
 
const QVRDevicedevice () 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. More...
 
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(). More...
 
int buttonIndex () const
 Returns the index of the button that triggered the event. Only valid for button press and button release events. More...
 
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(). More...
 
int analogIndex () const
 Returns the index of the analog element that triggered the event. Only valid for analog change events. More...
 

Detailed Description

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".

Constructor & Destructor Documentation

◆ QVRDeviceEvent()

QVRDeviceEvent::QVRDeviceEvent ( const QVRDevice device,
int  buttonIndex,
int  analogIndex 
)
inline

Member Function Documentation

◆ analog()

QVRAnalog QVRDeviceEvent::analog ( ) const
inline

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().

◆ analogIndex()

int QVRDeviceEvent::analogIndex ( ) const
inline

Returns the index of the analog element that triggered the event. Only valid for analog change events.

◆ button()

QVRButton QVRDeviceEvent::button ( ) const
inline

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().

◆ buttonIndex()

int QVRDeviceEvent::buttonIndex ( ) const
inline

Returns the index of the button that triggered the event. Only valid for button press and button release events.

◆ device()

const QVRDevice & QVRDeviceEvent::device ( ) const
inline

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.


The documentation for this class was generated from the following file: