Safe Haskell | None |
---|---|
Language | Haskell2010 |
The package provides the basics for all components in the library.
A component should have the followings (those can be omitted):
- position:
{x: int, y: int}
- size:
{width: int, height: int}
- color:
int[4]
- font:
{family: string, bold: bool, italic: bool, size: int}
Synopsis
- data Config = Config {}
- loadFontFrom :: Config -> MiniLight Font
- wrapConfig :: (Config -> a -> Parser r) -> (Object -> Parser a) -> Value -> Parser r
- areaRectangle :: Config -> Rectangle Int
- data Signal where
- MousePressed :: V2 Int -> Signal
- MouseReleased :: V2 Int -> Signal
- MouseOver :: V2 Int -> Signal
- wrapSignal :: (HasLightEnv env, HasLoopEnv env, HasComponentEnv env, MonadIO m, ComponentUnit c) => (c -> Config) -> (Event -> c -> LightT env m c) -> Event -> c -> LightT env m c
- emitBasicSignal :: (HasLightEnv env, HasLoopEnv env, HasComponentEnv env, MonadIO m) => Event -> Config -> LightT env m ()
- contains :: (Ord a, Num a) => Rectangle a -> V2 a -> Bool
Documentation
Basic config type
Instances
FromJSON Config Source # | |
Defined in Data.Component.Basic parseJSON :: Value -> Parser Config parseJSONList :: Value -> Parser [Config] |
wrapConfig :: (Config -> a -> Parser r) -> (Object -> Parser a) -> Value -> Parser r Source #
This wrapper function is useful when you write your component config parser.
areaRectangle :: Config -> Rectangle Int Source #
The rectangle region of the component.
Basic signal type.
Instances
EventType Signal Source # | |
Defined in Data.Component.Basic |
:: (HasLightEnv env, HasLoopEnv env, HasComponentEnv env, MonadIO m, ComponentUnit c) | |
=> (c -> Config) |
|
-> (Event -> c -> LightT env m c) | Custom |
-> Event -> c -> LightT env m c |
This wrapper function is useful when you write your own onSignal
component.
emitBasicSignal :: (HasLightEnv env, HasLoopEnv env, HasComponentEnv env, MonadIO m) => Event -> Config -> LightT env m () Source #
Basic signaling function.