galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
Laptop.cpp
Go to the documentation of this file.
1
7
8#include <SDL3/SDL_power.h>
9
10#include "Laptop.hpp"
11
12namespace galaxy
13{
14 namespace laptop
15 {
16 int get_battery_remaining(const bool percent) noexcept
17 {
18 int seconds = 0;
19 int percentage = 0;
20
21 SDL_GetPowerInfo(&seconds, &percentage);
22 return percent ? percentage : seconds;
23 }
24
25 SDL_PowerState get_battery_status() noexcept
26 {
27 int seconds = 0;
28 int percentage = 0;
29
30 return SDL_GetPowerInfo(&seconds, &percentage);
31 }
32 } // namespace laptop
33} // namespace galaxy
SDL_PowerState get_battery_status() noexcept
Get battery status.
Definition Laptop.cpp:25
int get_battery_remaining(const bool percent) noexcept
Get remaining battery charge of a laptop.
Definition Laptop.cpp:16
Timer.hpp galaxy.
Definition Timer.cpp:18