Continue improving mouse|inventory interface
This commit is contained in:
+3
-25
@@ -131,29 +131,14 @@ drawMouseOver cfig w = concat (invsel <|> combinvsel
|
||||
. color (withAlpha 0.2 white)
|
||||
$ selSecDrawCursorAt 15 idp curs sss (j, i)
|
||||
|
||||
--getMouseInvSel :: World -> Maybe ((Int, Int), (Int, Int))
|
||||
--getMouseInvSel w = case w ^? hud . hudElement . subInventory . nsSelected of
|
||||
-- Just (MouseInvSelect s (Just e)) -> Just (s, e)
|
||||
-- _ -> case w ^? hud . hudElement . diSelectionExtra of
|
||||
-- Just x | x > 0 -> do
|
||||
-- (i, j) <- w ^? hud . hudElement . diSelection . _Just
|
||||
-- return ((i, j), (i, j + x))
|
||||
-- _ -> Nothing
|
||||
|
||||
--drawDISelections :: World -> Picture
|
||||
--drawDISelections w = fromMaybe mempty $
|
||||
-- drawDragSelect w <|>
|
||||
-- drawDragSelected w
|
||||
|
||||
drawDragSelected :: Configuration -> World -> Maybe Picture
|
||||
drawDragSelected cfig w = do
|
||||
ys <- w ^? hud . hudElement . diSelectionExtra
|
||||
guard $ not (IS.null ys)
|
||||
(i,j) <- w ^? hud . hudElement . diSelection . _Just
|
||||
guard $ i == 0
|
||||
sss <- w ^? hud . hudElement . diSections
|
||||
let idp = invDisplayParams w
|
||||
let f x = (selSecDrawCursorAt 15 idp BackdropCursor sss (0, x) <>)
|
||||
let f x = (selSecDrawCursorAt 15 idp BackdropCursor sss (i, x) <>)
|
||||
return . translateScreenPos cfig (invDisplayParams w ^. ldpPos)
|
||||
. color (withAlpha 0.2 white) . IS.foldr f mempty $ IS.insert j ys
|
||||
|
||||
@@ -167,13 +152,6 @@ drawDragSelect cfig w = do
|
||||
let f x = selSecDrawCursorAt 15 idp BackdropCursor sss (i, x)
|
||||
return . translateScreenPos cfig (invDisplayParams w ^. ldpPos)
|
||||
. color (withAlpha 0.2 white) . foldMap f $ [min j b .. max j b]
|
||||
-- fromMaybe mempty $ do
|
||||
-- ((i, j), (a, b)) <- getMouseInvSel w
|
||||
-- guard $ i == a
|
||||
-- sss <- w ^? hud . hudElement . diSections
|
||||
-- let idp = invDisplayParams w
|
||||
-- let f x = selSecDrawCursorAt 15 idp BackdropCursor sss (i, x)
|
||||
-- return . color (withAlpha 0.2 white) . foldMap f $ [min j b .. max j b]
|
||||
|
||||
drawSubInventory :: SubInventory -> Configuration -> World -> Picture
|
||||
drawSubInventory subinv cfig w = case subinv of
|
||||
@@ -203,14 +181,14 @@ drawExamineInventory cfig w =
|
||||
<> drawSelectionList
|
||||
secondColumnParams
|
||||
cfig
|
||||
( (map f
|
||||
( map f
|
||||
( makeParagraph 55 $
|
||||
yourAugmentedItem
|
||||
itemInfo
|
||||
(yourInfo (you w))
|
||||
(closeObjectInfo (crNumFreeSlots (you w)))
|
||||
w
|
||||
))
|
||||
)
|
||||
)
|
||||
where
|
||||
f str =
|
||||
|
||||
@@ -84,8 +84,11 @@ mouseCursorType u = case u ^. uvWorld . input . mouseContext of
|
||||
MouseMenuClick {} -> drawMenuClick 5
|
||||
MouseMenuCursor -> drawMenuCursor 5
|
||||
MouseInGame -> drawPlus 5
|
||||
OverInvDrag (Just _) -> drawDrag 5
|
||||
OverInvDrag Nothing -> drawDragDrop 5
|
||||
OverInvDrag 0 (Just _) -> drawDrag 5
|
||||
OverInvDrag 0 Nothing -> drawDragDrop 5
|
||||
OverInvDrag 3 (Just _) -> drawDrag 5
|
||||
OverInvDrag 3 Nothing -> drawDragPickup 5
|
||||
OverInvDrag _ _ -> drawEmptySet 5
|
||||
OverInvDragSelect {} -> drawDragSelect 5
|
||||
OverInvSelect {} -> drawSelect 5
|
||||
OverInvFilt {} -> drawCombFilter 5
|
||||
@@ -175,6 +178,15 @@ drawDragDrop x =
|
||||
z = 1.5 * x
|
||||
y = 0.7 * x
|
||||
|
||||
drawDragPickup :: Float -> Picture
|
||||
drawDragPickup x =
|
||||
line (fmap (+V2 z (-x)) [V2 (-x) x,V2 0 x,V2 0 (-x)])
|
||||
<> line (fmap (+V2 z (-x)) [V2 (-y) (y-x), V2 0 (-x), V2 y (y-x)])
|
||||
-- <> drawSelect 5
|
||||
where
|
||||
z = 1.5 * x
|
||||
y = 0.7 * x
|
||||
|
||||
--drawFiltDrag :: Float -> Picture
|
||||
--drawFiltDrag x = polygonWire
|
||||
-- [ V2 0 y
|
||||
|
||||
Reference in New Issue
Block a user