packages feed

minilight 0.1.0 → 0.1.1

raw patch · 5 files changed

+22/−5 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ MiniLight.Component.Types: beforeClearCache :: (ComponentUnit c, HasLightEnv env, MonadIO m, MonadMask m) => c -> [Figure] -> LightT env m ()

Files

CHANGELOG.md view
@@ -1,5 +1,11 @@ # Revision history for minilight +## 0.1.1 -- 2019-04-14++* Fixes:+    * Cache strategy+    * Button component and button-counter example now works correctly.+ ## 0.1.0 -- 2019-04-14  * First version.
examples/button-counter.hs view
@@ -29,6 +29,8 @@     return $ comp { counter = counter comp + 1 }   onSignal _ comp = return comp +  beforeClearCache _ figs = mapM_ freeFigure figs+ new :: MiniLight Button new = do   font <- loadFont (FontDescriptor "IPAGothic" (FontStyle False False)) 22
minilight.cabal view
@@ -3,7 +3,7 @@ --   For further documentation, see http://haskell.org/cabal/users-guide/  name:                minilight-version:             0.1.0+version:             0.1.1 synopsis:            A SDL2-based graphics library, batteries-included. description:   This package provides the wheel for a graphical application or a game.
src/MiniLight/Component/Button.hs view
@@ -36,6 +36,8 @@     return comp   onSignal _ comp = return comp +  beforeClearCache _ figs = mapM_ freeFigure figs+ data Config = Config {   size :: Vect.V2 Int,   label :: T.Text,
src/MiniLight/Component/Types.hs view
@@ -30,6 +30,10 @@   draw comp = liftMiniLight . renders =<< figures comp   {-# INLINE draw #-} +  -- | Event handlers+  onSignal :: (HasLightEnv env, MonadIO m, MonadMask m) => Event -> c -> LightT env m c+  onSignal _ = return+   -- | Return @True@ if a cache stored in the previous frame should be used.   useCache     :: c  -- ^ A model value in the previous frame@@ -37,9 +41,12 @@     -> Bool   useCache _ _ = False -  -- | Event handlers-  onSignal :: (HasLightEnv env, MonadIO m, MonadMask m) => Event -> c -> LightT env m c-  onSignal _ = return+  -- | 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 :: (HasLightEnv env, MonadIO m, MonadMask m) => c -> [Figure] -> LightT env m ()+  beforeClearCache _ _ = return ()  -- | A wrapper for 'ComponentUnit' instances. data Component = forall c. ComponentUnit c => Component {@@ -83,7 +90,7 @@       then renders =<< liftIO (readIORef ref)       else do         figs <- liftIO (readIORef ref)-        mapM_ freeFigure figs+        beforeClearCache comp figs          figs <- figures comp         renders figs