Safe Haskell | None |
---|---|
Language | Haskell2010 |
MiniLight module exports all basic concepts and oprations except for concrete components.
Synopsis
- module MiniLight.Light
- module MiniLight.Event
- module MiniLight.Figure
- module MiniLight.Component
- runLightT :: (HasLightEnv env, MonadIO m, MonadMask m) => (LightEnv -> env) -> LightT env m a -> m a
- data LoopConfig = LoopConfig {
- watchKeys :: Maybe [Scancode]
- appConfigFile :: Maybe FilePath
- componentResolver :: Text -> Value -> MiniLight Component
- additionalComponents :: [Component]
- defConfig :: LoopConfig
- data LoopState = LoopState {
- keyStates :: HashMap Scancode Int
- events :: [Event]
- components :: IOVector Component
- runMainloop :: (HasLightEnv env, MonadIO m, MonadMask m) => LoopConfig -> s -> (LoopState -> s -> LightT env m s) -> LightT env m ()
Documentation
module MiniLight.Light
module MiniLight.Event
module MiniLight.Figure
module MiniLight.Component
:: (HasLightEnv env, MonadIO m, MonadMask m) | |
=> (LightEnv -> env) | construct |
-> LightT env m a | |
-> m a |
Run a Light monad.
data LoopConfig Source #
Use defConfig
for a default setting.
LoopConfig | |
|
defConfig :: LoopConfig Source #
Default configurations for the mainloop.
LoopState value would be passed to user side in a mainloop.
:: (HasLightEnv env, MonadIO m, MonadMask m) | |
=> LoopConfig | loop config |
-> s | initial state |
-> (LoopState -> 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