WVR_GetInputButtonState

WVR_EXPORT bool WVR_GetInputButtonState(WVR_DeviceType type, WVR_InputId id)

Function to get button state of specific input id.

Return
bool, true for pressed and false is unpressed
Parameters

How to use

Here is an example for the function:

#include <wvr/wvr_device.h>

WVR_DeviceType controllerArray[] = {WVR_DeviceType_Controller_Right, WVR_DeviceType_Controller_Left};
int controllerCount = sizeof(controllerArray)/sizeof(controllerArray[0]);

for (int idx = 0; idx < controllerCount; idx++) {
    if (WVR_GetInputButtonState(controllerArray[idx], WVR_InputId_Alias1_Menu)) {
    LOGI("Controller device Menu button was pressed");
}

Bumper Button

If there is a trigger button on your controller device, but this trigger button not support analog function.

DeviceService will update Button state with Bumper Button instead of updating button state with Trigger Button.

Please get Input Button state - Bumper Button , don’t get Trigger Button state.

Note

Before using WVR_GetInputButtonState API, please use WVR_GetInputDeviceCapability and WVR_GetInputTypeCount.

  • WVR_GetInputDeviceCapability : Check what kind of button type on your controller device support.
  • WVR_GetInputTypeCount : Check how many button type on your controller device.

Make sure your device support Bumper Button, than get Bumper Button state.

enum WVR_InputId

The input id of device.

Values:

WVR_InputId_0 = 0
WVR_InputId_1 = 1
WVR_InputId_2 = 2
WVR_InputId_3 = 3
WVR_InputId_4 = 4
WVR_InputId_5 = 5
WVR_InputId_6 = 6
WVR_InputId_7 = 7
WVR_InputId_8 = 8
WVR_InputId_9 = 9
WVR_InputId_16 = 16
WVR_InputId_17 = 17
WVR_InputId_Alias1_System = WVR_InputId_0

System Button.

WVR_InputId_Alias1_Menu = WVR_InputId_1

Menu Button.

WVR_InputId_Alias1_Grip = WVR_InputId_2

Grip Button.

WVR_InputId_Alias1_DPad_Left = WVR_InputId_3

Virtual DPad_Left Button on Touchpad.

WVR_InputId_Alias1_DPad_Up = WVR_InputId_4

Virtual DPad_Up Button on Touchpad.

WVR_InputId_Alias1_DPad_Right = WVR_InputId_5

Virtual DPad_Right Button on Touchpad.

WVR_InputId_Alias1_DPad_Down = WVR_InputId_6

Virtual DPad_Down Button on Touchpad.

WVR_InputId_Alias1_Volume_Up = WVR_InputId_7

Volume_Up Button.

WVR_InputId_Alias1_Volume_Down = WVR_InputId_8

Volume_Down Button.

WVR_InputId_Alias1_Bumper = WVR_InputId_9

Bumper Button.

WVR_InputId_Alias1_Touchpad = WVR_InputId_16

Touchpad input device.

WVR_InputId_Alias1_Trigger = WVR_InputId_17

Trigger input device.

WVR_InputId_Max = 32