ansi-terminal-game 1.9.1.3 → 1.9.2.0
raw patch · 3 files changed
+46/−6 lines, 3 filesdep +file-embedPVP ok
version bump matches the API change (PVP)
Dependencies added: file-embed
API changes (from Hackage documentation)
+ Terminal.Game: data ByteString
+ Terminal.Game: embedDir :: FilePath -> Q Exp
+ Terminal.Game: embedFile :: FilePath -> Q Exp
+ Terminal.Game: unpack :: ByteString -> [Char]
Files
- NEWS +22/−0
- ansi-terminal-game.cabal +7/−5
- src/Terminal/Game.hs +17/−1
NEWS view
@@ -1,3 +1,25 @@+1.9.2.0+-------++- This version of a-t-g introduces convenience file-embedding functions+ `embedFile` and `embedDir`.+ An example on how this can be useful: suppose you are working on an ASCII+ map using `tiled` map editor. You could save the map in a `data/map` and+ then with `embedFile`++ {-# LANGUAGE TemplateHaskell #-}++ mapBS :: ByteString+ mapBS = $(embedFile "data/map/gamma-labs.map")++ gammaLabs :: GameMap+ gammaLabs = parseMap mapBS++ having it as a pure value in your program, and being able to ship a+ single binary instead of a zipped archive.+ `unpack :: ByteString -> String` and the `ByteString` type itself are+ also re-exported as helpers.+ 1.9.1.3 -------
ansi-terminal-game.cabal view
@@ -1,5 +1,5 @@ name: ansi-terminal-game-version: 1.9.1.3+version: 1.9.2.0 synopsis: cross-platform library for terminal games description: Library which aims to replicate standard 2d game functions (blit, ticks, timers, etc.) in a terminal@@ -55,11 +55,12 @@ build-depends: base == 4.*, ansi-terminal >= 0.11 && < 1.1, array == 0.5.*,- bytestring >= 0.10 && < 0.12,+ bytestring >= 0.10 && < 0.13, cereal == 0.5.*, clock >= 0.7 && < 0.9,- containers == 0.6.*,+ containers >=0.6 && <0.8, exceptions == 0.10.*,+ file-embed >= 0.0.15 && < 0.1, linebreak == 1.1.*, mintty == 0.1.*, mtl >=2.2 && <2.4,@@ -109,11 +110,12 @@ build-depends: base == 4.*, ansi-terminal >= 0.11 && < 1.1, array == 0.5.*,- bytestring >= 0.10 && < 0.12,+ bytestring >= 0.10 && < 0.13, cereal == 0.5.*, clock >= 0.7 && < 0.9,- containers == 0.6.*,+ containers >=0.6 && <0.8, exceptions == 0.10.*,+ file-embed >= 0.0.15 && < 0.1, linebreak == 1.1.*, mintty == 0.1.*, mtl >=2.2 && <2.4,
src/Terminal/Game.hs view
@@ -23,6 +23,8 @@ -- todo you should check again on win the «press exit to continue» test -- todo write that ascii/latin-1/greek letters should be ok on win +-- todo rewrite test w/ an internal library method+ module Terminal.Game ( -- * Running TPS, FPS,@@ -123,7 +125,6 @@ -- emulators/multiplexers. -- Use them only on your machine or when you are sure -- of the terminal you are targetting.- S.Colour, rgbColor, paletteColor, S.sRGB24, S.sRGBBounded, S.sRGB, S.sRGB24read, xterm6LevelRGB, xterm24LevelGray, xtermSystem,@@ -140,11 +141,25 @@ -- (autorestarting your game when source files change) -- is illustrated in @example/MainHotReload.hs@. + -- * Embedding files++ -- | Embedding files is convenient when working on+ -- assets separately and still wanting to ship a+ -- single binary. Remember to add this pragma to+ -- the top of your module:+ --+ -- > {-# LANGUAGE TemplateHaskell #-}+ embedFile,+ embedDir,+ BC.ByteString,+ BC.unpack,+ -- * Cross platform -- $xcompat ) where +import Data.FileEmbed import System.Console.ANSI import Terminal.Game.Animation import Terminal.Game.Draw@@ -155,6 +170,7 @@ import Text.LineBreak import qualified Control.Monad as CM+import qualified Data.ByteString.Char8 as BC import qualified Data.Colour.SRGB as S -- $origins