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-18 17:25:13 +00:00
|
|
|
import Linear.V2
|
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 22:14:57 +00:00
|
|
|
playerToImg p = translateX px . translateY py $ char defAttr '@'
|
2021-02-18 17:25:13 +00:00
|
|
|
where px = p ^. pos . _x
|
|
|
|
py = p ^. pos . _y
|