15 lines
605 B
Zig
15 lines
605 B
Zig
const std = @import("std");
|
|
pub const c = @import("c.zig").c;
|
|
pub const PowerState = enum(c_int) {
|
|
powerstateError = -1, //error determining power status
|
|
powerstateUnknown, //cannot determine power status
|
|
powerstateOnBattery, //Not plugged in, running on the battery
|
|
powerstateNoBattery, //Plugged in, no battery available
|
|
powerstateCharging, //Plugged in, charging battery
|
|
powerstateCharged, //Plugged in, battery charged
|
|
};
|
|
|
|
pub inline fn getPowerInfo(seconds: ?*c_int, percent: ?*c_int) PowerState {
|
|
return @fromBackingInt(@intCast(c.SDL_GetPowerInfo(seconds, percent)));
|
|
}
|