Add file
This commit is contained in:
@@ -0,0 +1,65 @@
|
|||||||
|
module Dodge.ListDisplayParams where
|
||||||
|
|
||||||
|
import Dodge.Data.CardinalPoint
|
||||||
|
import SDL (MouseButton (..))
|
||||||
|
import Dodge.Data.SelectionList
|
||||||
|
import Dodge.Data.World
|
||||||
|
import qualified Data.Map.Strict as M
|
||||||
|
import Control.Lens
|
||||||
|
|
||||||
|
|
||||||
|
defaultListDisplayParams :: ListDisplayParams
|
||||||
|
defaultListDisplayParams =
|
||||||
|
ListDisplayParams
|
||||||
|
{ _ldpVerticalGap = 10
|
||||||
|
, _ldpScale = 1
|
||||||
|
, _ldpPosX = 0
|
||||||
|
, _ldpPosY = 0
|
||||||
|
, _ldpCursorType = NoCursor
|
||||||
|
, _ldpWidth = FixedSelectionWidth 15
|
||||||
|
}
|
||||||
|
|
||||||
|
invDisplayParams :: World -> ListDisplayParams
|
||||||
|
invDisplayParams w =
|
||||||
|
defaultListDisplayParams
|
||||||
|
& ldpCursorType .~ BorderCursor selcursortype
|
||||||
|
& ldpWidth .~ FixedSelectionWidth (determineInvSelCursorWidth w)
|
||||||
|
where
|
||||||
|
selcursortype
|
||||||
|
| isexaminesub || ButtonRight `M.member` _mouseButtons (_input w) = [North, South, East, West]
|
||||||
|
| otherwise = [North, South, West]
|
||||||
|
isexaminesub = case w ^? hud . hudElement . subInventory of
|
||||||
|
Just ExamineInventory{} -> True
|
||||||
|
_ -> False
|
||||||
|
|
||||||
|
secondColumnParams :: ListDisplayParams
|
||||||
|
secondColumnParams =
|
||||||
|
defaultListDisplayParams
|
||||||
|
& ldpPosX .~ subInvX
|
||||||
|
& ldpPosY .~ 60
|
||||||
|
& ldpCursorType .~ BorderCursor [North, South, West]
|
||||||
|
|
||||||
|
subInvX :: Float
|
||||||
|
subInvX = 9 * fromIntegral topInvW + 50
|
||||||
|
|
||||||
|
topInvW :: Int
|
||||||
|
topInvW = 15
|
||||||
|
|
||||||
|
--thirdColumnParams :: ListDisplayParams
|
||||||
|
--thirdColumnParams =
|
||||||
|
-- defaultListDisplayParams
|
||||||
|
-- & ldpPosX .~ 9 * fromIntegral topInvW + 275
|
||||||
|
-- & ldpPosY .~ 60
|
||||||
|
|
||||||
|
determineInvSelCursorWidth :: World -> Int
|
||||||
|
determineInvSelCursorWidth w = case _rbOptions w of
|
||||||
|
NoRightButtonOptions -> topInvW
|
||||||
|
EquipOptions{}
|
||||||
|
| ButtonRight `M.member` _mouseButtons (_input w)
|
||||||
|
&& hasnosubinv ->
|
||||||
|
47
|
||||||
|
| otherwise -> topInvW
|
||||||
|
where
|
||||||
|
hasnosubinv = case w ^? hud . hudElement . subInventory of
|
||||||
|
Just NoSubInventory -> True
|
||||||
|
_ -> False
|
||||||
Reference in New Issue
Block a user