Skip to content

Commit

Permalink
Add missing power state (#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
pusewicz authored Mar 4, 2025
1 parent 705a472 commit c666a5d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/cute_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,8 @@ CF_API float CF_CALL cf_app_get_smoothed_framerate();
* @related CF_PowerInfo cf_app_power_info
*/
#define CF_POWER_STATE_DEFS \
/* @entry error determining power status. */ \
CF_ENUM(POWER_STATE_ERROR, -1) \
/* @entry Cannot determine power status. */ \
CF_ENUM(POWER_STATE_UNKNOWN, 0) \
/* @entry Not plugged in and running on battery. */ \
Expand Down
1 change: 1 addition & 0 deletions src/cute_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,7 @@ CF_PowerInfo cf_app_power_info()
CF_PowerInfo info;
SDL_PowerState state = SDL_GetPowerInfo(&info.seconds_left, &info.percentage_left);
switch (state) {
case SDL_POWERSTATE_ERROR: info.state = CF_POWER_STATE_ERROR;
case SDL_POWERSTATE_UNKNOWN: info.state = CF_POWER_STATE_UNKNOWN;
case SDL_POWERSTATE_ON_BATTERY: info.state = CF_POWER_STATE_ON_BATTERY;
case SDL_POWERSTATE_NO_BATTERY: info.state = CF_POWER_STATE_NO_BATTERY;
Expand Down

0 comments on commit c666a5d

Please sign in to comment.