cpp-sdl2
C++ header-only SDL2 wrapper
sdl::power Namespace Reference

Power related functions. More...

Enumerations

enum  state {
  state::unknown = SDL_POWERSTATE_UNKNOWN, state::on_battery = SDL_POWERSTATE_ON_BATTERY, state::no_battery = SDL_POWERSTATE_NO_BATTERY, state::charging = SDL_POWERSTATE_CHARGING,
  state::charged = SDL_POWERSTATE_CHARGED
}
 Power states. More...
 

Functions

state get_state ()
 Get current powerstate. See sdl::power::state enumeration for values. More...
 
int get_battery_remaining_time ()
 Get battery remaining time. More...
 
int get_battery_remaining_charge ()
 Get the current battery charge. More...
 

Detailed Description

Power related functions.

Enumeration Type Documentation

◆ state

enum sdl::power::state
strong

Power states.

Enumerator
unknown 
on_battery 
no_battery 
charging 
charged 

Definition at line 148 of file utils.hpp.

Function Documentation

◆ get_battery_remaining_charge()

int sdl::power::get_battery_remaining_charge ( )
inline

Get the current battery charge.

Returns
estimated remaining charge in the battery in percents

Definition at line 174 of file utils.hpp.

◆ get_battery_remaining_time()

int sdl::power::get_battery_remaining_time ( )
inline

Get battery remaining time.

Returns
Estimated number of seconds untils the battery dies

Definition at line 165 of file utils.hpp.

◆ get_state()

state sdl::power::get_state ( )
inline

Get current powerstate. See sdl::power::state enumeration for values.

Definition at line 158 of file utils.hpp.