minilight-0.2.0: A SDL2-based graphics library, batteries-included.

Safe HaskellNone
LanguageHaskell2010

MiniLight

Contents

Description

MiniLight module exports all basic concepts and oprations except for concrete components.

Synopsis

Documentation

runLightT :: (MonadIO m, MonadMask m) => LightT LightEnv m a -> m a Source #

Run a Light monad.

data LoopConfig Source #

Use defConfig for a default setting.

Constructors

LoopConfig 

Fields

defConfig :: LoopConfig Source #

Default configurations for the mainloop. You need to set componentResolver if you use a component.

data LoopEnv env Source #

LoopEnv value would be passed to user side in a mainloop.

Constructors

LoopState 

Fields

Instances
HasLoopEnv (LoopEnv env) Source # 
Instance details

Defined in MiniLight

Methods

keyStatesL :: Lens' (LoopEnv env) (HashMap Scancode Int) Source #

eventsL :: Lens' (LoopEnv env) (IORef [Event]) Source #

signalQueueL :: Lens' (LoopEnv env) (IORef [Event]) Source #

HasLightEnv env => HasLightEnv (LoopEnv env) Source # 
Instance details

Defined in MiniLight

Methods

rendererL :: Lens' (LoopEnv env) Renderer Source #

fontCacheL :: Lens' (LoopEnv env) FontMap Source #

type MiniLoop = LightT (LoopEnv LightEnv) IO Source #

Type synonym to the minimal type of the mainloop

runMainloop Source #

Arguments

:: (HasLightEnv env, HasLightEnv loop, HasLoopEnv loop, MonadIO m, MonadMask m) 
=> (LoopEnv env -> loop)

LoopState conversion function (you can pass id, fixing loop as LoopState LightEnv)

-> LoopConfig

loop config

-> s

initial state

-> (s -> LightT loop m s)

a function called in every loop

-> LightT env m () 

Run a mainloop. In a mainloop, components and events are managed.

Components in a mainloop: draw ~ update ~ (user-defined function) ~ event handling

Orphan instances

Hashable Scancode Source # 
Instance details

Methods

hashWithSalt :: Int -> Scancode -> Int

hash :: Scancode -> Int

HasLoopEnv env => HasLoopEnv (Text, env) Source # 
Instance details

Methods

keyStatesL :: Lens' (Text, env) (HashMap Scancode Int) Source #

eventsL :: Lens' (Text, env) (IORef [Event]) Source #

signalQueueL :: Lens' (Text, env) (IORef [Event]) Source #

HasLightEnv env => HasLightEnv (Text, env) Source # 
Instance details

Methods

rendererL :: Lens' (Text, env) Renderer Source #

fontCacheL :: Lens' (Text, env) FontMap Source #

HasComponentEnv (Text, env) Source # 
Instance details

Methods

uidL :: Lens' (Text, env) Text Source #