Use strict tuples for SPics

This commit is contained in:
2024-10-01 01:20:29 +01:00
parent a98ec80f59
commit 5a4f2711c8
17 changed files with 69 additions and 481 deletions
+6 -6
View File
@@ -2,6 +2,7 @@ module Dodge.Render.ShapePicture (
worldSPic,
) where
import Data.Strict.Tuple
import Control.Applicative
import Dodge.Data.DoubleTree
import Dodge.Data.ComposedItem
@@ -28,7 +29,7 @@ import ShapePicture
worldSPic :: Configuration -> Universe -> SPic
worldSPic cfig u =
(mempty, extraPics cfig u)
(mempty :!: extraPics cfig u)
<> foldup drawProp' (filtOn _prPos _props)
<> foldup drawProjectile (filtOn _prjPos _projectiles)
<> foldup (shiftDraw _blPos _blDir (drawBlock . _blDraw)) (filtOn _blPos _blocks)
@@ -82,7 +83,7 @@ anyTargeting w = fromMaybe mempty $ do
ttree <- lookup WeaponTargetingLink (itmtree ^. ldtRight)
_ <- lookup AugmentedHUDLink (ttree ^. ldtLeft)
<|> lookup AugmentedHUDLink (ttree ^. ldtRight)
return (mempty , drawTargeting (ttree ^. ldtValue) w)
return . noShape $ drawTargeting (ttree ^. ldtValue) w
drawCreature :: Creature -> SPic
drawCreature cr = case _crType cr of
@@ -102,13 +103,12 @@ drawCreature cr = case _crType cr of
lampCrSPic :: Float -> SPic
lampCrSPic h =
( colorSH blue . upperBox Small Typical h $ rectWH 5 5
, setLayer BloomLayer (setDepth h . color white $ circleSolid 3)
)
( colorSH blue . upperBox Small Typical h $ rectWH 5 5)
:!: (setLayer BloomLayer (setDepth h . color white $ circleSolid 3))
picAtCrPos1 :: Picture -> Creature -> SPic
--{-# INLINE picAtCrPos #-}
picAtCrPos1 thePic cr = (,) mempty $ tranRot (_crPos cr) (_crDir cr) thePic
picAtCrPos1 thePic cr = (:!:) mempty $ tranRot (_crPos cr) (_crDir cr) thePic
shiftDraw :: (a -> Point2) -> (a -> Float) -> (a -> a -> SPic) -> a -> SPic
shiftDraw fpos fdir fdraw x =