power

    Dark Mode
Search:
Group by:

power.nim

SDL power management routines.

Types

PowerState* {...}{.size: sizeof(cint).} = enum
  POWERSTATE_UNKNOWN,       ## cannot determine power status
  POWERSTATE_ON_BATTERY,    ## Not plugged in, running on the battery
  POWERSTATE_NO_BATTERY,    ## Plugged in, no battery available
  POWERSTATE_CHARGING,      ## Plugged in, charging battery
  POWERSTATE_CHARGED         ## Plugged in, battery charged
The basic state for the system's power supply.

Procs

proc getPowerInfo*(secs: ptr cint; pct: ptr cint): PowerState {...}{.cdecl,
    importc: "SDL_GetPowerInfo", dynlib: SDL2_LIB.}

Get the current power supply details.

secs Seconds of battery life left. You can pass a nil here if you don't care. Will return -1 if we can't determine a value, or we're not running on a battery.

pct Percentage of battery life left, between 0 and 100. You can pass a nil here if you don't care. Will return -1 if we can't determine a value, or we're not running on a battery.

Return The state of the battery (if any).