This commit is contained in:
2025-08-26 18:51:14 +01:00
parent b87c3380b8
commit 1ebdbdd8ae
34 changed files with 210 additions and 246 deletions
+21 -21
View File
@@ -45,14 +45,14 @@ import NewInt
import Picture
import SDL (MouseButton (..))
drawHUD :: Configuration -> World -> Picture
drawHUD :: Config -> World -> Picture
drawHUD cfig w = case w ^. hud of
-- DisplayCarte -> drawCarte cfig w
HUD {_diSections = sections, _subInventory = subinv} ->
drawInventory sections w cfig
<> drawSubInventory subinv cfig w
drawInventory :: IM.IntMap (SelectionSection ()) -> World -> Configuration -> Picture
drawInventory :: IM.IntMap (SelectionSection ()) -> World -> Config -> Picture
drawInventory sss w cfig =
drawSelectionSections sss invDP cfig
<> drawSSCursor sss invDP curs cfig (f $ w ^? hud . diSelection . _Just)
@@ -74,7 +74,7 @@ drawRootCursor ::
IM.IntMap (SelectionSection ()) ->
Maybe (Int, Int) ->
ListDisplayParams ->
Configuration ->
Config ->
Picture
drawRootCursor w sss msel ldp cfig = fromMaybe mempty $ do
cr <- w ^? cWorld . lWorld . creatures . ix 0
@@ -102,7 +102,7 @@ getRootItemBounds i inv = do
y <- locDTLeftmost root ^? locDT . dtValue . _1 . itLocation . ilInvID . unNInt
return (x, y)
drawMouseOver :: Configuration -> World -> Picture
drawMouseOver :: Config -> World -> Picture
drawMouseOver cfig w =
concat
(invsel <|> combinvsel <|> drawDragSelecting cfig w)
@@ -129,7 +129,7 @@ drawMouseOver cfig w =
. color (withAlpha 0.2 white)
$ selSecDrawCursorAt idp curs sss (j, i)
drawDragSelected :: Configuration -> World -> Maybe Picture
drawDragSelected :: Config -> World -> Maybe Picture
drawDragSelected cfig w = do
ys <- w ^? hud . diSelection . _Just . slSet
guard $
@@ -146,7 +146,7 @@ drawDragSelected cfig w = do
. IS.foldr f mempty
$ ys
drawDragSelecting :: Configuration -> World -> Maybe Picture
drawDragSelecting :: Config -> World -> Maybe Picture
drawDragSelecting cfig w = do
OverInvDragSelect (Just (i, j)) (Just b) <- w ^? input . mouseContext
sss <- w ^? hud . diSections
@@ -156,7 +156,7 @@ drawDragSelecting cfig w = do
. foldMap f
$ [min j b .. max j b]
drawSubInventory :: SubInventory -> Configuration -> World -> Picture
drawSubInventory :: SubInventory -> Config -> World -> Picture
drawSubInventory subinv cfig w = case subinv of
-- LockedInventory -> mempty -- topInvCursor col cursPos cfig w
NoSubInventory{} -> drawRBOptions cfig w
@@ -176,7 +176,7 @@ drawMapperInventory itid w = fold $ do
f = worldPosToScreen (w ^. wCam)
drawCombineInventory ::
Configuration ->
Config ->
IM.IntMap (SelectionSection CombinableItem) ->
World ->
Picture
@@ -191,7 +191,7 @@ drawCombineInventory cfig sss w =
fmap (\(Sel x y _) -> (x, y)) $
w ^? hud . subInventory . ciSelection . _Just
drawExamineInventory :: Configuration -> World -> Picture
drawExamineInventory :: Config -> World -> Picture
drawExamineInventory cfig w =
invHead cfig "EXAMINE"
<> drawSelectionList
@@ -244,7 +244,7 @@ yourAugmentedItem f x g w = case you w ^? crManipulation . manObject of
return . g $ Right but
_ -> x
drawRBOptions :: Configuration -> World -> Picture
drawRBOptions :: Config -> World -> Picture
drawRBOptions cfig w = fold $ do
guard $ ButtonRight `M.member` _mouseButtons (_input w)
invid <- you w ^? crManipulation . manObject . imSelectedItem
@@ -314,7 +314,7 @@ equipAllocString = \case
drawItemConnections ::
IM.IntMap (SelectionSection ()) ->
Configuration ->
Config ->
IM.IntMap (Maybe (Int, Int), [Int], [Int]) ->
Picture
drawItemConnections sss cfig =
@@ -324,7 +324,7 @@ drawItemConnections sss cfig =
drawItemChildrenConnect ::
IM.IntMap (SelectionSection ()) ->
Configuration ->
Config ->
Int ->
[Int] ->
Picture
@@ -338,7 +338,7 @@ drawItemChildrenConnect sss cfig i is = fromMaybe mempty $ do
combineInventoryExtra ::
IM.IntMap (SelectionSection CombinableItem) ->
Maybe (Int, Int) ->
Configuration ->
Config ->
World ->
Picture
combineInventoryExtra sss msel cfig w = fold $ do
@@ -358,7 +358,7 @@ combineInventoryExtra sss msel cfig w = fold $ do
sss'
(Just (0, i))
drawTerminalDisplay :: Configuration -> Terminal -> Picture
drawTerminalDisplay :: Config -> Terminal -> Picture
drawTerminalDisplay cfig tm =
invHead cfig ("T-" ++ show tid)
<> drawSelectionList secondColumnParams cfig f
@@ -387,7 +387,7 @@ drawTerminalDisplay cfig tm =
-- | hasfoc = clockCycle 10 (V.fromList [[cFilledRect] , "."]) w
lnkMidPosInvSelsCol :: Configuration -> World -> Int -> Color -> [Int] -> Picture
lnkMidPosInvSelsCol :: Config -> World -> Int -> Color -> [Int] -> Picture
lnkMidPosInvSelsCol cfig w i col = fromMaybe mempty . foldMap f
where
f j = do
@@ -398,7 +398,7 @@ lnkMidPosInvSelsCol cfig w i col = fromMaybe mempty . foldMap f
invcol <- selSecSelCol 0 j sss
return $ zConnectColMidX (rp - V2 5 0) (lp + V2 155 0) (rp ^. _1 - 20) col col col invcol
invHead :: Configuration -> String -> Picture
invHead :: Config -> String -> Picture
invHead cfig =
translateScreenPos cfig (fromTopLeft (V2 subInvX 80))
. dShadCol white
@@ -408,7 +408,7 @@ invHead cfig =
--locPoss = map (cartePosToScreen cfig (w ^. hud) . ($ w) . doWorldPos . fst) . IM.elems . _seenLocations . _lWorld $ _cWorld w
--locTexts = map fst locs
--displayListEndCoords :: Configuration -> [String] -> [Point2]
--displayListEndCoords :: Config -> [String] -> [Point2]
--displayListEndCoords cfig ss = map (doWindowScale cfig) $ zipWith h ss $ map f [1 ..]
-- where
-- f :: Int -> Point2
@@ -416,7 +416,7 @@ invHead cfig =
-- h :: String -> Point2 -> Point2
-- h s (V2 x y) = V2 (x + 9 * fromIntegral (length s)) y
--closeObjectTexts :: Configuration -> World -> Picture
--closeObjectTexts :: Config -> World -> Picture
--closeObjectTexts cfig w = pictures $
-- renderListAt pushout (negate 20 * fromIntegral invPos) cfig (map colAndText $ _closeObjects w)
-- : maybeToList maybeLine
@@ -448,9 +448,9 @@ invHead cfig =
-- would be nice to add parameter to orient this with NSEW, cf cursor
selNumPos ::
Configuration ->
Config ->
ListDisplayParams ->
IM.IntMap (SelectionSection a) ->
IMSS a ->
Int ->
Int ->
Maybe Point2
@@ -472,7 +472,7 @@ selNumPos = selNumPosCardinal West8
-- need to be able to determine a selection item's width for this
selNumPosCardinal ::
CardinalEightPoint ->
Configuration ->
Config ->
ListDisplayParams ->
IM.IntMap (SelectionSection a) ->
Int ->