ansi-terminal-game 1.6.0.0 → 1.6.0.1
raw patch · 7 files changed
+18/−15 lines, 7 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Terminal.Game: simpleGame :: forall s. (Width, Height) -> TPS -> s -> (s -> Event -> s) -> (s -> Plane) -> (s -> Bool) -> Game s
+ Terminal.Game: simpleGame :: Dimensions -> TPS -> s -> (s -> Event -> s) -> (s -> Plane) -> (s -> Bool) -> Game s
Files
- CHANGES +9/−2
- ansi-terminal-game.cabal +1/−1
- example/Balls.hs +1/−1
- src/Terminal/Game.hs +2/−2
- src/Terminal/Game/Draw.hs +1/−1
- src/Terminal/Game/Layer/Imperative.hs +3/−7
- src/Terminal/Game/Plane.hs +1/−1
CHANGES view
@@ -1,12 +1,19 @@+1.6.0.1+-------++- released lun 15 nov 2021, 00:35:41+- minor documentation / spelling fixes+ 1.6.0.0 ------- Summary and tl;dr migration guide: - This version introduces a breaking changes in the main way to make- a `Game`. I will detail the changes below, but first a two-lines+ a `Game`. I will detail the changes below, but first a three-lines migration guide: the only thing you should have to do is to replace your `Game`- data constructor with `simpleGame` smart constructor.+ data constructor with `simpleGame` smart constructor, and substitute+ the first to `c` `r` arguments (col/row) with a `(c, r)` tuple. And of course, if you are interested in displaying FPS and adapt to screen size modifications at game-time (“liquid” layout), read along!
ansi-terminal-game.cabal view
@@ -1,5 +1,5 @@ name: ansi-terminal-game-version: 1.6.0.0+version: 1.6.0.1 synopsis: sdl-like functions for terminal applications, based on ansi-terminal description: Library which aims to replicate standard 2d game
example/Balls.hs view
@@ -27,7 +27,7 @@ This game runs at 60 FPS, you will almost surely never need such- a high TPS! 15-20 is more than enough in most cases.+ a high TPS! 15–20 is more than enough in most cases. -} main :: IO ()
src/Terminal/Game.hs view
@@ -152,8 +152,8 @@ -- $origins -- Placing a plane is sometimes more convenient if the coordinates origin--- is a corner other than top-left (e.g. «Paste this plane one row from--- bottom-left corner»). These combinators — meant to be used instead of '%'+-- is a corner other than top-left (e.g. “Paste this plane one row from+-- bottom-left corner”). These combinators — meant to be used instead of '%' -- — allow you to do so. Example: -- -- @
src/Terminal/Game/Draw.hs view
@@ -170,7 +170,7 @@ -- sobbolliva quieta la pentola. liva quieta la pentola. -- @ ----- Notice how in the right box «sobbolliva» is broken in two. This+-- Notice how in the right 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 = frameTrans w h (textBoxHyphenLiquid hp w cs)
src/Terminal/Game/Layer/Imperative.hs view
@@ -46,8 +46,7 @@ -- are the function dealing with logic and the drawing one. Check @alone@ -- (you can compile it with @cabal run -f examples alone@) to see a basic -- game in action. If you want more control, look at 'Game'.-simpleGame :: forall s.- (Width, Height) -- ^ Gamescreen dimensions, in columns and+simpleGame :: Dimensions -- ^ Gamescreen dimensions, in columns and -- rows. Asks the player to resize their -- terminal if it is too small. -> TPS -- ^ Ticks per second. Since the 2D “char@@ -61,12 +60,12 @@ -> Game s simpleGame (sw, sh) tps s lf df qf = Game tps s lf' df' qf where- lf' :: GEnv -> s -> Event -> s+ -- lf' :: GEnv -> s -> Event -> s lf' wen ws we | isSmaller (eTermDims wen) = ws | otherwise = lf ws we - df' :: GEnv -> s -> Plane+ -- df' :: GEnv -> s -> Plane df' wen ws = let ds = eTermDims wen in if isSmaller ds@@ -104,9 +103,6 @@ -- @ -- -- in your @.cabal@ file and you will be fine!------ Throws 'DisplayTooSmall' if game widht/height cannot be accomodated--- by terminal. playGame :: Game s -> IO () playGame g = () <$ runGIO (runGameGeneral g)
src/Terminal/Game/Plane.hs view
@@ -27,7 +27,7 @@ type Row = Int type Column = Int --- | Size of a surface. +-- | Size of a surface in 'Row's and 'Column's. type Dimensions = (Width, Height) -- | Expressed in 'Column's.