Craft3e 0.2.0.6 → 0.2.0.7
raw patch · 2 files changed
+10/−6 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
Craft3e.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: Craft3e-version: 0.2.0.6+version: 0.2.0.7 license: MIT license-file: LICENSE copyright: (c) Simon Thompson
Minesweeper/Graphical/GraphicMine.hs view
@@ -26,6 +26,8 @@ import Graphics.Gloss hiding ( Point ) import Graphics.Gloss.Interface.Pure.Game hiding ( Point ) import System.Random ( StdGen, newStdGen, random )+import System.Exit ( exitSuccess )+import System.IO.Unsafe ( unsafePerformIO ) import MineRandom ( randomGridDyn ) import Minesweeper5@@ -109,10 +111,10 @@ statusText :: World -> String statusText w = case wStatus w of- Won -> "You win! Press N for a new game."- Lost -> "Boom! Press N for a new game."+ Won -> "You win! Press N for a new game, Esc to quit."+ Lost -> "Boom! Press N for a new game, Esc to quit." Playing -> show (wMines w) ++- " mines. Click: reveal Right-click: flag N: new game A: assist"+ " mines. Click: reveal Right-click: flag N: new game A: assist Esc: quit" renderCell :: World -> Int -> Int -> Picture @@ -120,7 +122,7 @@ = translate x y (pictures (box : maybe [] (:[]) label)) where x = - boardW w / 2 + (fromIntegral col + 0.5) * cellSize- y = boardH w / 2 - headerHeight - (fromIntegral row + 0.5) * cellSize+ y = boardH w / 2 - headerHeight / 2 - (fromIntegral row + 0.5) * cellSize point = (row, col) revealed = wShowing w !!! point@@ -164,6 +166,8 @@ handleEvent :: Event -> World -> World +handleEvent (EventKey (SpecialKey KeyEsc) Down _ _) _+ = unsafePerformIO exitSuccess handleEvent (EventKey (Char 'n') Down _ _) w = newGame w handleEvent (EventKey (Char 'N') Down _ _) w@@ -188,7 +192,7 @@ where size = wSize w col = floor ((mx + boardW w / 2) / cellSize)- row = floor ((boardH w / 2 - headerHeight - my) / cellSize)+ row = floor ((boardH w / 2 - headerHeight / 2 - my) / cellSize) -- Revealing a cell: losing if it's a mine, otherwise uncovering its -- closure of neighbouring zero-count cells, exactly as playGameGrid