minilight-0.1.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 Source #

Arguments

:: (HasLightEnv env, MonadIO m, MonadMask m) 
=> (LightEnv -> env)

construct env value with initial LightEnv

-> LightT env m a 
-> m a 

Run a Light monad.

data LoopConfig Source #

Use defConfig for a default setting.

Constructors

LoopConfig 

Fields

defConfig :: LoopConfig Source #

Default configurations for the mainloop.

data LoopState Source #

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

Constructors

LoopState 

Fields

  • keyStates :: HashMap Scancode Int

    Contains the number of frames that a specific keys are continuously pressing.

  • events :: [Event]

    Occurred events since the last frame.

  • components :: IOVector Component

    Current components managed in a mainloop. Be careful to modify a component destructively.

runMainloop Source #

Arguments

:: (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

Orphan instances

Hashable Scancode Source # 
Instance details

Methods

hashWithSalt :: Int -> Scancode -> Int

hash :: Scancode -> Int