Tweak mouse pointer display

This commit is contained in:
2024-11-04 09:32:36 +00:00
parent 1ed09fa8de
commit df08dc8ab5
7 changed files with 154 additions and 131 deletions
+18 -10
View File
@@ -98,14 +98,18 @@ setClickWorldPos u =
(const (screenToWorldPos (u ^. uvWorld . wCam) (u ^. uvWorld . input . mousePos)))
(M.filter (== 0) $ u ^. uvWorld . input . mouseButtons)
-- the ordering of updating here may be important
updateWorldEventFlags :: Universe -> Universe
updateWorldEventFlags u =
(uvWorld . worldEventFlags .~ mempty)
-- for now update inventory positioning every tick
. updateInventoryPositioning
-- the question is how often to update the close objects section, and if
-- this can be done independently of the other sections
$ foldr updateWorldEventFlag u (u ^. uvWorld . worldEventFlags)
-- for now update inventory positioning every tick
-- the question is how often to update the close objects section, and if
-- this can be done independently of the other sections
$
foldr
updateWorldEventFlag
(updateInventoryPositioning u)
(u ^. uvWorld . worldEventFlags)
updateWorldEventFlag :: WorldEventFlag -> Universe -> Universe
updateWorldEventFlag wef = case wef of
@@ -380,11 +384,15 @@ shiftInvItemsDown (_, i) x w = fromMaybe w $ do
g i' m = fst <$> IM.lookupGT i' m
updateMouseOverInventory :: Configuration -> World -> World
updateMouseOverInventory cfig w = fromMaybe w $ do
sss <- w ^? hud . hudElement . diSections
return $
w & hud . hudElement . diMouseOver
.~ inverseSelNumPos cfig ldp sss (w ^. input . mousePos)
updateMouseOverInventory cfig w = fromMaybe
(w & hud . hudElement . diMouseOver .~ Nothing)
$ do
sss <- w ^? hud . hudElement . diSections
guard $ ButtonRight `M.notMember` (w ^. input . mouseButtons)
|| not (null $ w ^? hud . hudElement . subInventory . ciSelection)
return $
w & hud . hudElement . diMouseOver
.~ inverseSelNumPos cfig ldp sss (w ^. input . mousePos)
where
ldp = invDisplayParams w