There's a cross-platform way to check for battery status with SDL/SDL2/SDL3 with SDL_GetPowerInfo()
in <SDL/SDL_power.h>
. Then you can compare the status with SDL_PowerState
enumerations, for instance:
SDL_PowerState systemPowerState = SDL_GetPowerInfo(NULL, NULL);
if (systemPowerState == SDL_POWERSTATE_NO_BATTERY)
// check for mailbox
else
// check for relaxed_fifo