2021-02-11 22:40:00 +00:00
|
|
|
module Rendering where
|
|
|
|
|
2021-02-13 00:06:26 +00:00
|
|
|
import Lens.Micro
|
2021-02-11 22:40:00 +00:00
|
|
|
import Graphics.Vty
|
2021-02-13 00:06:26 +00:00
|
|
|
|
2021-02-11 22:40:00 +00:00
|
|
|
import Dungeon
|
|
|
|
import Game
|
|
|
|
import Player
|
|
|
|
|
|
|
|
renderGame :: Game -> Picture
|
|
|
|
renderGame g = picForLayers
|
2021-02-13 00:06:26 +00:00
|
|
|
[ playerToImg $ g ^. player
|
|
|
|
, dungeonToImg $ g ^. dungeon
|
2021-02-11 22:40:00 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
dungeonToImg :: Dungeon -> Image
|
|
|
|
dungeonToImg = vertCat . map (string defAttr . concatMap show) . dungeonToLists
|
|
|
|
|
|
|
|
playerToImg :: Player -> Image
|
2021-02-14 13:43:32 +00:00
|
|
|
playerToImg p = (translateX px . translateY py $ char defAttr '@')
|
2021-02-14 13:32:24 +00:00
|
|
|
where px = p ^. pos . _1
|
|
|
|
py = p ^. pos . _2
|