Work towards making world read/showable

This commit is contained in:
2022-07-22 11:16:12 +01:00
parent 6b69fc1684
commit 7fdb70dd1c
22 changed files with 223 additions and 218 deletions
+12 -6
View File
@@ -32,18 +32,24 @@ import qualified Data.Text as T
--import Data.List
--import Data.Bifunctor
hudDrawings :: Configuration -> World -> Picture
hudDrawings cfig w = case _hudElement $ _hud w of
hudDrawings :: Universe -> Picture
hudDrawings uv = case _hudElement $ _hud w of
DisplayCarte -> drawCarte cfig w
DisplayInventory subinv -> drawInGameHUD cfig w
DisplayInventory subinv -> drawInGameHUD uv
<> subInventoryDisplay subinv cfig w
where
w = _uvWorld uv
cfig = _uvConfig uv
drawInGameHUD :: Configuration -> World -> Picture
drawInGameHUD cfig w = pictures
drawInGameHUD :: Universe -> Picture
drawInGameHUD uv = pictures
[ winScale cfig . dShadCol white $ displayHP 0 cfig w
, listPicturesAt (halfWidth cfig) 0 cfig $ map text (_testString w cfig w)
, listPicturesAt (halfWidth cfig) 0 cfig $ map text (_uvTestString uv uv)
, inventoryDisplay cfig w
]
where
w = _uvWorld uv
cfig = _uvConfig uv
inventoryDisplay :: Configuration -> World -> Picture
inventoryDisplay cfig w = listPicturesAt 0 0 cfig invlist
+2 -2
View File
@@ -18,7 +18,7 @@ menuScreen w screen = case screen of
(WaitScreen sf _) -> drawOptions w (sf w) [] 0 ""
(InputScreen inputstr help) -> drawOptions w ('>':T.unpack inputstr) [] 0 help
(DisplayScreen sd ) -> sd w
(ColumnsScreen titf pairs) -> drawTwoColumnsScreen (_config w) (titf w) pairs
(ColumnsScreen titf pairs) -> drawTwoColumnsScreen (_uvConfig w) (titf w) pairs
--displayStringList :: World -> [String] -> Picture
--displayStringList w ss = pictures
@@ -76,7 +76,7 @@ drawOptions u title ops off footer = pictures $
notInvisible _ = True
hh = halfHeight cfig
hw = halfWidth cfig
cfig = _config u
cfig = _uvConfig u
optionValueOffset :: Universe -> MenuOption -> Int
optionValueOffset u mo = case _moString mo u of
+2 -2
View File
@@ -13,13 +13,13 @@ import Picture
fixedCoordPictures :: Universe -> Picture
fixedCoordPictures u = case _menuLayers u of
[] -> pictures
[ hudDrawings cfig w
[ hudDrawings u
, customMouseCursor cfig w
]
(lay:_) -> setDepth (-1) . winScale cfig $ menuScreen u lay
where
w = _uvWorld u
cfig = _config u
cfig = _uvConfig u
customMouseCursor :: Configuration -> World -> Picture
customMouseCursor cfig w = winScale cfig