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 Data.Graph.Inductive.Graph hiding ((&))
import qualified Data.Map as M import qualified Data.Map as M
import Dodge.Data.SelectionList
import Dodge.Data.World import Dodge.Data.World
import Geometry.Data import Geometry.Data
import Geometry.Polygon import Geometry.Polygon
import qualified IntMapHelp as IM import qualified IntMapHelp as IM
import NewInt
import System.Random import System.Random
defaultInput :: Input defaultInput :: Input
@@ -61,8 +60,8 @@ defaultCWGen =
{ _cwgParams = GenParams M.empty { _cwgParams = GenParams M.empty
, _cwgSeed = 0 , _cwgSeed = 0
, _cwgWorldBounds = defaultBounds , _cwgWorldBounds = defaultBounds
, _cwgGameRooms = [] , _cwgGameRooms = mempty
, _cwgRoomClipping = [] , _cwgRoomClipping = mempty
} }
defaultCWCam :: Camera defaultCWCam :: Camera
@@ -77,7 +76,7 @@ defaultCWCam =
, _camItemZoom = 1 , _camItemZoom = 1
, _camBoundBox = square 100 , _camBoundBox = square 100
, _camBoundDist = (100, -100, 100, -100) , _camBoundDist = (100, -100, 100, -100)
, _camControl = CamInGame {_cigType = CamOnPlayer} , _camControl = CamInGame{_cigType = CamOnPlayer}
} }
defaultCWorld :: CWorld defaultCWorld :: CWorld
@@ -113,9 +112,9 @@ defaultLWorld =
, _energyBalls = [] , _energyBalls = []
, _radarBlips = [] , _radarBlips = []
, _flares = [] , _flares = []
-- , _newBeams = WorldBeams [] [] [] [] , -- , _newBeams = WorldBeams [] [] [] []
-- , _beams = WorldBeams [] [] [] [] -- , _beams = WorldBeams [] [] [] []
, _teslaArcs = [] _teslaArcs = []
, _shockwaves = [] , _shockwaves = []
, _lasers = [] , _lasers = []
, _lasersToDraw = [] , _lasersToDraw = []
@@ -163,49 +162,10 @@ defaultHUD =
defaultDisplayInventory :: HUDElement defaultDisplayInventory :: HUDElement
defaultDisplayInventory = defaultDisplayInventory =
DisplayInventory DisplayInventory
{ _subInventory = NoSubInventory { _subInventory = NoSubInventory
--, _diSections = defaultInvSections
, _diSections = mempty , _diSections = mempty
, _diSelection = Just (1,0) , _diSelection = Just (1, 0)
, _diSelectionExtra = mempty , _diSelectionExtra = mempty
, _diInvFilter = mempty , _diInvFilter = mempty
, _diCloseFilter = 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 displaySectionsSizes
mselpos mselpos
(getAvailableListLines (invDisplayParams w) cfig) (getAvailableListLines (invDisplayParams w) cfig)
[filtinv, filtclose, invx, youx, closex] [statushead,statusdisplay,filtinv, filtclose, invx, youx, closex]
(IM.fromAscList [(-1,0),(0,2),(1,0),(2,0),(3,2)]) (IM.fromAscList [(-3,0),(-2,2),(-1,0),(0,2),(1,0),(2,0),(3,2)])
where where
mselpos = w ^? hud . hudElement . diSelection . _Just mselpos = w ^? hud . hudElement . diSelection . _Just
invfiltcurs = mselpos ^? _Just . _1 == Just (-1) invfiltcurs = mselpos ^? _Just . _1 == Just (-1)
@@ -142,6 +142,8 @@ updateDisplaySections w cfig =
w ^? hud . hudElement . diCloseFilter . _Just w ^? hud . hudElement . diCloseFilter . _Just
(filtclose, closex) = ((2, sfclose), (3, sclose)) (filtclose, closex) = ((2, sfclose), (3, sclose))
youx = (1, youitems) 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 () youitems = IM.singleton 0 $ SelectionItem [thetext] 1 True invDimColor 0 ()
thetext = displayFreeSlots (crNumFreeSlots cr) thetext = displayFreeSlots (crNumFreeSlots cr)
closeitms = closeitms =
@@ -199,11 +201,9 @@ displayFreeSlots x = case x of
_ -> show x ++ " FREE SLOTS" _ -> show x ++ " FREE SLOTS"
sectionsDesiredLines :: sectionsDesiredLines ::
-- IM.IntMap (SelectionSection a) ->
IM.IntMap (IM.IntMap (SelectionItem a)) -> IM.IntMap (IM.IntMap (SelectionItem a)) ->
IM.IntMap Int IM.IntMap Int
sectionsDesiredLines = fmap $ alaf Sum foldMap _siHeight sectionsDesiredLines = fmap $ alaf Sum foldMap _siHeight
--sectionsDesiredLines = fmap $ alaf Sum foldMap _siHeight . _ssItems
sectionsSizes :: sectionsSizes ::
Int -> -- total available lines Int -> -- total available lines
@@ -261,6 +261,7 @@ updateSectionsPositioning f mselpos allavailablelines lsss indents sss =
return i return i
ls = IM.fromList lsss ls = IM.fromList lsss
h = IM.intersectionWith ($) h = IM.intersectionWith ($)
-- defaults non-existing offsets to 0
g = merge (mapMissing (const ($ 0))) dropMissing (zipWithMatched (const ($))) g = merge (mapMissing (const ($ 0))) dropMissing (zipWithMatched (const ($)))
lk = fromMaybe [] $ fmap ((: []) . fst) mselpos lk = fromMaybe [] $ fmap ((: []) . fst) mselpos
ssizes = ssizes =
+2 -3
View File
@@ -17,7 +17,6 @@ import Dodge.Camera
import Dodge.Creature.Action import Dodge.Creature.Action
import Dodge.Data.Combine import Dodge.Data.Combine
import Dodge.Data.Universe import Dodge.Data.Universe
import Dodge.Default.World
import Dodge.DisplayInventory import Dodge.DisplayInventory
import Dodge.Event.Test import Dodge.Event.Test
import Dodge.InputFocus import Dodge.InputFocus
@@ -480,8 +479,8 @@ toggleMap u = case u ^. uvWorld . hud . hudElement of
DisplayCarte -> DisplayCarte ->
u & uvWorld . hud . hudElement u & uvWorld . hud . hudElement
.~ DisplayInventory .~ DisplayInventory
{ _subInventory = NoSubInventory --MouseInvNothing { _subInventory = NoSubInventory
, _diSections = defaultInvSections , _diSections = mempty
, _diSelection = Nothing , _diSelection = Nothing
, _diSelectionExtra = mempty , _diSelectionExtra = mempty
, _diInvFilter = mempty , _diInvFilter = mempty