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