Files
loop/src/Dodge/ListDisplayParams.hs
T

55 lines
1.4 KiB
Haskell

module Dodge.ListDisplayParams (
invDP,
invCursorParams,
secondColumnLDP,
terminalLDP,
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 (..))
defaultLDP :: LDParams
defaultLDP = LDP
{ _ldpVerticalGap = 0
, _ldpScale = 1
, _ldpPos =
ScreenPos
{ _spScreenOff = V2 (-0.5) 0.5 -- top left
, _spPixelOff = 0
}
, _ldpBorder = Nothing
}
invDP :: LDParams
invDP = defaultLDP & ldpPos . spPixelOff .~ V2 16 (-20)
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 :: LDParams
secondColumnLDP = defaultLDP & ldpPos . spPixelOff .~ V2 subInvX (-20)
terminalLDP :: LDParams
terminalLDP = secondColumnLDP & ldpBorder ?~ (49, 16)
subInvX :: Float
subInvX = 10 * fromIntegral topInvW + 170
topInvW :: Int
topInvW = 15
menuLDP :: LDParams
menuLDP = defaultLDP & ldpPos . spPixelOff .~ V2 11 (-70) & ldpScale .~ 2