WVR_EXPORT WVR_Axis_t WVR_GetInputAnalogAxis(WVR_DeviceType type, WVR_InputId id)

Function to get the analog data of a specific input id.

Analog data for WVR_InputId. (refer to WVR_Axis)
API Level 1
  • type: Indicates the device type. (refer to WVR_DeviceType)
  • id: One of WVR_InputId. This parameter specifies the physical touch on the device that retrieves the input data.

How to use

Here is an example for the function:

 static const std::map<WVR_InputId, const char*> table {
         {WVR_InputId_0, "System"},
         {WVR_InputId_1, "Menu"},
         {WVR_InputId_2, "Grip"},
         {WVR_InputId_3, "DPad Left"},
         {WVR_InputId_4, "DPad Up"},
         {WVR_InputId_5, "DPad Right"},
         {WVR_InputId_6, "DPad Down"},
         {WVR_InputId_7, "Volume Up"},
         {WVR_InputId_8, "Volume Down"},
         {WVR_InputId_9, "Digtal Trigger"},
         {WVR_InputId_16, "Touchpad"},
         {WVR_InputId_17, "Trigger"},

// Check what kind of input types a controller supports.
// It will return bitmask for WVR_InputType.
 uint32_t right_ctl_analog = WVR_GetInputDeviceCapability(WVR_DeviceType_Controller_Right, WVR_InputType_Analog);

 // Check what kind of analog input types a controller supports.
 // If supported, print the analog axis value.
 for (int i = WVR_InputId_0; i < WVR_InputId_Max; i++) {
     if (right_ctl_analog & (1 << i)) {
         WVR_Axis_t axis = WVR_GetInputAnalogAxis(WVR_DeviceType_Controller_Right, static_cast<WVR_InputId>(i));
         LOGI("%s axis : x= %f, y= %f", table.at(static_cast<WVR_InputId>(i)), axis.x, axis.y);