WVR_GetInputMappingPair

WVR_EXPORT bool WVR_GetInputMappingPair(WVR_DeviceType type, WVR_InputId destination, WVR_InputMappingPair * pair)

To get the input mapping pair for the designated destination key.

Return
True means the pair is valid; false means the pair is invalid(cannot find a right source mapping to the destination from the device).
Version
API Level 3
Parameters
  • type: Indicates the device type. (refer to WVR_DeviceType).
  • destination: Indicates the input id that the app requests (refer to WVR_InputId).
  • pair: Outputs the input mapping pair for the destination input id.

How to use

Here is an example for the function:

#include <wvr/wvr_device.h>

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},
};

WVR_SetInputRequest(WVR_DeviceType_Controller_Right, array, sizeof(array) / sizeof(*array));

for (int i = 0; i < sizeof(array) / sizeof(*array); i++) {
    WVR_InputMappingPair element;
    if (WVR_GetInputMappingPair(WVR_DeviceType_Controller_Right, array[i].id, &element)) {
        std::cout << "request InputId_" << element.source.id << ", capability is " <<
                  element.source.capability << ", axis type is" << element.source.axis_type << "." << std::endl;
        std::cout << "Mapping to InputId_" << element.destination.id << ", capability is " <<
                  element.destination.capability << ", axis type is" << element.destination.axis_type << "." << std::endl;

    } else {
        std::cout << "InputId_" << element.source.id << "is not mapped." << std::endl;
    }
}
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