WVR_GetInputDeviceState

WVR_EXPORT bool WVR_GetInputDeviceState(WVR_DeviceType type, uint32_t inputType, uint32_t * buttons, uint32_t * touches, WVR_AnalogState_t * analogArray, uint32_t analogArrayCount)

Function to get WVR_InputType data, inputType is a bitmask to represent the combination input type for WVR_InputType.

Return
false on failure
Parameters
  • type -

    which indicates what device to get the InputDeviceState. (refer to WVR_DeviceType)

  • inputTypea -

    bitmask to represent the combination input type for WVR_InputType, developer can get singlton or combination input status.

  • buttonsa -

    bitmask to represent the button state, each bit is corresponding to HVT_InputId.

  • touchesa -

    bitmast to represent the touches state, each bit is corresponding to HVT_InputId.

  • analogArrayan -

    array of WVR_AnalogState_t to represent all analog data. (refer to WVR_AnalogState)

  • analoyAarrayCountDeveloper -

    should the the array count from the WVR_GetInputTypeCount API.

How to use

Here is an example for the function:

#include <wvr/wvr_device.h>

// Must initialize VR runtime once before related API.
WVR_InitError eError = WVR_InitError_None;
eError = WVR_Init(WVR_AppType_VRContent);
if (eError != WVR_InitError_None) {
    LOGE("Unable to init VR runtime: %s", WVR_GetInitErrorString(eError));
}
ControllerState cs;

uint32_t inputType = WVR_InputType_Button | WVR_InputType_Touch | WVR_InputType_Analog;
uint32_t buttons = 0, touches = 0;
uint32_t analogCount = WVR_GetInputTypeCount(controllerArray[idx], WVR_InputType_Analog);

for (int idx = 0; idx < controllerCount; idx++) {
    if (WVR_GetInputDeviceState(controllerArray[idx], inputType, &buttons, &touches, cs.mAnalogState, analogCount)) {

    }
}

Use struct ControllerState members to check corresponding tracked device index of the controller buttons are touched or pressed, and the axis data.

enum WVR_InputType

input type for input id

Values:

WVR_InputType_Button = 1<<0

Button input type

WVR_InputType_Touch = 1<<1

Touch input type

WVR_InputType_Analog = 1<<2

Analog input type