Improve inventory display

This commit is contained in:
2024-10-26 10:53:36 +01:00
parent ae0f2fad0f
commit e2f3d6a378
9 changed files with 280 additions and 249 deletions
+16 -15
View File
@@ -2,8 +2,8 @@ module Dodge.Render.Picture (
fixedCoordPictures,
) where
import Control.Monad
import Control.Lens
import Control.Monad
import Data.Maybe
import Dodge.Base.Coordinate
import Dodge.Base.Window
@@ -20,24 +20,26 @@ fixedCoordPictures u =
drawMenuOrHUD cfig u
<> drawConcurrentMessage u
<> drawMouseCursor u
<> toTopLeft cfig (translate (halfWidth cfig) 0 $ drawList (map text (_uvTestString u u)))
<> toTopLeft
cfig
( translate (0.5 * halfWidth cfig) (- halfHeight cfig) $
drawList $
map text $
show (u ^. uvWorld . cWorld . lWorld . lTestInt) :
(u ^. uvWorld . cWorld . lWorld . lTestString)
<> ttl (translate hw 0 $ drawList (map text (_uvTestString u u)))
<> ttl
( translate (0.5 * hw) (- hh)
. drawList
. map text
$ show (u ^. uvWorld . cWorld . lWorld . lTestInt) :
(u ^. uvWorld . cWorld . lWorld . lTestString)
)
<> displayFrameTicks u
<> aimDelaySweep (u ^. uvWorld)
where
cfig = _uvConfig u
hw = halfWidth cfig
hh = halfHeight cfig
ttl = toTopLeft cfig
displayFrameTicks :: Universe -> Picture
displayFrameTicks u
| debugOn Show_ms_frame $ _uvConfig u =
translate (-10) (- halfHeight (_uvConfig u) + 6)
translate (-10) (- halfHeight (_uvConfig u) + 6)
. scale 0.2 0.2
$ fpsText (u ^. uvFrameTicks - u ^. uvLastFrameTicks)
| otherwise = mempty
@@ -59,9 +61,10 @@ drawMenuOrHUD cfig u = case u ^. uvScreenLayers of
drawConcurrentMessage :: Universe -> Picture
drawConcurrentMessage u =
translate 0 (50 - halfHeight cfig) $
stackPicturesAt
(map (centerText . f) $ u ^.. uvSideEffects . each)
translate 0 (50 - halfHeight cfig)
. stackPicturesAt
. map (centerText . f)
$ u ^.. uvSideEffects . each
where
cfig = _uvConfig u
f (RunningSideEffect ce) = ce ++ " IN PROGRESS"
@@ -103,7 +106,6 @@ drawSweep cr w = fromMaybe mempty $ do
| a - cdir < - pi = cdir - 2 * pi
| otherwise = cdir
return $
setLayer FixedCoordLayer $
uncurryV translate (worldPosToScreen campos p) $
arcFull (a - rot) 10 white (a' - rot) 1 white (5 + dist mwp p * campos ^. camZoom) white
where
@@ -113,4 +115,3 @@ drawSweep cr w = fromMaybe mempty $ do
campos = w ^. wCam
theinput = w ^. input
mwp = mouseWorldPos theinput campos