79299079

Date: 2024-12-21 08:26:18
Score: 1
Natty:
Report link

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
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Brain_driver_not_found