WVR_EXPORT uint32_t WVR_GetInputMappingTable(WVR_DeviceType type, WVR_InputMappingPair * table, uint32_t size)

Get the entire input mapping table.

Retrieves the mapping table from the input id of the hardware device to map the software input events needed by an app.
API Level 3
  • type: Indicates what device type. (refer to WVR_DeviceType).
  • table: Outputs the entire input mapping table.
  • size: The allocated buffer size for the table.

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

auto size = WVR_GetInputMappingTable(WVR_DeviceType_Controller_Right, nullptr, 0);
WVR_InputMappingPair elements[size];
WVR_GetInputMappingTable(WVR_DeviceType_Controller_Right, elements, size);
for (int i = 0; i < size; i++) {
    auto element = elements[i];
    std::cout << "request InputId_" << element.source.id << ", capability is " <<
              element.source.capability << ", axis type is" << element.source.axis_type << "." << std::endl;
    std::cout << "Mapped to InputId_" << element.destination.id << ", capability is " <<
              element.destination.capability << ", axis type is" << element.destination.axis_type << "." << std::endl;
struct WVR_InputMappingPair

Input mapping pair from the device to the app.

Public Members

WVR_InputAttribute destination

Destination key to the app

WVR_InputAttribute source

Source key from the device

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