Work on menus

This commit is contained in:
2022-11-22 10:14:25 +00:00
parent 054405244f
commit 860d63df45
13 changed files with 251 additions and 167 deletions
+14 -6
View File
@@ -1,6 +1,6 @@
--{-# LANGUAGE TupleSections #-}
module Dodge.Render.HUD (
hudDrawings,
drawHUD,
) where
import Dodge.Data.CardinalPoint
@@ -29,12 +29,12 @@ import Picture
import SDL (MouseButton (..))
import qualified Data.Set as Set
hudDrawings :: Universe -> Picture
hudDrawings uv = case w ^. cWorld . lWorld . hud . hudElement of
drawHUD :: Universe -> Picture
drawHUD uv = case w ^. cWorld . lWorld . hud . hudElement of
DisplayCarte -> drawCarte cfig w
DisplayInventory subinv ->
drawInGameHUD subinv uv
<> subInventoryDisplay subinv cfig w
<> drawSubInventory subinv cfig w
where
w = _uvWorld uv
cfig = _uvConfig uv
@@ -58,9 +58,13 @@ defaultSelectionList = SelectionList
, _slPosY = 0
, _slOffset = 0
, _slItems = []
, _slShownItems = []
, _slSelPos = Nothing
, _slCursorType = NoCursor
, _slWidth = FixedSelectionWidth 15
, _slLength = 0
, _slSizeRestriction = NoSelectionSizeRestriction
, _slSpecialItem = NoSpecialSelectionItem
}
subInvSelectionList :: SelectionList
@@ -71,9 +75,13 @@ subInvSelectionList = SelectionList
, _slPosY = 60
, _slOffset = 0
, _slItems = []
, _slShownItems = []
, _slSelPos = Nothing
, _slCursorType = NoCursor
, _slWidth = FixedSelectionWidth 15
, _slLength = 0
, _slSizeRestriction = NoSelectionSizeRestriction
, _slSpecialItem = NoSpecialSelectionItem
}
inventorySelectionList :: World -> [SelectionItem]
@@ -107,8 +115,8 @@ inventoryDisplay subinv cfig w = drawSelectionList cfig $
| ButtonRight `M.member` _mouseButtons (_input w) = [North,South,East,West]
| otherwise = [North,South,West]
subInventoryDisplay :: SubInventory -> Configuration -> World -> Picture
subInventoryDisplay subinv cfig w = case subinv of
drawSubInventory :: SubInventory -> Configuration -> World -> Picture
drawSubInventory subinv cfig w = case subinv of
LockedInventory -> mempty -- topInvCursor col cursPos cfig w
NoSubInventory ->
pictures