WVR_SetInputRequest

WVR_EXPORT bool WVR_SetInputRequest(WVR_DeviceType type, const WVR_InputAttribute * request, uint32_t size)

Set what input keys are requested by an app. It must be invoked after WVR_Init . If not, WVR_InputEvent, WVR_GetInputDeviceState, WVR_GetInputButtonState, WVR_GetInputTouchState, and WVR_GetInputAnalogAxis cannot get the input event in an app.

Return
True means request is valid; false means request is invalid.
Version
API Level 3
Note
Key mapping policy excludes 2 cases from setting an input request:
  1. WVR_InputId_Alias1_System is reserved for system use. The app cannot receive a system key event even if you set an input request for it.
  2. WVR_InputId_Alias1_Volume_Up and WVR_InputId_Alias1_Volume_Down are exclusively used for volume control by the system. Key mapping policy will not let other keys mapping to volume keys. The app can receive volume key events even if you don’t set input request for them.
Parameters
  • type: Indicates what device type. (refer to WVR_DeviceType).
  • request: Keys used by an app (refer to WVR_InputAttribute).
  • size: The size of the input buffer pointed by the request parameter.

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]);

WVR_InputAttribute array[] = {
    {WVR_InputId_Alias1_Menu, WVR_InputType_Button, WVR_AnalogType_None},
    {WVR_InputId_Alias1_Grip, WVR_InputType_Button, WVR_AnalogType_None},
    {WVR_InputId_Alias1_Touchpad, WVR_InputType_Button | WVR_InputType_Touch | WVR_InputType_Analog, WVR_AnalogType_2D},
    {WVR_InputId_Alias1_Trigger, WVR_InputType_Button | WVR_InputType_Touch | WVR_InputType_Analog, WVR_AnalogType_1D},
}

for (int idx = 0; idx < controllerCount; idx++) {
    WVR_SetInputRequest(controllerArray[idx], array, sizeof(array) / sizeof(*array));
}
struct WVR_InputAttribute

Input attribute for the designated input id.

Public Members

WVR_InputId id

The input id of the device.

int32_t capability

Bitmask of WVR_InputType. The value must be from 1 ~ 7

WVR_AnalogType axis_type

WVR_AnalogType_2D or WVR_AnalogType_1D if analog bit of capability is 1; otherwise, WVR_AnalogType_None