From 807bc908d157546bc59b070086c3764ffcff2412 Mon Sep 17 00:00:00 2001 From: jgk Date: Tue, 17 Aug 2021 13:58:22 +0200 Subject: [PATCH] Minor tweaks to hud rendering --- src/Dodge/Render/HUD.hs | 49 +++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/src/Dodge/Render/HUD.hs b/src/Dodge/Render/HUD.hs index 78a3e5411..f90dc1a6a 100644 --- a/src/Dodge/Render/HUD.hs +++ b/src/Dodge/Render/HUD.hs @@ -18,31 +18,29 @@ winScale :: World -> Picture -> Picture winScale w = scale (2 / getWindowX w) (2 / getWindowY w) hudDrawings :: World -> Picture -hudDrawings w = pictures $ - [ winScale w . dShadCol white $ displayHP 0 w - , winScale w . translate (-390) 20 . scale 0.05 0.05 . dShadCol white $ text (_testString w) - ] +hudDrawings w = + (winScale w . dShadCol white $ displayHP 0 w) + ++ (winScale w . translate (-390) 20 . scale 0.05 0.05 . dShadCol white $ text (_testString w)) ++ selectionText where selectionText = if _carteDisplay w - then drawLocations w + then concat $ drawLocations w else drawInventory w -drawInventory :: World -> [Picture] +drawInventory :: World -> Picture drawInventory w = case _inventoryMode w of - TopInventory -> [ closeObjectTexts w] + TopInventory -> closeObjectTexts w ++ topInvCursor col iPos w - ++ displayInv 0 w - TweakInventory -> - mCurs it w - ++ [cursorAt 120 col 5 0 iPos w - ,cursorsZ w iPos it - ] - ++ displayInv 0 w - ++ displayMidList w (ammoTweakStrings it) "TWEAK" - CombineInventory -> displayInv 0 w ++ invHead w "COMBINE" - InspectInventory -> displayInv 0 w ++ invHead w "INSPECT" + ++ concat (displayInv 0 w) + TweakInventory -> + concat (mCurs it w) + ++ cursorAt 120 col 5 0 iPos w + ++ cursorsZ w iPos it + ++ concat (displayInv 0 w ) + ++ concat (displayMidList w (ammoTweakStrings it) "TWEAK") + CombineInventory -> concat (displayInv 0 w) ++ invHead w "COMBINE" + InspectInventory -> concat (displayInv 0 w) ++ invHead w "INSPECT" where itCol = fromMaybe (greyN 0.5) . (^? itInvColor) iPos = _crInvSel $ _creatures w IM.! _yourID w @@ -58,12 +56,12 @@ cursorsZ w ipos it = case it ^? wpAmmo . amParamSel of hw = halfWidth w sp = V2 (125 - hw) ( hh - (20 * fromIntegral ipos + 17.5)) -topInvCursor :: Color -> Int -> World -> [Picture] +topInvCursor :: Color -> Int -> World -> Picture topInvCursor col iPos w | ButtonRight `S.member` _mouseButtons w = - [cursorAt 100 col 5 0 iPos w - ,openCursorAt 20 col 105 0 iPos w] - | otherwise = [ openCursorAt 120 col 5 0 iPos w ] + cursorAt 100 col 5 0 iPos w + ++ openCursorAt 20 col 105 0 iPos w + | otherwise = openCursorAt 120 col 5 0 iPos w ammoTweakStrings :: Item -> [String] ammoTweakStrings it = case it ^? wpAmmo . amPjParams of @@ -96,13 +94,12 @@ pjTweakString pj = _pjDisplayParam pj $ _pjIntParam pj displayMidList :: World -> [String] -> String -> [Picture] displayMidList w strs s = - invHead w s + [invHead w s] ++ renderListAt (V2 150 (-60)) (map (,white) strs) w -invHead :: World -> String -> [Picture] -invHead w s = [winScale w . translate (-130) (halfHeight w - 40) - . dShadCol white . scale 0.4 0.4 $ text s - ] +invHead :: World -> String -> Picture +invHead w s = winScale w . translate (-130) (halfHeight w - 40) . dShadCol white . scale 0.4 0.4 $ text s + displayListTopLeft :: [(String,Color)] -> World -> [Picture] displayListTopLeft = renderListAt (V2 0 0)