packages feed

ansi-terminal-game 1.2.0.0 → 1.2.1.0

raw patch · 6 files changed

+138/−122 lines, 6 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

+ CHANGES view
@@ -0,0 +1,121 @@+1.2.1.0+-------++- Fixed textBox, textBoxHyphen bug (boxes were not transparent, contrary+  to what stated in docs) (reported by sm).+- Released lun 11 ott 2021, 22:29:40++1.2.0.0+-------++- Added textBoxHyphen and textBoxHyphenLiquid and a handful of `Hypenator`s.+  This will allow you to have autohyphenation in textboxes. Compare:+    Rimasi un po’ a meditare nel buio      Rimasi un po’ a meditare nel buio+    velato appena dal barlume azzurrino    velato appena dal barlume azzurrino+    del fornello a gas, su cui sobbol-     del fornello a gas, su cui+    liva quieta la pentola.                sobbolliva quieta la pentola.+- Switched `Width`, `Height`, `Row`, `Col` from `Integer` to `Int`.+  This is unfortunate, but will make playing with `base` simpler. I will+  switch it back once `Prelude` handles both integers appropriately+  or exports the relevant function. (request by sm)+- Changed signature for `box`, `textBox` and `textBoxLiquid`. Now+  width/height parameters come *before* the character/string. E.g.:+    textBoxLiquid :: String -> Width -> Plane  -- this was before+    textBoxLiquid :: Width -> String -> Plane  -- this is now+  This felt more ergonomic while writing games.++1.1.1.0+-------++- Added (***) (centre blit) (request by sm)+- Released gio 30 set 2021, 12:29:22++1.1.0.0+-------++- Added Plane justapoxition functions (===, |||, vcat, hcat).+- Added `word` and and `textBoxLiquid` drawing functions.+- Added `subPlane`, `displaySize` Plane functions.+- Removed unused `trimPlane`.+- Sanitized non-ASCII chars on Win32 console.+- Wed 03 Feb 2021 18:41:20 CET++1.0.0.0+-------++- Milestone release.+- Beefed up documentation.+- Released Sun 08 Dec 2019 04:19:33 CET++0.7.2.0+-------++- Fixed 0.7.1.0 unbumped dependency.+- Released Fri 22 Nov 2019 16:51:25 CET++0.7.1.0+-------++- Fixed 0.7.0.0 (deprecated) interface.+- Released Fri 22 Nov 2019 14:51:40 CET++0.7.0.0+-------++- Simplified Animation interface (breaking changes).+- Added `creaLoopAnimation` and `creaStaticAnimation`.+- Released Fri 22 Nov 2019 14:40:44 CET++0.6.1.0+-------++- Reworked Timers/Animations interface and documentation.+- Added `lapse` (for Timers/Animations).+- Released Fri 22 Nov 2019 01:03:37 CET++0.6.0.1+-------++- Add public repo (requested by sm).+- Released Tue 19 Nov 2019 22:38:34 CET++0.6.0.0+-------++- Add random generation functions.+- Released Sun 10 Nov 2019 13:44:32 CET++0.5.0.0+-------++- Add `setupGame` to setup games before playtesting (skip menus, etc.).+- Fixed screen corruption on Windows.+- Released Fri 08 Nov 2019 13:52:39 CET++0.4.0.0+-------++- Exposed new functions in API.+- Greatly improved haddock documentation.+- Released Tue 25 Jun 2019 16:08:53 CEST++0.2.1.0+-------++- Improved haddock documentation a bit.+- Cleanup runs regardless of exception.+- Released on Sun 18 Mar 2018 03:04:07 CET.++0.2.0.0+-------++- Added dependencies constraints.+- Removed internal module.+- Fixed changelog.+- Released on Fri 16 Mar 2018 00:42:41 CET.++0.1.0.0+-------++- Initial release.+- Released on Fri 16 Mar 2018 00:33:18 CET.
ansi-terminal-game.cabal view
@@ -1,5 +1,5 @@ name:                ansi-terminal-game-version:             1.2.0.0+version:             1.2.1.0 synopsis:            sdl-like functions for terminal applications, based on                      ansi-terminal description:         Library which aims to replicate standard 2d game@@ -19,7 +19,7 @@ category:            Game build-type:          Simple extra-source-files:  README,-                     changes.txt,+                     CHANGES,                      test/alone-record-test.gr cabal-version:       >=1.10 
− changes.txt
@@ -1,114 +0,0 @@-1.2.0.0----------- Added textBoxHyphe and textBoxHyphenLiquid and a handful of `Hypenator`s.-  This will allow you to have autohyphenation in textboxes. Compare:-    Rimasi un po’ a meditare nel buio      Rimasi un po’ a meditare nel buio-    velato appena dal barlume azzurrino    velato appena dal barlume azzurrino-    del fornello a gas, su cui sobbol-     del fornello a gas, su cui-    liva quieta la pentola.                sobbolliva quieta la pentola.-- Switched `Width`, `Height`, `Row`, `Col` from `Integer` to `Int`.-  This is unfortunate, but will make playing with `base` simpler. I will-  switch it back once `Prelude` handles both integers appropriately-  or exports the relevant function. (request by sm)-- Changed signature for `box`, `textBox` and `textBoxLiquid`. Now-  width/height parameters come *before* the character/string. E.g.:-    textBoxLiquid :: String -> Width -> Plane  -- this was before-    textBoxLiquid :: Width -> String -> Plane  -- this is now-  This felt more ergonomic while writing games.--1.1.1.0----------- Added (***) (centre blit) (request by sm)-- Released gio 30 set 2021, 12:29:22--1.1.0.0----------- Added Plane justapoxition functions (===, |||, vcat, hcat).-- Added `word` and and `textBoxLiquid` drawing functions.-- Added `subPlane`, `displaySize` Plane functions.-- Removed unused `trimPlane`.-- Sanitized non-ASCII chars on Win32 console.-- Wed 03 Feb 2021 18:41:20 CET--1.0.0.0----------- Milestone release.-- Beefed up documentation.-- Released Sun 08 Dec 2019 04:19:33 CET--0.7.2.0----------- Fixed 0.7.1.0 unbumped dependency.-- Released Fri 22 Nov 2019 16:51:25 CET--0.7.1.0----------- Fixed 0.7.0.0 (deprecated) interface.-- Released Fri 22 Nov 2019 14:51:40 CET--0.7.0.0----------- Simplified Animation interface (breaking changes).-- Added `creaLoopAnimation` and `creaStaticAnimation`.-- Released Fri 22 Nov 2019 14:40:44 CET--0.6.1.0----------- Reworked Timers/Animations interface and documentation.-- Added `lapse` (for Timers/Animations).-- Released Fri 22 Nov 2019 01:03:37 CET--0.6.0.1----------- Add public repo (requested by sm).-- Released Tue 19 Nov 2019 22:38:34 CET--0.6.0.0----------- Add random generation functions.-- Released Sun 10 Nov 2019 13:44:32 CET--0.5.0.0----------- Add `setupGame` to setup games before playtesting (skip menus, etc.).-- Fixed screen corruption on Windows.-- Released Fri 08 Nov 2019 13:52:39 CET--0.4.0.0----------- Exposed new functions in API.-- Greatly improved haddock documentation.-- Released Tue 25 Jun 2019 16:08:53 CEST--0.2.1.0----------- Improved haddock documentation a bit.-- Cleanup runs regardless of exception.-- Released on Sun 18 Mar 2018 03:04:07 CET.--0.2.0.0----------- Added dependencies constraints.-- Removed internal module.-- Fixed changelog.-- Released on Fri 16 Mar 2018 00:42:41 CET.--0.1.0.0----------- Initial release.-- Released on Fri 16 Mar 2018 00:33:18 CET.
src/Terminal/Game.hs view
@@ -38,6 +38,7 @@ --      play, to speed things up -- todo (da sm) hot reload for game (see IHP web app) [suggestion] -- todo (da sm) sound with sox+-- todo (da sm) add tick counter   module Terminal.Game ( -- * Running
src/Terminal/Game/Draw.hs view
@@ -136,7 +136,7 @@     where           cells = [((r, c), chr) | r <- [1..h], c <- [1..w]] --- | A @1x1@ cell.+-- | A 1×1 @Plane@. cell :: Char -> Plane cell ch = box 1 1 ch @@ -154,8 +154,7 @@  -- | A text-box. Assumes @' '@s are transparent. textBox :: Width -> Height -> String -> Plane-textBox w h cs = let pt = textBoxLiquid w cs-                 in  blankPlane w h F.& (1, 1) % pt+textBox w h cs = frameTrans w h (textBoxLiquid w cs)  -- | Like 'textBox', but tall enough to fit @String@. textBoxLiquid :: Width -> String -> Plane@@ -173,8 +172,7 @@ -- Notice how in the left box «sobbolliva» is broken in two. This -- can be useful and aesthetically pleasing when textboxes are narrow. textBoxHyphen :: Hyphenator -> Width -> Height -> String -> Plane-textBoxHyphen hp w h cs = let pt = textBoxHyphenLiquid hp w cs-                 in  blankPlane w h F.& (1, 1) % pt+textBoxHyphen hp w h cs = frameTrans w h (textBoxHyphenLiquid hp w cs)  -- | As 'textBoxLiquid', but hypenated. textBoxHyphenLiquid :: Hyphenator -> Width -> String -> Plane@@ -207,4 +205,9 @@ seqCells p cells = updatePlane p (map f cells)     where           f (cds, chr) = (cds, creaCell chr)++-- paste plane on a blank one, and make ' ' transparent+frameTrans :: Width -> Height -> Plane -> Plane+frameTrans w h p = let bt = makeTransparent ' ' (blankPlane w h)+                   in bt F.& (1, 1) % p 
test/Terminal/Game/DrawSpec.hs view
@@ -27,11 +27,16 @@       planeSize ps `shouldBe` (6, 2)     it "textBoxLiquid fits the whole string" $       planeSize pl `shouldBe` (6, 3)+    it "textBox should make a transparent plane" $+      let p1 = textBox 6 1 "a c e "+          p2 = textBox 6 1 " b d f"+          pc = p1 & (1, 1) % p2+      in planePaper pc `shouldBe` "abcdef\n"    describe "textBoxHypen" $ do     let tbh = textBoxHyphen spanish 8 2 "Con pianito"     it "hyphens long words" $-      planePaper tbh `shouldSatisfy` (elem '-')+      planePaper tbh `shouldSatisfy` elem '-'    describe "***" $ do     let a  = stringPlane ".\n.\n.\n"