Centralise mouse context data
This commit is contained in:
+18
-21
@@ -6,6 +6,7 @@ module Dodge.Render.HUD (
|
||||
selNumPosCardinal, -- this shoud probably be pushed back here
|
||||
) where
|
||||
|
||||
import Control.Applicative
|
||||
import Dodge.Terminal.Type
|
||||
import Dodge.CharacterEnums
|
||||
import Dodge.Creature.Test
|
||||
@@ -67,10 +68,11 @@ drawInventory sss w cfig =
|
||||
<> drawSSCursor sss (w ^? hud . hudElement . diSelection . _Just) ldp curs cfig
|
||||
<> drawRootCursor w sss (w ^? hud . hudElement . diSelection . _Just) ldp cfig
|
||||
<> iextra
|
||||
<> drawMouseOver cfig w
|
||||
<> translateScreenPos
|
||||
cfig
|
||||
(ldp ^. ldpPos)
|
||||
(drawDIMouseOver w <> drawDISelections w)
|
||||
(drawDISelections w)
|
||||
where
|
||||
ldp = invDisplayParams w
|
||||
curs = invCursorParams w
|
||||
@@ -104,23 +106,22 @@ getRootItemBounds i inv = do
|
||||
y <- locLeftmost root ^? locLDT . ldtValue . cItem . itLocation . ilInvID
|
||||
return (x,y)
|
||||
|
||||
drawDIMouseOver :: World -> Picture
|
||||
drawDIMouseOver w = fromMaybe mempty $ do
|
||||
(j, i) <- w ^? hud . hudElement . diMouseOver . _Just
|
||||
sss <- w ^? hud . hudElement . diSections
|
||||
let idp = invDisplayParams w
|
||||
return . color (withAlpha 0.2 white) $ selSecDrawCursorAt 15 idp curs sss (j, i)
|
||||
where
|
||||
curs = BackdropCursor
|
||||
|
||||
drawCIMouseOver :: World -> Picture
|
||||
drawCIMouseOver w = fromMaybe mempty $ do
|
||||
(j, i) <- w ^? hud . hudElement . subInventory . ciMouseOver . _Just
|
||||
sss <- w ^? hud . hudElement . subInventory . ciSections
|
||||
let idp = invDisplayParams w
|
||||
return . color (withAlpha 0.2 white) $ selSecDrawCursorAt 15 idp curs sss (j, i)
|
||||
where
|
||||
drawMouseOver :: Configuration -> World -> Picture
|
||||
drawMouseOver cfig w = fromMaybe mempty $ invsel <|> combinvsel
|
||||
where
|
||||
invsel = do
|
||||
(j, i) <- w ^? input . mouseContext . mcoInv
|
||||
sss <- w ^? hud . hudElement . diSections
|
||||
let idp = invDisplayParams w
|
||||
return . translateScreenPos cfig (invDisplayParams w ^. ldpPos)
|
||||
. color (withAlpha 0.2 white) $ selSecDrawCursorAt 15 idp curs sss (j, i)
|
||||
curs = BackdropCursor
|
||||
combinvsel = do
|
||||
(j, i) <- w ^? input . mouseContext . mcoCombInv
|
||||
sss <- w ^? hud . hudElement . subInventory . ciSections
|
||||
let idp = invDisplayParams w
|
||||
return . translateScreenPos cfig (secondColumnParams ^. ldpPos)
|
||||
. 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
|
||||
@@ -158,10 +159,6 @@ drawCombineInventory cfig sss w =
|
||||
<> drawSelectionSections sss secondColumnParams cfig
|
||||
<> drawSSCursor sss msel secondColumnParams curs cfig
|
||||
<> combineInventoryExtra sss msel cfig w
|
||||
<> translateScreenPos
|
||||
cfig
|
||||
(secondColumnParams ^. ldpPos)
|
||||
(drawCIMouseOver w)
|
||||
where
|
||||
curs = BoundaryCursor [North, South, West]
|
||||
msel = w ^? hud . hudElement . subInventory . ciSelection . _Just
|
||||
|
||||
Reference in New Issue
Block a user