WVR_GetInputDeviceCapability¶
- WVR_EXPORT int32_t WVR_GetInputDeviceCapability(WVR_DeviceType type, WVR_InputType inputType)
Function to get Input Device Capability for WVR_InputType.
- Return
- int32_t, bitmask for WVR_InputType, -1 for error occurs
- Parameters
- type -
which indicate what device to get the capability. (refer to WVR_DeviceType)
- inputTypeone -
of WVR_InputType.
- type -
How to use¶
Here is an example for the function:
// Check what kind of button type on your controller device support.
// It will return bitmask for WVR_InputType button.
uint32_t right_ctl_button = WVR_GetInputDeviceCapability(WVR_DeviceType_Controller_Right, WVR_InputType_Button);
uint32_t right_ctl_analog = WVR_GetInputDeviceCapability(WVR_DeviceType_Controller_Right, WVR_InputType_Analog);
uint32_t right_ctl_touch = WVR_GetInputDeviceCapability(WVR_DeviceType_Controller_Right, WVR_InputType_Touch);
// Check support Trigger button support analog
bool isTriggerSupported = right_ctl_analog & (1<<WVR_InputId_Alias1_Trigger);
// Check support Bumper button is support
bool isBumperSupported = right_ctl_button & (1<<WVR_InputId_Alias1_Bumper);
if (isTriggerSupported) {
// do something
}
if (isBumperSupported) {
// do something
}
How to use bitmask?
- There are 3 types of WVR_InputType: Button, Analog , Touch. WVR_InputType shows below.
- Developer should use WVR_GetInputDeviceCapability function to check What kind of InputType controller support.
- For Button:
- WVR_GetInputDeviceCapability(WVR_DeviceType_Controller_Right, WVR_InputType_Button);
If bitmask shows like below:
- right_ctl_button: 0000000000000011 0000000000000010
On 1, 16, 17 bits is 1 , Right Controller support menu , trigger and touchpad button.
- For Touch:
- WVR_GetInputDeviceCapability(WVR_DeviceType_Controller_Right, WVR_InputType_Touch);
If bitmask shows like below:
- right_ctl_touch: 0000000000000011 0000000000000010
On 1, 16, 17 bits is 1 , Right Controller’s menu , trigger and touchpad button support touch capability.
For Analog:
- WVR_GetInputDeviceCapability(WVR_DeviceType_Controller_Right, WVR_InputType_Analog);
If bitmask shows like below:
- right_ctl_analog: 0000000000000011 0000000000000000
On 16, 17 bits is 1 , Right Controller’s trigger and touchpad button support analog capability.
- enum WVR_InputType¶
input type for input id
Values:
- WVR_InputType_Button = 1<<0¶
Button input type
- WVR_InputType_Touch = 1<<1¶
Touch input type
- WVR_InputType_Analog = 1<<2¶
Analog input type
- 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¶