Minor tweaks to hud rendering

This commit is contained in:
2021-08-17 13:58:22 +02:00
parent 190d346275
commit 807bc908d1
+23 -26
View File
@@ -18,31 +18,29 @@ winScale :: World -> Picture -> Picture
winScale w = scale (2 / getWindowX w) (2 / getWindowY w) winScale w = scale (2 / getWindowX w) (2 / getWindowY w)
hudDrawings :: World -> Picture hudDrawings :: World -> Picture
hudDrawings w = pictures $ hudDrawings w =
[ winScale w . dShadCol white $ displayHP 0 w (winScale w . dShadCol white $ displayHP 0 w)
, winScale w . translate (-390) 20 . scale 0.05 0.05 . dShadCol white $ text (_testString w) ++ (winScale w . translate (-390) 20 . scale 0.05 0.05 . dShadCol white $ text (_testString w))
]
++ selectionText ++ selectionText
where where
selectionText = selectionText =
if _carteDisplay w if _carteDisplay w
then drawLocations w then concat $ drawLocations w
else drawInventory w else drawInventory w
drawInventory :: World -> [Picture] drawInventory :: World -> Picture
drawInventory w = case _inventoryMode w of drawInventory w = case _inventoryMode w of
TopInventory -> [ closeObjectTexts w] TopInventory -> closeObjectTexts w
++ topInvCursor col iPos w ++ topInvCursor col iPos w
++ displayInv 0 w ++ concat (displayInv 0 w)
TweakInventory -> TweakInventory ->
mCurs it w concat (mCurs it w)
++ [cursorAt 120 col 5 0 iPos w ++ cursorAt 120 col 5 0 iPos w
,cursorsZ w iPos it ++ cursorsZ w iPos it
] ++ concat (displayInv 0 w )
++ displayInv 0 w ++ concat (displayMidList w (ammoTweakStrings it) "TWEAK")
++ displayMidList w (ammoTweakStrings it) "TWEAK" CombineInventory -> concat (displayInv 0 w) ++ invHead w "COMBINE"
CombineInventory -> displayInv 0 w ++ invHead w "COMBINE" InspectInventory -> concat (displayInv 0 w) ++ invHead w "INSPECT"
InspectInventory -> displayInv 0 w ++ invHead w "INSPECT"
where where
itCol = fromMaybe (greyN 0.5) . (^? itInvColor) itCol = fromMaybe (greyN 0.5) . (^? itInvColor)
iPos = _crInvSel $ _creatures w IM.! _yourID w iPos = _crInvSel $ _creatures w IM.! _yourID w
@@ -58,12 +56,12 @@ cursorsZ w ipos it = case it ^? wpAmmo . amParamSel of
hw = halfWidth w hw = halfWidth w
sp = V2 (125 - hw) ( hh - (20 * fromIntegral ipos + 17.5)) sp = V2 (125 - hw) ( hh - (20 * fromIntegral ipos + 17.5))
topInvCursor :: Color -> Int -> World -> [Picture] topInvCursor :: Color -> Int -> World -> Picture
topInvCursor col iPos w topInvCursor col iPos w
| ButtonRight `S.member` _mouseButtons w = | ButtonRight `S.member` _mouseButtons w =
[cursorAt 100 col 5 0 iPos w cursorAt 100 col 5 0 iPos w
,openCursorAt 20 col 105 0 iPos w] ++ openCursorAt 20 col 105 0 iPos w
| otherwise = [ openCursorAt 120 col 5 0 iPos w ] | otherwise = openCursorAt 120 col 5 0 iPos w
ammoTweakStrings :: Item -> [String] ammoTweakStrings :: Item -> [String]
ammoTweakStrings it = case it ^? wpAmmo . amPjParams of ammoTweakStrings it = case it ^? wpAmmo . amPjParams of
@@ -96,13 +94,12 @@ pjTweakString pj = _pjDisplayParam pj $ _pjIntParam pj
displayMidList :: World -> [String] -> String -> [Picture] displayMidList :: World -> [String] -> String -> [Picture]
displayMidList w strs s = displayMidList w strs s =
invHead w s [invHead w s]
++ renderListAt (V2 150 (-60)) (map (,white) strs) w ++ renderListAt (V2 150 (-60)) (map (,white) strs) w
invHead :: World -> String -> [Picture] invHead :: World -> String -> Picture
invHead w s = [winScale w . translate (-130) (halfHeight w - 40) invHead w s = winScale w . translate (-130) (halfHeight w - 40) . dShadCol white . scale 0.4 0.4 $ text s
. dShadCol white . scale 0.4 0.4 $ text s
]
displayListTopLeft :: [(String,Color)] -> World -> [Picture] displayListTopLeft :: [(String,Color)] -> World -> [Picture]
displayListTopLeft = renderListAt (V2 0 0) displayListTopLeft = renderListAt (V2 0 0)