Skip to content

VREvent_t

Joe Ludwig edited this page Apr 21, 2015 · 1 revision

OpenVR exposes Events to applications with the following struct:

struct VREvent_t
{
	EVREventType eventType;
	TrackedDeviceIndex_t trackedDeviceIndex;
	VREvent_Data_t data;
	float eventAgeSeconds;
};
  • EVREventType eventType - The type of the event. Determines what part of the data enum is populated for this event. See the Event Type section below.
  • TrackedDeviceIndex_t trackedDeviceIndex - The tracked device index of the event. For events that aren't connected to a tracked device this is k_unTrackedDeviceIndexInvalid.
  • VREvent_Data_t data - More information about the event. This is a union of several structs. See the event type enum for information about which union member to look at for each event.
  • float eventAgeSeconds - The age of the event in seconds.

Event type

Will be one of:

  • VREvent_None - The event is invalid.
  • VREvent_TrackedDeviceActivated - A tracked device was plugged in or otherwise detected by the system. There is no data, but the trackedDeviceIndex will be the index of the new device.
  • VREvent_TrackedDeviceDeactivated - A tracked device was unplugged or the system is no longer able to contact it in some other way. Data is not used for this event.
  • VREvent_TrackedDeviceUpdated - One or more of the properties of a tracked device have changed. Data is not used for this event.
  • VREvent_ButtonPress - The user has pressed a button on a controller. The controller struct in data identifies the button.
  • VREvent_ButtonUnpress - The user has stopped pressing a button on a controller. The controller struct in data identifies the button.
  • VREvent_ButtonTouch - The user has touched a button on a controller. The controller struct in data identifies the button. This event will always happen before Press.
  • VREvent_ButtonUntouch - The user has stopped touching a button on a controller. The controller struct in data identifies the button. The event will always happen after Unpress.
  • VREvent_MouseMove - This is an internal simulated mouse move event. The mouse struct in data identifies details. This event is only generated by simulated mouse input, not by system mouse events.
  • VREvent_MouseButtonDown - This is an internal simulated mouse button down event. The mouse struct in data identifies details. This event is only generated by simulated mouse input, not by system mouse events.
  • VREvent_MouseButtonUp - This is an internal simulated mouse button up event. The mouse struct in data identifies details. This event is only generated by simulated mouse input, not by system mouse events.
  • VREvent_InputFocusCaptured - Another application has called CaptureInputFocus. The process struct in data identifies the process. This event is not sent to the application that captured the input focus.
  • VREvent_InputFocusReleased - Another application has called ReleaseInputFocus. The process struct in data identifies the process. This event is not sent to the application that released the input focus.

Controller events

This struct is used for controller events: struct VREvent_Controller_t { EVRButtonId button; };

EVRButtonId contains the following values:

  • k_EButton_System - The system button. These events are not visible to applications and are used internally to bring up the Steam Overlay or the Steam Client.

  • k_EButton_ApplicationMenu - The application menu button

  • k_EButton_Grip - The grip button

  • k_EButton_Axis0 - Axis 0-5

  • k_EButton_Axis1

  • k_EButton_Axis2

  • k_EButton_Axis3

  • k_EButton_Axis4

  • k_EButton_SteamVR_Touchpad - This is the touchpad on the SteamVR controller. It is the same as k_EButton_Axis0.

  • k_EButton_SteamVR_Trigger - This is the trigger on the SteamVR controller. It is the same as k_EButton_Axis1.

  • k_EButton_Max - This is not an actual button. It just indicates the maximum number of buttons in the system.

The following helper is provided to turn a button ID into a bit mask that can be used with controller state button pressed and touched bit fields. inline uint64_t ButtonMaskFromId( EVRButtonId id ) { return 1ull << id; }

Mouse Events

Mouse events are provided in OpenVR only for internal simulated events. System mouse events are not captured by the system.

Mouse events use the following struct for their data: struct VREvent_Mouse_t { float x, y; EVRMouseButton button; };

The EVRMouseButton Enum uses the following values:

  • VRMouseButton_Left
  • VRMouseButton_Right
  • VRMouseButton_Middle

Process Events

Capturing and releasing input focus uses the process event struct:

struct VREvent_Process_t
{
	uint32_t pid;
	uint32_t oldPid;
};
Clone this wiki locally