aztecs-sdl-text 0.3.0 → 0.4.0
raw patch · 2 files changed
+12/−11 lines, 2 filesdep ~aztecsdep ~aztecs-sdl
Dependency ranges changed: aztecs, aztecs-sdl
Files
- aztecs-sdl-text.cabal +5/−5
- src/Aztecs/SDL/Text.hs +7/−6
aztecs-sdl-text.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: aztecs-sdl-text-version: 0.3.0+version: 0.4.0 license: BSD-3-Clause license-file: LICENSE maintainer: matt@hunzinger.me@@ -11,12 +11,12 @@ object (e.g. sword, monster, etc), in the game has a unique EntityId. Each entity has various Components associated with it (material, weight, damage, etc). Systems act on entities which have the required Components.-homepage: https://github.com/matthunz/aztecs+homepage: https://github.com/aztecs-hs/aztecs-sdl-text category: Game Engine source-repository head type: git- location: https://github.com/matthunz/aztecs.git+ location: https://github.com/aztecs-hs/aztecs-sdl-text.git library exposed-modules:@@ -26,8 +26,8 @@ ghc-options: -Wall build-depends: base >=4.6 && <5,- aztecs >= 0.5,- aztecs-sdl >= 0.2,+ aztecs >= 0.7 && <0.8,+ aztecs-sdl >= 0.4 && <0.5, containers >=0.6, deepseq >=1, mtl >=2,
src/Aztecs/SDL/Text.hs view
@@ -31,6 +31,7 @@ import Aztecs.SDL (Surface (..)) import Control.Arrow (returnA, (>>>)) import Control.DeepSeq+import Control.Monad.IO.Class import Data.Maybe (mapMaybe) import qualified Data.Text as T import GHC.Generics (Generic)@@ -59,15 +60,15 @@ return Surface {sdlSurface = s, surfaceBounds = Nothing} -- | Setup SDL TrueType-Font (TTF) support.-setup :: Schedule IO () ()-setup = system (Asset.setup @Font) >>> task (const F.initialize)+setup :: (MonadIO m) => Schedule m () ()+setup = system (Asset.setup @Font) >>> access (const F.initialize) -- | Load font assets.-load :: Schedule IO () ()+load :: (MonadIO m) => Schedule m () () load = Asset.loadAssets @Font -- | Draw text components.-draw :: Schedule IO () ()+draw :: (MonadIO m) => Schedule m () () draw = proc () -> do !texts <- reader $@@ -86,13 +87,13 @@ (\(eId, t, maybeSurface) -> (eId,textContent t,maybeSurface,) <$> lookupAsset (textFont t) assetServer) texts !draws <-- task $+ access $ mapM ( \(eId, content, maybeSurface, font) -> do case maybeSurface of Just lastSurface -> freeSurface $ sdlSurface lastSurface Nothing -> return ()- surface <- drawText content font+ surface <- liftIO $ drawText content font return (eId, surface) ) -<