-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A SDL2-based graphics library, batteries-included.
--
-- This package provides the wheel for a graphical application or a game.
--
-- Basic concepts and features:
--
--
-- - Figure: convenient SDL texture, once created, it can be translated
-- or rotated during rendering.
-- - Component: a reusable widget with event handlers, its figures can
-- also be cached.
-- - Hot Config Replacement: view components can be constructed by an
-- external yaml file with live preview.
-- - built-in components: some common components are predefined. You
-- can define a new component by yourself.
--
@package minilight
@version 0.3.0
-- | A simple logger class for LightT monad
module Control.Monad.Caster
class MonadLogger m
getLogger :: (MonadLogger m, MonadIO m) => m LogQueue
debug :: (MonadLogger m, MonadIO m, ToBuilder s) => s -> m ()
info :: (MonadLogger m, MonadIO m, ToBuilder s) => s -> m ()
warn :: (MonadLogger m, MonadIO m, ToBuilder s) => s -> m ()
err :: (MonadLogger m, MonadIO m, ToBuilder s) => s -> m ()
-- | Types which are able to be converted into Builder
-- Builder toBuilde encodes String and
-- Text as utf-8.
class ToBuilder a
toBuilder :: ToBuilder a => a -> Builder
-- | Log levels. These are matched to syslog.
data LogLevel
LogDebug :: LogLevel
LogInfo :: LogLevel
LogNotice :: LogLevel
LogWarn :: LogLevel
LogError :: LogLevel
LogCritical :: LogLevel
LogAlert :: LogLevel
LogEmergency :: LogLevel
-- | Queue of LogMsg.
data LogQueue
stdoutLogger :: LogLevel -> IO LogQueue
module Data.Registry.Class
-- | IRegistry typeclass presents a registry interface. The
-- complexity O(1) in the operations can be "amortized"
-- complexity.
class IRegistry reg
-- | O(1) Checking if the specified key exists
has :: (IRegistry reg, MonadIO m) => reg v -> Text -> m Bool
-- | O(1) Indexing
(!) :: (IRegistry reg, MonadIO m) => reg v -> Text -> m v
-- | O(1) Safe indexing
(!?) :: (IRegistry reg, MonadIO m) => reg v -> Text -> m (Maybe v)
-- | O(1) Update, raise an exception if the key does not exist.
update :: (IRegistry reg, MonadIO m) => reg v -> Text -> (v -> m v) -> m ()
-- | O(1) Write, raise an exception if the key does not exist.
write :: (IRegistry reg, MonadIO m) => reg v -> Text -> v -> m ()
-- | O(1) Adding a new value to the last position
register :: (IRegistry reg, MonadIO m) => reg v -> Text -> v -> m ()
-- | O(n) Inserting a new value to the specified position (in the
-- underlying vector)
insert :: (IRegistry reg, MonadIO m) => reg v -> Int -> Text -> v -> m ()
-- | O(n) Deleting the specified value (this is a slow operation).
delete :: (IRegistry reg, MonadIO m) => reg v -> Text -> m ()
-- | O(1) Get the underlying vector. Be careful: modifying the
-- vector might cause a problem.
asVec :: IRegistry reg => reg v -> IOVector v
infixl 9 !?
infixl 9 !
-- | For-loop over the registry, ignoring the key order.
forV_ :: (MonadIO m, IRegistry reg) => reg v -> (v -> m ()) -> m ()
-- | For-loop over the registry with the index, ignoring the key order.
iforV_ :: (MonadIO m, IRegistry reg) => reg v -> (Int -> v -> m ()) -> m ()
-- | Modifying the item one by one, ignoring the key order.
modifyV_ :: (MonadIO m, IRegistry reg) => reg v -> (v -> m v) -> m ()
-- | This module provides a variant of the vector, equipped with
-- push_back operation. IOVector here are supposed to be used in
-- single thread situation.
module Data.Vector.Mutable.PushBack
-- | IOVector consists of (1) pointer to the underlying vector (2)
-- length While Vector has the underlying array itself, this type
-- only has the pointer. This means read/write should be slower than the
-- original vector.
data IOVector a
IOVector :: !IORef (IOVector a) -> !IOVector Int -> IOVector a
new :: Int -> IO (IOVector a)
read :: IOVector a -> Int -> IO a
-- | Get the position of the last cell in the IOVector. This
-- operation is not safe because of the unsafePerformIO.
safeLength :: IOVector a -> IO Int
length :: IOVector a -> Int
safeCapacity :: IOVector a -> IO Int
-- | Get the capacity of the IOVector. This operation is not safe
-- because of the unsafePerformIO.
capacity :: IOVector a -> Int
write :: IOVector a -> Int -> a -> IO ()
-- | O(n) Insert a value into any place. This is a slow operation.
insert :: IOVector a -> Int -> a -> IO ()
-- | O(n) This is a slow operation. This also throws an exception if
-- the specified index does not exist.
delete :: IOVector a -> Int -> IO ()
push :: IOVector a -> a -> IO ()
fromList :: [a] -> IO (IOVector a)
asIOVector :: IOVector a -> IO (IOVector a)
asUnsafeIOVector :: IOVector a -> IOVector a
-- | Registry implementation using hashtable
module Data.Registry.HashTable
data HashTableImpl k v
HashTableImpl :: BasicHashTable k Int -> IOVector v -> HashTableImpl k v
fromListImpl :: MonadIO m => [(Text, v)] -> m (HashTableImpl Text v)
instance Data.Registry.Class.IRegistry (Data.Registry.HashTable.HashTableImpl Data.Text.Internal.Text)
-- | This module provides a registry for the specific type with the Text
-- key.
--
-- This module is intended to be imported qualified, like:
-- import qualified Data.Registry as R
module Data.Registry
-- | The Registry type can represents any IRegistry
-- instance.
data Registry v
Registry :: reg v -> Registry v
-- | O(n) Create a registry from a list. The current implementation
-- uses a hashtable, defined in the module HashTable.
fromList :: MonadIO m => [(Text, v)] -> m (Registry v)
-- | Create a new empty registry.
new :: MonadIO m => m (Registry v)
instance Data.Registry.Class.IRegistry Data.Registry.Registry
module MiniLight.Component.Internal.Resolver
data Expr
None :: Expr
-- | reference syntax: ${ref:...}
Ref :: Text -> Expr
-- | variable syntax: ${var:...}
Var :: Text -> Expr
-- | expr operator: +, -, *, /
Op :: Text -> Expr -> Expr -> Expr
-- | constants (string or number or null)
Constant :: Value -> Expr
parser :: Parser Expr
data Context
Context :: Vector (Either Int Text) -> Object -> Value -> Context
[path] :: Context -> Vector (Either Int Text)
[variables] :: Context -> Object
[target] :: Context -> Value
getAt :: Value -> [Either Int Text] -> Value
normalize :: Vector (Either Int Text) -> [Either Int Text] -> [Either Int Text]
pattern Arithmetic :: Text -> Scientific -> Scientific -> Expr
eval :: Context -> Expr -> Value
convertPath :: Text -> [Either Int Text]
convert :: Context -> Text -> Value
parseText :: Parser a -> Text -> Result a
resolve :: Value -> Value
instance GHC.Show.Show MiniLight.Component.Internal.Resolver.Expr
instance GHC.Classes.Eq MiniLight.Component.Internal.Resolver.Expr
module MiniLight.Event
-- | Event type representation
data Event
Never :: Event
Signal :: Text -> Dynamic -> Event
RawEvent :: Event -> Event
NotifyEvent :: Event -> Event
-- | EventType says some type can be used as an event type.
class Typeable e => EventType e
signal :: EventType a => Text -> a -> Event
asSignal :: EventType a => Event -> Text -> Maybe a
module MiniLight.Light
class HasLightEnv c_aKvN
lightEnv :: HasLightEnv c_aKvN => Lens' c_aKvN LightEnv
_fontCache :: HasLightEnv c_aKvN => Lens' c_aKvN FontMap
_logger :: HasLightEnv c_aKvN => Lens' c_aKvN LogQueue
_renderer :: HasLightEnv c_aKvN => Lens' c_aKvN Renderer
newtype LightT env m a
LightT :: ReaderT env m a -> LightT env m a
[runLightT'] :: LightT env m a -> ReaderT env m a
-- | The environment for LightT monad.
data LightEnv
LightEnv :: Renderer -> FontMap -> LogQueue -> LightEnv
-- | Renderer for SDL2
[renderer] :: LightEnv -> Renderer
-- | System font information
[fontCache] :: LightEnv -> FontMap
-- | Logger connected stdout
[logger] :: LightEnv -> LogQueue
type MiniLight = LightT LightEnv IO
liftMiniLight :: (HasLightEnv env, MonadIO m) => MiniLight a -> LightT env m a
envLightT :: (env' -> env) -> LightT env m a -> LightT env' m a
mapLightT :: (m a -> n a) -> LightT env m a -> LightT env n a
class HasLoopEnv c_aKBX
loopEnv :: HasLoopEnv c_aKBX => Lens' c_aKBX LoopEnv
_events :: HasLoopEnv c_aKBX => Lens' c_aKBX (MVar [Event])
_keyStates :: HasLoopEnv c_aKBX => Lens' c_aKBX (HashMap Scancode Int)
_signalQueue :: HasLoopEnv c_aKBX => Lens' c_aKBX (IORef [Event])
data LoopEnv
LoopEnv :: HashMap Scancode Int -> MVar [Event] -> IORef [Event] -> LoopEnv
-- | Current state of keys, represents how many frames the key down has
-- been down
[keyStates] :: LoopEnv -> HashMap Scancode Int
-- | Event queue
[events] :: LoopEnv -> MVar [Event]
-- | Signals emitted from components are stored in the queue and poll in
-- the next frame.
[signalQueue] :: LoopEnv -> IORef [Event]
-- | A font descriptor is a key used to find a font in a font cache.
data FontDescriptor
FontDescriptor :: !Text -> !FontStyle -> FontDescriptor
-- | The family name of the font
[_descriptorFamilyName] :: FontDescriptor -> !Text
-- | The desired style
[_descriptorStyle] :: FontDescriptor -> !FontStyle
-- | Describe the basic stylistic properties of a font.
data FontStyle
FontStyle :: !Bool -> !Bool -> FontStyle
-- | If the font is bold.
[_fontStyleBold] :: FontStyle -> !Bool
-- | If the font is italic.
[_fontStyleItalic] :: FontStyle -> !Bool
loadFontCache :: MonadIO m => m FontMap
loadFont :: (HasLightEnv env, MonadIO m) => FontDescriptor -> Int -> LightT env m Font
withFont :: (HasLightEnv env, MonadIO m, MonadMask m) => FontDescriptor -> Int -> (Font -> LightT env m a) -> LightT env m a
-- | Monads in which IO computations may be embedded. Any monad
-- built by applying a sequence of monad transformers to the IO
-- monad will be an instance of this class.
--
-- Instances should satisfy the following laws, which state that
-- liftIO is a transformer of monads:
--
--
class Monad m => MonadIO (m :: Type -> Type)
-- | Lift a computation from the IO monad.
liftIO :: MonadIO m => IO a -> m a
instance Control.Monad.Catch.MonadCatch m => Control.Monad.Catch.MonadCatch (MiniLight.Light.LightT env m)
instance Control.Monad.Catch.MonadMask m => Control.Monad.Catch.MonadMask (MiniLight.Light.LightT env m)
instance Control.Monad.Catch.MonadThrow m => Control.Monad.Catch.MonadThrow (MiniLight.Light.LightT env m)
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (MiniLight.Light.LightT env m)
instance GHC.Base.Monad m => GHC.Base.Monad (MiniLight.Light.LightT env m)
instance GHC.Base.Applicative m => GHC.Base.Applicative (MiniLight.Light.LightT env m)
instance GHC.Base.Functor m => GHC.Base.Functor (MiniLight.Light.LightT env m)
instance GHC.Base.Monad m => Control.Monad.Reader.Class.MonadReader env (MiniLight.Light.LightT env m)
instance (GHC.Base.Monad m, MiniLight.Light.HasLightEnv env) => Control.Monad.Caster.MonadLogger (MiniLight.Light.LightT env m)
instance MiniLight.Light.HasLoopEnv MiniLight.Light.LoopEnv
instance MiniLight.Light.HasLightEnv MiniLight.Light.LightEnv
instance Data.Hashable.Class.Hashable Graphics.Text.TrueType.FontFolders.FontDescriptor
-- | This module provides many convenient operations for textures.
module MiniLight.Figure
-- | Lens for the center of a rectangle.
centerL :: Lens' (Rectangle a) (V2 a)
-- | Lens for the size of a rectangle.
sizeL :: Lens' (Rectangle a) (V2 a)
-- | Figure type carries a texture, sizing information and rotation
-- information.
data Figure
Figure :: Texture -> Rectangle Int -> Rectangle Int -> Double -> Figure
[texture] :: Figure -> Texture
[sourceArea] :: Figure -> Rectangle Int
[targetArea] :: Figure -> Rectangle Int
[rotation] :: Figure -> Double
getFigureSize :: Figure -> V2 Int
freeFigure :: MonadIO m => Figure -> m ()
union :: Rectangle Int -> Rectangle Int -> Rectangle Int
-- | Render a figure.
render :: (HasLightEnv env, MonadIO m, MonadMask m) => Figure -> LightT env m ()
-- | Render figures.
renders :: (HasLightEnv env, MonadIO m, MonadMask m) => [Figure] -> LightT env m ()
withBlendedText :: (MonadIO m, MonadMask m) => Font -> Text -> Color -> (Surface -> m a) -> m a
-- | Rendering typeclass provides basic operations for figures.
class Rendering r m | r -> m
-- | Change the place to be rendered.
translate :: Rendering r m => V2 Int -> r -> r
-- | Specify some area and clip the figure into the region.
clip :: Rendering r m => Rectangle Int -> r -> r
-- | Rotate a figure.
rotate :: Rendering r m => Double -> r -> r
-- | Create a text texture. Be careful: this is a slow operation,
-- use cache as long as you can.
text :: Rendering r m => Font -> V4 Word8 -> Text -> m r
-- | Create a texture from a png file. Be careful: this is a slow
-- operation, use cache as long as you can.
picture :: Rendering r m => FilePath -> m r
-- | Create a texture from a raw SDL texture.
fromTexture :: Rendering r m => Texture -> m r
-- | Create an outlined rectangle. Be careful: this is a slow
-- operation, use cache as long as you can.
rectangleOutline :: Rendering r m => V4 Word8 -> V2 Int -> m r
-- | Create a filled texture. Be careful: this is a slow operation,
-- use cache as long as you can.
rectangleFilled :: Rendering r m => V4 Word8 -> V2 Int -> m r
-- | Create an outlined triangle. Be careful: this is a slow
-- operation, use cache as long as you can.
triangleOutline :: Rendering r m => V4 Word8 -> V2 Int -> m r
instance MiniLight.Figure.Rendering MiniLight.Figure.Figure MiniLight.Light.MiniLight
module MiniLight.Component.Types
class HasComponentEnv env
-- | Lens to the unique id, which is provided for each component.
uidL :: HasComponentEnv env => Lens' env Text
-- | Emit a signal, which will be catched at the next frame.
emit :: (HasLoopEnv env, HasComponentEnv env, MonadIO m, EventType et) => et -> LightT env m ()
-- | CompoonentUnit typeclass provides a way to define a new component. Any
-- ComponentUnit instance can be embedded into Component
-- type.
class ComponentUnit c
-- | Updating a model.
update :: (ComponentUnit c, HasLightEnv env, HasLoopEnv env, HasComponentEnv env, MonadIO m, MonadMask m) => c -> LightT env m c
-- | Descirbes a view. The figures here would be cached. See also
-- useCache for the cache configuration.
figures :: (ComponentUnit c, HasLightEnv env, MonadIO m, MonadMask m) => c -> LightT env m [Figure]
-- | Drawing a figures.
draw :: (ComponentUnit c, HasLightEnv env, MonadIO m, MonadMask m) => c -> LightT env m ()
-- | Event handlers
onSignal :: (ComponentUnit c, HasLightEnv env, HasLoopEnv env, HasComponentEnv env, MonadIO m, MonadMask m) => Event -> c -> LightT env m c
-- | Return True if a cache stored in the previous frame should be
-- used.
useCache :: ComponentUnit c => c -> c -> Bool
-- | To be called just before clearing caches. If you want to destroy
-- cached textures for memory efficiency, override this method.
--
-- NB: Freeing SDL textures and figures are not performed
-- automatically. You must call freeFigure at your own risk.
beforeClearCache :: (ComponentUnit c, HasLightEnv env, MonadIO m, MonadMask m) => c -> [Figure] -> LightT env m ()
-- | A wrapper for ComponentUnit instances.
data Component
-- | Create a new component.
newComponent :: (ComponentUnit c, HasLightEnv env, MonadIO m, MonadMask m) => Text -> c -> LightT env m Component
-- | Get the size of a component.
getComponentSize :: (ComponentUnit c, HasLightEnv env, MonadIO m, MonadMask m) => c -> LightT env m (Rectangle Int)
-- | Get its unique id.
getUID :: Component -> Text
-- | Clear the previous model cache and reflect the current model.
propagate :: Component -> Component
instance MiniLight.Component.Types.ComponentUnit MiniLight.Component.Types.Component
module MiniLight.Component.Internal.Types
data ComponentConfig
ComponentConfig :: Text -> Value -> ComponentConfig
[name] :: ComponentConfig -> Text
[properties] :: ComponentConfig -> Value
data AppConfig
AppConfig :: Vector ComponentConfig -> Vector Text -> AppConfig
[app] :: AppConfig -> Vector ComponentConfig
[uuid] :: AppConfig -> Vector Text
-- | The type for component resolver
type Resolver = Text " Component Type" -> Text " UID" -> Value " Component Property" -> MiniLight (Either String Component)
-- | Generate an unique id.
newUID :: MonadIO m => m Text
-- | Create a component with given resolver.
createComponentBy :: Resolver -> Maybe Text -> ComponentConfig -> MiniLight (Either String Component)
instance GHC.Show.Show MiniLight.Component.Internal.Types.AppConfig
instance GHC.Classes.Eq MiniLight.Component.Internal.Types.AppConfig
instance GHC.Generics.Generic MiniLight.Component.Internal.Types.ComponentConfig
instance GHC.Show.Show MiniLight.Component.Internal.Types.ComponentConfig
instance GHC.Classes.Eq MiniLight.Component.Internal.Types.ComponentConfig
instance Data.Aeson.Types.FromJSON.FromJSON MiniLight.Component.Internal.Types.AppConfig
instance Data.Aeson.Types.ToJSON.ToJSON MiniLight.Component.Internal.Types.ComponentConfig
instance Data.Aeson.Types.FromJSON.FromJSON MiniLight.Component.Internal.Types.ComponentConfig
module MiniLight.Component.Loader
-- | The environment for config loader
data LoaderEnv
LoaderEnv :: Registry Component -> IORef AppConfig -> LoaderEnv
[registry] :: LoaderEnv -> Registry Component
[appConfig] :: LoaderEnv -> IORef AppConfig
class HasLoaderEnv c_aZhC
loaderEnv :: HasLoaderEnv c_aZhC => Lens' c_aZhC LoaderEnv
_appConfig :: HasLoaderEnv c_aZhC => Lens' c_aZhC (IORef AppConfig)
_registry :: HasLoaderEnv c_aZhC => Lens' c_aZhC (Registry Component)
-- | Load an config file and return the resolved AppConfig.
resolveConfig :: MonadIO m => FilePath -> m (Either String AppConfig)
-- | Load an config file and set in the environment. Calling this function
-- at once, this overrides all values in the environment. This will
-- generate an error log and skip the component if the configuration is
-- invalid. This function also assign unique IDs for each component,
-- using assignUID.
loadAppConfig :: (HasLightEnv env, HasLoaderEnv env, MonadIO m, MonadCatch m) => FilePath -> Resolver -> LightT env m ()
-- | Load the config file again and place the newly loaded components. This
-- is used for HCR (hot component replacement). Call loadAppConfig
-- first.
patchAppConfig :: (HasLightEnv env, HasLoaderEnv env, MonadIO m, MonadCatch m) => FilePath -> Resolver -> LightT env m ()
instance MiniLight.Component.Loader.HasLoaderEnv MiniLight.Component.Loader.LoaderEnv
-- | The package provides the configuration loader.
--
-- An configuration example:
--
--
-- _vars:
-- window:
-- width: 800
-- height: 600
-- app:
-- - name: message-layer
-- properties:
-- window:
-- image: resources/window-base.png
-- position:
-- x: 0
-- y: ${${var:window.height} - ${ref:..size.height}}
-- size:
-- width: ${var:window.width}
-- height: 150
--
--
-- Syntax
--
-- _vars
--
-- You can define a new variable. Use object syntax under the
-- _vars field.
--
-- The variables can be referenced in all siblings and under their
-- siblings to the _vars, in the variable syntax
-- ${var:_path_}.
--
-- Expr
--
-- In each field, you can specify an expression defined in the loader.
--
--
-- - ${}: enclose the expr by ${}, to tell the
-- parsers that the field is an expr not a plain string.
-- - ${ref:_path_}: specify any path to refer any other value.
-- The path resolution is performed once, not recursively resolved.
-- _path_ consists of field names splitted by a period. Use
-- double dots .. for a parent.
-- - ${var:_path_}: specify any path to value defined at the
-- field. _path_ consists of field names splitted by a
-- period.
-- - arithmetic operator: addition, subtraction, multiplication and
-- division (+,-,*,/) can also be used in ${}.
--
module MiniLight.Component
-- | MiniLight module exports all basic concepts and oprations except for
-- concrete components.
module MiniLight
-- | Run a Light monad.
runLightT :: (MonadIO m, MonadMask m) => LightT LightEnv m a -> m a
-- | The state in the mainloop.
data LoopState
LoopState :: LightEnv -> LoopEnv -> LoaderEnv -> LoopState
[light] :: LoopState -> LightEnv
[loop] :: LoopState -> LoopEnv
[loader] :: LoopState -> LoaderEnv
-- | Use defConfig for a default setting.
data LoopConfig
LoopConfig :: Maybe [Scancode] -> Maybe FilePath -> Maybe FilePath -> Resolver -> [Component] -> LoopConfig
-- | Set Nothing if all keys should be watched. See also
-- LoopState.
[watchKeys] :: LoopConfig -> Maybe [Scancode]
-- | Specify a yaml file which describes component settings. See
-- Component for the yaml syntax.
[appConfigFile] :: LoopConfig -> Maybe FilePath
-- | The directory path to be watched. If set, the config file modification
-- will replace the component dynamically.
[hotConfigReplacement] :: LoopConfig -> Maybe FilePath
-- | Your custom mappings between a component name and its type.
[componentResolver] :: LoopConfig -> Resolver
-- | The components here would be added during the initialization.
[additionalComponents] :: LoopConfig -> [Component]
-- | Default configurations for the mainloop. You need to set
-- componentResolver if you use a component.
defConfig :: LoopConfig
-- | Run a mainloop. In a mainloop, components and events are managed.
--
-- Components in a mainloop: draw ~ update ~ (user-defined function) ~
-- event handling
runMainloop :: (HasLightEnv env, HasLightEnv env', HasLoopEnv env', HasLoaderEnv env', MonadIO m, MonadMask m) => (env -> LoopEnv -> LoaderEnv -> env') -> LoopConfig -> s -> (s -> LightT env' m s) -> LightT env m ()
-- | Type synonym to the minimal type of the mainloop
type MiniLoop = LightT LoopState IO
-- | Same as runMainloop but fixing the type.
runMiniloop :: LoopConfig -> s -> (s -> MiniLoop s) -> MiniLight ()
instance MiniLight.HasLoopState MiniLight.LoopState
instance MiniLight.Light.HasLightEnv MiniLight.LoopState
instance MiniLight.Light.HasLoopEnv MiniLight.LoopState
instance MiniLight.Component.Loader.HasLoaderEnv MiniLight.LoopState
instance MiniLight.Light.HasLightEnv env' => MiniLight.Light.HasLightEnv (env, env')
instance MiniLight.Light.HasLoopEnv env' => MiniLight.Light.HasLoopEnv (env, env')
instance MiniLight.Component.Loader.HasLoaderEnv env' => MiniLight.Component.Loader.HasLoaderEnv (env, env')
instance MiniLight.Component.Types.HasComponentEnv (Data.Text.Internal.Text, env)
instance Data.Hashable.Class.Hashable SDL.Input.Keyboard.Codes.Scancode
module Data.Config.Font
data Config
Config :: FontDescriptor -> Int -> V4 Word8 -> Config
[descriptor] :: Config -> FontDescriptor
[size] :: Config -> Int
[color] :: Config -> V4 Word8
-- | Load a system font from Config type.
loadFontFrom :: Config -> MiniLight Font
instance Data.Aeson.Types.FromJSON.FromJSON Data.Config.Font.Config
module Data.Component.MessageEngine
data MessageEngine
MessageEngine :: Font -> Int -> Int -> Figure -> Bool -> Config -> MessageEngine
[font] :: MessageEngine -> Font
[counter] :: MessageEngine -> Int
[rendered] :: MessageEngine -> Int
[textTexture] :: MessageEngine -> Figure
[finished] :: MessageEngine -> Bool
[config] :: MessageEngine -> Config
data Config
Config :: Text -> Bool -> V4 Word8 -> FontDescriptor -> Int -> Config
[messages] :: Config -> Text
[static] :: Config -> Bool
[color] :: Config -> V4 Word8
[fontConf] :: Config -> FontDescriptor
[fontSize] :: Config -> Int
new :: Config -> MiniLight MessageEngine
instance MiniLight.Component.Types.ComponentUnit Data.Component.MessageEngine.MessageEngine
instance Data.Aeson.Types.FromJSON.FromJSON Data.Component.MessageEngine.Config
module Data.Component.Button
data Button
Button :: Font -> Config -> Button
[font] :: Button -> Font
[config] :: Button -> Config
data ButtonEvent
Click :: ButtonEvent
data Config
Config :: V2 Int -> Text -> V4 Word8 -> FontDescriptor -> Int -> Config
[size] :: Config -> V2 Int
[label] :: Config -> Text
[color] :: Config -> V4 Word8
[fontConf] :: Config -> FontDescriptor
[fontSize] :: Config -> Int
new :: Config -> MiniLight Button
instance MiniLight.Component.Types.ComponentUnit Data.Component.Button.Button
instance Data.Aeson.Types.FromJSON.FromJSON Data.Component.Button.Config
instance MiniLight.Event.EventType Data.Component.Button.ButtonEvent
-- | 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}
--
module Data.Component.Basic
-- | Basic config type
data Config
Config :: V2 Int -> V2 Int -> Config
[size] :: Config -> V2 Int
[position] :: Config -> V2 Int
-- | This wrapper function is useful when you write your component config
-- parser.
wrapConfig :: (Config -> a -> Parser r) -> (Object -> Parser a) -> Value -> Parser r
-- | The rectangle region of the component.
areaRectangle :: Config -> Rectangle Int
-- | Basic signal type.
data Signal
[MousePressed] :: V2 Int -> Signal
[MouseReleased] :: V2 Int -> Signal
[MouseOver] :: V2 Int -> Signal
-- | This automatically applies basic configuration such as: position.
wrapFigures :: Config -> [Figure] -> [Figure]
-- | This wrapper function is useful when you write your own
-- onSignal component.
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
-- | Basic signaling function.
emitBasicSignal :: (HasLightEnv env, HasLoopEnv env, HasComponentEnv env, MonadIO m) => Event -> Config -> LightT env m ()
contains :: (Ord a, Num a) => Rectangle a -> V2 a -> Bool
instance MiniLight.Event.EventType Data.Component.Basic.Signal
instance Data.Aeson.Types.FromJSON.FromJSON Data.Component.Basic.Config
module Data.Component.Layer
data Layer
Layer :: Figure -> Config -> Layer
[layer] :: Layer -> Figure
[config] :: Layer -> Config
data Config
Config :: Config -> FilePath -> Config
[basic] :: Config -> Config
[image] :: Config -> FilePath
new :: Config -> MiniLight Layer
newNineTile :: Config -> MiniLight Layer
instance MiniLight.Component.Types.ComponentUnit Data.Component.Layer.Layer
instance Data.Aeson.Types.FromJSON.FromJSON Data.Component.Layer.Config
module Data.Component.Selection
data Selection
Selection :: Layer -> Font -> Maybe Int -> Config -> Selection
[layer] :: Selection -> Layer
[font] :: Selection -> Font
[hover] :: Selection -> Maybe Int
[conf] :: Selection -> Config
hoverL :: Lens' Selection (Maybe Int)
data Config
Config :: Config -> Vector Text -> Config -> FilePath -> Config
[basic] :: Config -> Config
[labels] :: Config -> Vector Text
[fontConfig] :: Config -> Config
[image] :: Config -> FilePath
new :: Config -> MiniLight Selection
instance MiniLight.Component.Types.ComponentUnit Data.Component.Selection.Selection
instance Data.Aeson.Types.FromJSON.FromJSON Data.Component.Selection.Config
module Data.Component.AnimationLayer
data AnimationLayer
AnimationLayer :: Layer -> Int -> V2 Int -> Config -> AnimationLayer
[layer] :: AnimationLayer -> Layer
[counter] :: AnimationLayer -> Int
[tileSize] :: AnimationLayer -> V2 Int
[config] :: AnimationLayer -> Config
data Config
Config :: Config -> V2 Int -> Int -> Config
[layerConf] :: Config -> Config
[division] :: Config -> V2 Int
[interval] :: Config -> Int
new :: Config -> MiniLight AnimationLayer
instance MiniLight.Component.Types.ComponentUnit Data.Component.AnimationLayer.AnimationLayer
instance Data.Aeson.Types.FromJSON.FromJSON Data.Component.AnimationLayer.Config
module Data.Component.MessageLayer
data MessageLayer
MessageLayer :: MessageEngine -> Layer -> AnimationLayer -> Config -> MessageLayer
[messageEngine] :: MessageLayer -> MessageEngine
[layer] :: MessageLayer -> Layer
[cursor] :: MessageLayer -> AnimationLayer
[config] :: MessageLayer -> Config
engineL :: Lens' MessageLayer MessageEngine
cursorL :: Lens' MessageLayer AnimationLayer
data Config
Config :: Config -> Config -> Config -> Config
[engine] :: Config -> Config
[window] :: Config -> Config
[next] :: Config -> Config
new :: Config -> MiniLight MessageLayer
instance MiniLight.Component.Types.ComponentUnit Data.Component.MessageLayer.MessageLayer
instance Data.Aeson.Types.FromJSON.FromJSON Data.Component.MessageLayer.Config
-- | This module provides the default resolver for pre-defined components.
module Data.Component.Resolver
-- | Pre-defined resolver supports all components in this library.
resolver :: Resolver
foldResult :: (String -> b) -> (a -> b) -> Result a -> b