sdl2-2.4.1.0: Both high- and low-level bindings to the SDL library (version 2.0.4+).

Safe HaskellSafe
LanguageHaskell2010

SDL.Power

Contents

Synopsis

Power Status

getPowerInfo :: (Functor m, MonadIO m) => m PowerState #

Current power supply details.

Throws SDLException if the current power state can not be determined.

See SDL_GetPowerInfo for C documentation.

data PowerState #

Information about the power supply for the user's environment

Constructors

Battery BatteryState Charge

The user is on a battery powered device. See BatteryState for charge information, and Charge for charge information

Mains

The user is on a device connected to the mains.

UnknownPowerState

SDL could not determine the power for the device.

Instances
Eq PowerState # 
Instance details

Defined in SDL.Power

Ord PowerState # 
Instance details

Defined in SDL.Power

Read PowerState # 
Instance details

Defined in SDL.Power

Show PowerState # 
Instance details

Defined in SDL.Power

Generic PowerState # 
Instance details

Defined in SDL.Power

Associated Types

type Rep PowerState :: * -> * #

type Rep PowerState # 
Instance details

Defined in SDL.Power

type Rep PowerState = D1 (MetaData "PowerState" "SDL.Power" "sdl2-2.4.1.0-BSoUqVHl3myLrLd0xltRmd" False) (C1 (MetaCons "Battery" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 BatteryState) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Charge)) :+: (C1 (MetaCons "Mains" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "UnknownPowerState" PrefixI False) (U1 :: * -> *)))

data BatteryState #

Information on battery consumption for battery powered devices

Constructors

Draining

The battery is currently being drained.

Charged

The battery is fully charged.

Charging

The device is plugged in and the battery is charging.

Instances
Bounded BatteryState # 
Instance details

Defined in SDL.Power

Enum BatteryState # 
Instance details

Defined in SDL.Power

Eq BatteryState # 
Instance details

Defined in SDL.Power

Data BatteryState # 
Instance details

Defined in SDL.Power

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> BatteryState -> c BatteryState #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c BatteryState #

toConstr :: BatteryState -> Constr #

dataTypeOf :: BatteryState -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c BatteryState) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BatteryState) #

gmapT :: (forall b. Data b => b -> b) -> BatteryState -> BatteryState #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> BatteryState -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> BatteryState -> r #

gmapQ :: (forall d. Data d => d -> u) -> BatteryState -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> BatteryState -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> BatteryState -> m BatteryState #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> BatteryState -> m BatteryState #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> BatteryState -> m BatteryState #

Ord BatteryState # 
Instance details

Defined in SDL.Power

Read BatteryState # 
Instance details

Defined in SDL.Power

Show BatteryState # 
Instance details

Defined in SDL.Power

Generic BatteryState # 
Instance details

Defined in SDL.Power

Associated Types

type Rep BatteryState :: * -> * #

type Rep BatteryState # 
Instance details

Defined in SDL.Power

type Rep BatteryState = D1 (MetaData "BatteryState" "SDL.Power" "sdl2-2.4.1.0-BSoUqVHl3myLrLd0xltRmd" False) (C1 (MetaCons "Draining" PrefixI False) (U1 :: * -> *) :+: (C1 (MetaCons "Charged" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "Charging" PrefixI False) (U1 :: * -> *)))

data Charge #

Information about how much charge a battery has.

Constructors

Charge 

Fields

Instances
Eq Charge # 
Instance details

Defined in SDL.Power

Methods

(==) :: Charge -> Charge -> Bool #

(/=) :: Charge -> Charge -> Bool #

Ord Charge # 
Instance details

Defined in SDL.Power

Read Charge # 
Instance details

Defined in SDL.Power

Show Charge # 
Instance details

Defined in SDL.Power

Generic Charge # 
Instance details

Defined in SDL.Power

Associated Types

type Rep Charge :: * -> * #

Methods

from :: Charge -> Rep Charge x #

to :: Rep Charge x -> Charge #

type Rep Charge # 
Instance details

Defined in SDL.Power

type Rep Charge = D1 (MetaData "Charge" "SDL.Power" "sdl2-2.4.1.0-BSoUqVHl3myLrLd0xltRmd" False) (C1 (MetaCons "Charge" PrefixI True) (S1 (MetaSel (Just "chargeSecondsLeft") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe CInt)) :*: S1 (MetaSel (Just "chargePercent") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe CInt))))