gamepad_get_battery_charge(device)

From ENIGMA
Jump to navigation Jump to search

Description

Gets the charge state of the battery of the given gamepad device and returns the result.

Parameters

Parameter Data Type Description
device integer The gamepad index, must be 0 through 3, 0 being player 1.

Return Values

integer: Returns gamepad constant corresponding to the state of its battery life.

Example Call

// demonstrates checking if the battery is getting low and warning the player
var charge;
charge = gamepad_get_battery_charge(0);
if (charge = gp_low) {
  show_message("WARNING! Your battery life is low, you will need to charge your controller soon.");
}