minilight-0.4.2: 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 with default configuration. runLightT = runLightTWith defLightConfig

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

Run a Light monad.

data LightConfig Source #

Custom configuration for LightT

Constructors

LightConfig 

Fields

defLightConfig :: LightConfig Source #

Default configuration for runLightT

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.

runMainloop Source #

Arguments

:: (HasLightEnv env, HasLightEnv env', HasLoopEnv env', HasLoaderEnv env', MonadIO m, MonadMask m) 
=> (env -> LoopEnv -> LoaderEnv -> env')

Environment conversion

-> LoopConfig

Loop config

-> s

Initial state

-> (s -> LightT env' 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

type MiniLoop = LightT LoopState IO Source #

Type synonym to the minimal type of the mainloop

runMiniloop :: LoopConfig -> s -> (s -> MiniLoop s) -> MiniLight () Source #

Same as runMainloop but fixing the type.

runComponentEnv :: (HasLightEnv env, HasLoopEnv env) => Component -> (forall env'. (HasComponentEnv env', HasLoopEnv env', HasLightEnv env') => LightT env' m ()) -> LightT env m () Source #

Run an action over a component.

(@@!) :: (EventType et, HasLoaderEnv env, HasLoopEnv env, HasLightEnv env, MonadIO m) => Text -> et -> LightT env m () Source #

Emit a signal with a loader-defined target name (!) :: EventType et => T.Text -> et -> MiniLoop ()

quit :: (MonadIO m, HasLoopEnv env) => LightT env m () Source #

Quit the mainloop and terminate the application.

Orphan instances

Hashable Scancode Source # 
Instance details

Methods

hashWithSalt :: Int -> Scancode -> Int #

hash :: Scancode -> Int #