Rogue: put image-generation functions together

This commit is contained in:
Jonathan Daugherty 2014-08-01 15:37:08 -07:00
parent 051a6d949d
commit 39b31c6593

View File

@ -76,10 +76,6 @@ addRoom levelWidth levelHeight geo (centerX, centerY) = do
let room = [((x,y), EmptySpace) | x <- [xMin..xMax - 1], y <- [yMin..yMax - 1]]
return (geo // room)
imageForGeo :: LevelPiece -> Image
imageForGeo EmptySpace = char (defAttr `withBackColor` green) ' '
imageForGeo Rock = char defAttr 'X'
pieceA, dumpA :: Attr
pieceA = defAttr `withForeColor` blue `withBackColor` green
dumpA = defAttr `withStyle` reverseVideo
@ -132,6 +128,10 @@ updateDisplay = do
vty <- ask
liftIO $ update vty pic
--
-- Image-generation functions
--
worldImages :: Game [Image]
worldImages = do
thePlayer <- gets player
@ -139,6 +139,10 @@ worldImages = do
let playerImage = translate (playerX thePlayer) (playerY thePlayer) (char pieceA '@')
return [playerImage, levelGeoImage theLevel]
imageForGeo :: LevelPiece -> Image
imageForGeo EmptySpace = char (defAttr `withBackColor` green) ' '
imageForGeo Rock = char defAttr 'X'
buildGeoImage :: Geo -> Image
buildGeoImage geo =
let (geoWidth, geoHeight) = snd $ bounds geo