Draw cursor when targeting with HUD

This commit is contained in:
2024-09-30 21:11:56 +01:00
parent d8d3a01f06
commit b7d949c035
11 changed files with 146 additions and 219 deletions
+17 -6
View File
@@ -2,8 +2,10 @@ module Dodge.Render.ShapePicture (
worldSPic,
) where
import Dodge.DoubleTree
import Control.Applicative
import Dodge.Data.DoubleTree
import Dodge.Data.ComposedItem
import Dodge.Item.Grammar
import NewInt
import Dodge.Render.List
import Control.Lens
@@ -37,7 +39,7 @@ worldSPic cfig u =
<> foldup btSPic (filtOn _btPos _buttons)
<> foldup mcSPic (filtOn _mcPos _machines)
<> aimDelaySweep w
<> anyTargeting cfig w
<> anyTargeting w
where
w = _uvWorld u
foldup = foldMap'
@@ -70,9 +72,18 @@ drawSweep cr w = fromMaybe mempty $ do
theinput = w ^. input
mwp = mouseWorldPos theinput campos
anyTargeting :: Configuration -> World -> SPic
anyTargeting _ _ = mempty
--anyTargeting cfig w = fromMaybe mempty $ do
-- assume for now that targeting is above the root,
-- and the augmented hud is above that
anyTargeting :: World -> SPic
anyTargeting w = fromMaybe mempty $ do
cr <- w ^? cWorld . lWorld . creatures . ix 0
itinvid <- cr ^? crManipulation . manObject . imRootItem
itmtree <- invTrees (_crInv cr) ^? ix itinvid
ttree <- lookup WeaponTargetingLink (itmtree ^. ldtRight)
_ <- lookup AugmentedHUDLink (ttree ^. ldtLeft)
<|> lookup AugmentedHUDLink (ttree ^. ldtRight)
return (mempty , drawTargeting (ttree ^. ldtValue) w)
-- tt <- cr ^? crTargeting . ctType . _Just
-- return $ noShape $ drawTargeting tt cr cfig w
-- where
@@ -164,7 +175,7 @@ floorItemSPic :: FloorItem -> SPic
floorItemSPic flit =
uncurryV translateSPxy (_flItPos flit) $
rotateSP (_flItRot flit)
(itemSPic $ singleLDT ((_flIt flit),UncomposableIsolateSF))
(itemSPic $ _flIt flit)
btSPic :: Button -> SPic
btSPic bt =