Move status to list on left of screen

This commit is contained in:
2024-11-24 12:51:20 +00:00
parent 1427efedb2
commit b2de834bb7
4 changed files with 20 additions and 60 deletions
+1 -1
View File
@@ -1 +1 @@
All good (594 modules, at 12:24:25)
All good (594 modules, at 12:48:20)
+12 -52
View File
@@ -1,15 +1,14 @@
module Dodge.Default.World where
module Dodge.Default.World (
defaultWorld,
) where
import Color
import NewInt
import Control.Lens
import Data.Graph.Inductive.Graph hiding ((&))
import qualified Data.Map as M
import Dodge.Data.SelectionList
import Dodge.Data.World
import Geometry.Data
import Geometry.Polygon
import qualified IntMapHelp as IM
import NewInt
import System.Random
defaultInput :: Input
@@ -61,8 +60,8 @@ defaultCWGen =
{ _cwgParams = GenParams M.empty
, _cwgSeed = 0
, _cwgWorldBounds = defaultBounds
, _cwgGameRooms = []
, _cwgRoomClipping = []
, _cwgGameRooms = mempty
, _cwgRoomClipping = mempty
}
defaultCWCam :: Camera
@@ -77,7 +76,7 @@ defaultCWCam =
, _camItemZoom = 1
, _camBoundBox = square 100
, _camBoundDist = (100, -100, 100, -100)
, _camControl = CamInGame {_cigType = CamOnPlayer}
, _camControl = CamInGame{_cigType = CamOnPlayer}
}
defaultCWorld :: CWorld
@@ -113,9 +112,9 @@ defaultLWorld =
, _energyBalls = []
, _radarBlips = []
, _flares = []
-- , _newBeams = WorldBeams [] [] [] []
-- , _beams = WorldBeams [] [] [] []
, _teslaArcs = []
, -- , _newBeams = WorldBeams [] [] [] []
-- , _beams = WorldBeams [] [] [] []
_teslaArcs = []
, _shockwaves = []
, _lasers = []
, _lasersToDraw = []
@@ -163,49 +162,10 @@ defaultHUD =
defaultDisplayInventory :: HUDElement
defaultDisplayInventory =
DisplayInventory
{ _subInventory = NoSubInventory
--, _diSections = defaultInvSections
{ _subInventory = NoSubInventory
, _diSections = mempty
, _diSelection = Just (1,0)
, _diSelection = Just (1, 0)
, _diSelectionExtra = mempty
, _diInvFilter = mempty
, _diCloseFilter = mempty
}
defaultInvSections :: IM.IntMap (SelectionSection ())
defaultInvSections = IM.fromDistinctAscList $
zip
[-2 ..]
[ defaultSS
& ssItems .~ IM.fromAscList [(0,SelectionItem ["STATUS"] 1 False white 0 ())]
, defaultFiltSection
, defaultInvSection
, defaultYouSection
, defaultFiltSection
, defaultCOSection
]
defaultSS :: SelectionSection a
defaultSS =
SelectionSection
{ _ssItems = mempty
, _ssOffset = 0
, _ssShownItems = []
, _ssIndent = 0
}
defaultCOSection :: SelectionSection ()
defaultCOSection =
defaultSS
defaultFiltSection :: SelectionSection a
defaultFiltSection =
defaultSS
defaultInvSection :: SelectionSection ()
defaultInvSection =
defaultSS
defaultYouSection :: SelectionSection ()
defaultYouSection =
defaultSS
+5 -4
View File
@@ -127,8 +127,8 @@ updateDisplaySections w cfig =
displaySectionsSizes
mselpos
(getAvailableListLines (invDisplayParams w) cfig)
[filtinv, filtclose, invx, youx, closex]
(IM.fromAscList [(-1,0),(0,2),(1,0),(2,0),(3,2)])
[statushead,statusdisplay,filtinv, filtclose, invx, youx, closex]
(IM.fromAscList [(-3,0),(-2,2),(-1,0),(0,2),(1,0),(2,0),(3,2)])
where
mselpos = w ^? hud . hudElement . diSelection . _Just
invfiltcurs = mselpos ^? _Just . _1 == Just (-1)
@@ -142,6 +142,8 @@ updateDisplaySections w cfig =
w ^? hud . hudElement . diCloseFilter . _Just
(filtclose, closex) = ((2, sfclose), (3, sclose))
youx = (1, youitems)
statushead = (-3,IM.singleton 0 $ SelectionInfo ["STATUS"] 1 False white 0)
statusdisplay = (-2,IM.singleton 0 $ SelectionInfo ["HEALTH "++show (_crHP cr)] 1 False white 0)
youitems = IM.singleton 0 $ SelectionItem [thetext] 1 True invDimColor 0 ()
thetext = displayFreeSlots (crNumFreeSlots cr)
closeitms =
@@ -199,11 +201,9 @@ displayFreeSlots x = case x of
_ -> show x ++ " FREE SLOTS"
sectionsDesiredLines ::
-- IM.IntMap (SelectionSection a) ->
IM.IntMap (IM.IntMap (SelectionItem a)) ->
IM.IntMap Int
sectionsDesiredLines = fmap $ alaf Sum foldMap _siHeight
--sectionsDesiredLines = fmap $ alaf Sum foldMap _siHeight . _ssItems
sectionsSizes ::
Int -> -- total available lines
@@ -261,6 +261,7 @@ updateSectionsPositioning f mselpos allavailablelines lsss indents sss =
return i
ls = IM.fromList lsss
h = IM.intersectionWith ($)
-- defaults non-existing offsets to 0
g = merge (mapMissing (const ($ 0))) dropMissing (zipWithMatched (const ($)))
lk = fromMaybe [] $ fmap ((: []) . fst) mselpos
ssizes =
+2 -3
View File
@@ -17,7 +17,6 @@ import Dodge.Camera
import Dodge.Creature.Action
import Dodge.Data.Combine
import Dodge.Data.Universe
import Dodge.Default.World
import Dodge.DisplayInventory
import Dodge.Event.Test
import Dodge.InputFocus
@@ -480,8 +479,8 @@ toggleMap u = case u ^. uvWorld . hud . hudElement of
DisplayCarte ->
u & uvWorld . hud . hudElement
.~ DisplayInventory
{ _subInventory = NoSubInventory --MouseInvNothing
, _diSections = defaultInvSections
{ _subInventory = NoSubInventory
, _diSections = mempty
, _diSelection = Nothing
, _diSelectionExtra = mempty
, _diInvFilter = mempty