WVR_GetDeviceBatteryPercentage¶
-
WVR_EXPORT float WVR_GetDeviceBatteryPercentage(WVR_DeviceType type)
Get the remaining battery power in percentage, of specified device.
- Return
- The percentage of the remaining battery power of the specified device.
- Version
- API Level 1
- Parameters
type
: Device type to get the InputDeviceState. (refer to WVR_DeviceType)
How to use¶
Here is an example for the function:
#include <wvr/wvr_device.h>
// Get HMD remaining battery power in Percentage
float Percentage = 0.0;
Percentage = WVR_GetDeviceBatteryPercentage(WVR_DeviceType_HMD);
//
WVR_Event_t event;
while(WVR_PollEventQueue(&event)) {
switch (event.common.type) {
case WVR_EventType_BatteryPercentageUpdate: {
if (event.device.deviceType == WVR_DeviceType_HMD)
Percentage = WVR_GetDeviceBatteryPercentage(WVR_DeviceType_HMD);
break;
}
}
}
Note
The WVR_GetDeviceBatteryPercentage will return a value from 0 to 1. If the current battery power is at 22%, the returned value will be 0.22.