packages feed

ansi-terminal-game 1.1.0.0 → 1.1.1.0

raw patch · 6 files changed

+43/−5 lines, 6 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Terminal.Game: (***) :: Plane -> Plane -> Plane
- Terminal.Game: infixl 6 ===
+ Terminal.Game: infixl 6 ***

Files

ansi-terminal-game.cabal view
@@ -1,5 +1,5 @@ name:                ansi-terminal-game-version:             1.1.0.0+version:             1.1.1.0 synopsis:            sdl-like functions for terminal applications, based on                      ansi-terminal description:         Library which aims to replicate standard 2d game
changes.txt view
@@ -1,3 +1,9 @@+1.1.1.0+-------++- Added (***) (centre blit) (request by sm)+- Released gio 30 set 2021, 12:29:22+ 1.1.0.0 ------- 
src/Terminal/Game.hs view
@@ -17,17 +17,30 @@ -- Basic col-on-black ASCII terminal, operations. -- Only module to be imported. +-- todo a-t-g senza timer -- todo test that handlers are closed in case of errr [test] -- todo invert # invert (doppio) si elimina? [test] [design] -- todo schermo piccolo, si centra verticalmente? [test]+-- todo metti in a-t-g [design] la formula «menu, poi fai questo, poi+--      ritorni, astrai questo pattern  -- todo timer in contrib o altro modulo? -- todo qptain e jimreed, implement normal movement -- todo [design] javascript backend -- todo controlla caratteri strani su windows, prova con morganw e ibispi--- todo boxratio, blitcenter e blitTL etc in ansi-terminal-game?+-- todo boxratio, blitcenter e blit top left etc in ansi-terminal-game? [u:2] -- todo autoresize terminal (or get-term-size?)+-- todo ranSelect :: [a] -> m a in a-t-g [design]+-- todo random shuffle in atg?+-- todo (da sm) sm any plans to expose more of these bits in a future+--      release, making ansi-terminal-game more of a full game engine ?+--      [suggestion]+-- todo (da sm) music [suggestion]+-- todo (da sm) I'm also wondering if I can adjust the frame rate during+--      play, to speed things up+-- todo (da sm) hot reload for game (see IHP web app) [suggestion] + module Terminal.Game ( -- * Running                        FPS,                        Event(..),@@ -91,10 +104,12 @@                        (%), (&), (#),                        subPlane,                        mergePlanes,-                       (|||), (===), hcat, vcat,                        cell, word, box, textBox, textBoxLiquid,                        Color(..), ColorIntensity(..),                        color, bold, invert,++                       -- *** Declarative drawing+                       (|||), (===), (***), hcat, vcat,                         -- * Testing                        testGame,
src/Terminal/Game/Draw.hs view
@@ -86,6 +86,16 @@                            [((1,1),    a),                             ((ha+1,1), b)] +-- | @a *** b@ blits @b@ in the centre of @a@.+(***) :: Plane -> Plane -> Plane+(***) a b = let (aw, ah) = planeSize a+                (bw, bh) = planeSize b+                r = quot (ah - bh) 2 + 1+                c = quot (aw - bw) 2 + 1+            in           a F.&+                (r, c) % b++ -- | Place a list of 'Plane's side-by-side, horizontally. hcat :: [Plane] -> Plane hcat ps = L.foldl' (|||) (blankPlane 0 0) ps@@ -94,7 +104,7 @@ vcat :: [Plane] -> Plane vcat ps = L.foldl' (===) (blankPlane 0 0) ps -infixl 6 |||, ===+infixl 6 |||, ===, ***   ------------
src/Terminal/Game/Layer/Object/IO.hs view
@@ -188,7 +188,7 @@              "",              "    ghc-options:      -threaded",              "",-             "in your .cabal file (executale section) and you will be fine!"]+             "in your .cabal file (executable section) and you will be fine!"]  -- clears screen clearScreen :: IO ()
test/Terminal/Game/DrawSpec.hs view
@@ -26,3 +26,10 @@       planeSize ps `shouldBe` (6, 2)     it "textBoxLiquid fits the whole string" $       planeSize pl `shouldBe` (6, 3)++  describe "***" $ do+    let a  = stringPlane ".\n.\n.\n"+        b  = stringPlane "*"+        c  = stringPlane ".\n*\n.\n"+    it "blits b in the centre of a" $+      a *** b `shouldBe` c