mirror of
https://github.com/ilyakooo0/vty.git
synced 2024-12-01 14:36:27 +03:00
Rogue: put image-generation functions together
This commit is contained in:
parent
051a6d949d
commit
39b31c6593
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user