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

Safe HaskellNone
LanguageHaskell2010

MiniLight.Component.Types

Synopsis

Documentation

class ComponentUnit c where Source #

CompoonentUnit typeclass provides a way to define a new component. Any ComponentUnit instance can be embedded into Component type.

Minimal complete definition

figures

Methods

update :: (HasLightEnv env, MonadIO m, MonadMask m) => c -> LightT env m c Source #

Updating a model.

figures :: (HasLightEnv env, MonadIO m, MonadMask m) => c -> LightT env m [Figure] Source #

Descirbes a view. The figures here would be cached. See also useCache for the cache configuration.

draw :: (HasLightEnv env, MonadIO m, MonadMask m) => c -> LightT env m () Source #

Drawing a figures.

useCache Source #

Arguments

:: c

A model value in the previous frame

-> c

A model value in the current frame

-> Bool 

Return True if a cache stored in the previous frame should be used.

onSignal :: (HasLightEnv env, MonadIO m, MonadMask m) => Event -> c -> LightT env m c Source #

Event handlers

Instances
ComponentUnit Component Source # 
Instance details

Defined in MiniLight.Component.Types

Methods

update :: (HasLightEnv env, MonadIO m, MonadMask m) => Component -> LightT env m Component Source #

figures :: (HasLightEnv env, MonadIO m, MonadMask m) => Component -> LightT env m [Figure] Source #

draw :: (HasLightEnv env, MonadIO m, MonadMask m) => Component -> LightT env m () Source #

useCache :: Component -> Component -> Bool Source #

onSignal :: (HasLightEnv env, MonadIO m, MonadMask m) => Event -> Component -> LightT env m Component Source #

ComponentUnit MessageEngine Source # 
Instance details

Defined in MiniLight.Component.MessageEngine

Methods

update :: (HasLightEnv env, MonadIO m, MonadMask m) => MessageEngine -> LightT env m MessageEngine Source #

figures :: (HasLightEnv env, MonadIO m, MonadMask m) => MessageEngine -> LightT env m [Figure] Source #

draw :: (HasLightEnv env, MonadIO m, MonadMask m) => MessageEngine -> LightT env m () Source #

useCache :: MessageEngine -> MessageEngine -> Bool Source #

onSignal :: (HasLightEnv env, MonadIO m, MonadMask m) => Event -> MessageEngine -> LightT env m MessageEngine Source #

ComponentUnit Layer Source # 
Instance details

Defined in MiniLight.Component.Layer

Methods

update :: (HasLightEnv env, MonadIO m, MonadMask m) => Layer -> LightT env m Layer Source #

figures :: (HasLightEnv env, MonadIO m, MonadMask m) => Layer -> LightT env m [Figure] Source #

draw :: (HasLightEnv env, MonadIO m, MonadMask m) => Layer -> LightT env m () Source #

useCache :: Layer -> Layer -> Bool Source #

onSignal :: (HasLightEnv env, MonadIO m, MonadMask m) => Event -> Layer -> LightT env m Layer Source #

ComponentUnit Button Source # 
Instance details

Defined in MiniLight.Component.Button

Methods

update :: (HasLightEnv env, MonadIO m, MonadMask m) => Button -> LightT env m Button Source #

figures :: (HasLightEnv env, MonadIO m, MonadMask m) => Button -> LightT env m [Figure] Source #

draw :: (HasLightEnv env, MonadIO m, MonadMask m) => Button -> LightT env m () Source #

useCache :: Button -> Button -> Bool Source #

onSignal :: (HasLightEnv env, MonadIO m, MonadMask m) => Event -> Button -> LightT env m Button Source #

ComponentUnit AnimationLayer Source # 
Instance details

Defined in MiniLight.Component.AnimationLayer

Methods

update :: (HasLightEnv env, MonadIO m, MonadMask m) => AnimationLayer -> LightT env m AnimationLayer Source #

figures :: (HasLightEnv env, MonadIO m, MonadMask m) => AnimationLayer -> LightT env m [Figure] Source #

draw :: (HasLightEnv env, MonadIO m, MonadMask m) => AnimationLayer -> LightT env m () Source #

useCache :: AnimationLayer -> AnimationLayer -> Bool Source #

onSignal :: (HasLightEnv env, MonadIO m, MonadMask m) => Event -> AnimationLayer -> LightT env m AnimationLayer Source #

ComponentUnit MessageLayer Source # 
Instance details

Defined in MiniLight.Component.MessageLayer

Methods

update :: (HasLightEnv env, MonadIO m, MonadMask m) => MessageLayer -> LightT env m MessageLayer Source #

figures :: (HasLightEnv env, MonadIO m, MonadMask m) => MessageLayer -> LightT env m [Figure] Source #

draw :: (HasLightEnv env, MonadIO m, MonadMask m) => MessageLayer -> LightT env m () Source #

useCache :: MessageLayer -> MessageLayer -> Bool Source #

onSignal :: (HasLightEnv env, MonadIO m, MonadMask m) => Event -> MessageLayer -> LightT env m MessageLayer Source #

data Component Source #

A wrapper for ComponentUnit instances.

Instances
ComponentUnit Component Source # 
Instance details

Defined in MiniLight.Component.Types

Methods

update :: (HasLightEnv env, MonadIO m, MonadMask m) => Component -> LightT env m Component Source #

figures :: (HasLightEnv env, MonadIO m, MonadMask m) => Component -> LightT env m [Figure] Source #

draw :: (HasLightEnv env, MonadIO m, MonadMask m) => Component -> LightT env m () Source #

useCache :: Component -> Component -> Bool Source #

onSignal :: (HasLightEnv env, MonadIO m, MonadMask m) => Event -> Component -> LightT env m Component Source #

newComponent :: (ComponentUnit c, HasLightEnv env, MonadIO m, MonadMask m) => c -> LightT env m Component Source #

Create a new component.

getComponentSize :: (ComponentUnit c, HasLightEnv env, MonadIO m, MonadMask m) => c -> LightT env m (Rectangle Int) Source #

Get the size of a component.

propagate :: Component -> Component Source #

Clear the previous model cache and reflect the current model.