Files
loop/src/Dodge/ListDisplayParams.hs
T
2025-09-19 19:56:12 +01:00

58 lines
1.5 KiB
Haskell

module Dodge.ListDisplayParams (
invDP,
invCursorParams,
secondColumnLDP,
subInvX,
menuLDP,
) where
import Control.Lens
import qualified Data.Map.Strict as M
import Dodge.Data.CardinalPoint
import Dodge.Data.ScreenPos
import Dodge.Data.SelectionList
import Dodge.Data.World
import Linear
import SDL (MouseButton (..))
defaultListDisplayParams :: ListDisplayParams
defaultListDisplayParams =
ListDisplayParams
{ _ldpVerticalGap = 0
, _ldpScale = 1
, _ldpPos =
ScreenPos
{ _spScreenOff = V2 (-0.5) 0.5 -- top left
, _spPixelOff = 0
}
}
invDP :: ListDisplayParams
invDP =
defaultListDisplayParams
-- & ldpPos . spPixelOff .~ V2 6 (-1)
& ldpPos . spPixelOff .~ V2 6 0
invCursorParams :: World -> CursorDisplay
invCursorParams w = BoundaryCursor $ case w ^? hud . subInventory of
-- Just ExamineInventory{} -> [North, South, East, West]
Just CombineInventory{} -> []
_ | ButtonRight `M.member` _mouseButtons (_input w) -> [North, South, East, West]
_ -> [North, South, West]
secondColumnLDP :: ListDisplayParams
secondColumnLDP = defaultListDisplayParams & ldpPos . spPixelOff .~ V2 subInvX (-20)
subInvX :: Float
subInvX = 10 * fromIntegral topInvW + 170
topInvW :: Int
topInvW = 15
menuLDP :: ListDisplayParams
menuLDP =
defaultListDisplayParams
& ldpPos . spPixelOff .~ V2 11 (-70)
& ldpScale .~ 2
& ldpVerticalGap .~ 0