Add selection item width
This commit is contained in:
@@ -24,6 +24,7 @@ combineList = map f . combineItemListYouX
|
|||||||
SelectionItem
|
SelectionItem
|
||||||
{ _siPictures = basicItemDisplay itm
|
{ _siPictures = basicItemDisplay itm
|
||||||
, _siHeight = _itInvSize itm
|
, _siHeight = _itInvSize itm
|
||||||
|
, _siWidth = 15
|
||||||
, _siIsSelectable = True
|
, _siIsSelectable = True
|
||||||
, _siColor = itemInvColor . pciToCI $ basePCI itm
|
, _siColor = itemInvColor . pciToCI $ basePCI itm
|
||||||
, _siOffX = 0
|
, _siOffX = 0
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ data SelectionItem a
|
|||||||
= SelectionItem
|
= SelectionItem
|
||||||
{ _siPictures :: [String]
|
{ _siPictures :: [String]
|
||||||
, _siHeight :: Int
|
, _siHeight :: Int
|
||||||
|
, _siWidth :: Int
|
||||||
, _siIsSelectable :: Bool
|
, _siIsSelectable :: Bool
|
||||||
, _siColor :: Color
|
, _siColor :: Color
|
||||||
, _siOffX :: Int
|
, _siOffX :: Int
|
||||||
@@ -53,6 +54,7 @@ data SelectionItem a
|
|||||||
| SelectionInfo
|
| SelectionInfo
|
||||||
{ _siPictures :: [String]
|
{ _siPictures :: [String]
|
||||||
, _siHeight :: Int
|
, _siHeight :: Int
|
||||||
|
, _siWidth :: Int
|
||||||
, _siIsSelectable :: Bool
|
, _siIsSelectable :: Bool
|
||||||
, _siColor :: Color
|
, _siColor :: Color
|
||||||
, _siOffX :: Int
|
, _siOffX :: Int
|
||||||
|
|||||||
@@ -170,11 +170,11 @@ updateDisplaySections w cfig =
|
|||||||
btitems =
|
btitems =
|
||||||
IM.fromDistinctAscList . zip [0 ..] $
|
IM.fromDistinctAscList . zip [0 ..] $
|
||||||
mapMaybe (closeButtonToSelectionItem w) (w ^. hud . closeButtons)
|
mapMaybe (closeButtonToSelectionItem w) (w ^. hud . closeButtons)
|
||||||
makehead str i = (i, IM.singleton 0 $ SelectionInfo [str] 1 False white 0)
|
makehead str i = (i, IM.singleton 0 $ SelectionInfo [str] 1 15 False white 0)
|
||||||
statushead = (-4, IM.singleton 0 $ SelectionInfo ["STATUS"] 1 False white 0)
|
statushead = (-4, IM.singleton 0 $ SelectionInfo ["STATUS"] 1 15 False white 0)
|
||||||
statusdisplay = (-3, IM.singleton 0 $ SelectionInfo ["HEALTH: " ++ show (_crHP cr)] 1 False white 0)
|
statusdisplay = (-3, IM.singleton 0 $ SelectionInfo ["HEALTH: " ++ show (_crHP cr)] 1 15 False white 0)
|
||||||
invhead = if null sfinv then makehead "INVENTORY" (-1) else filtinv
|
invhead = if null sfinv then makehead "INVENTORY" (-1) else filtinv
|
||||||
youitems = IM.singleton 0 $ SelectionItem [thetext] 1 True invDimColor 2 ()
|
youitems = IM.singleton 0 $ SelectionItem [thetext] 1 15 True invDimColor 2 ()
|
||||||
thetext = displayFreeSlots (crNumFreeSlots cr)
|
thetext = displayFreeSlots (crNumFreeSlots cr)
|
||||||
closeitms =
|
closeitms =
|
||||||
IM.fromDistinctAscList . zip [0 ..] $
|
IM.fromDistinctAscList . zip [0 ..] $
|
||||||
@@ -207,6 +207,7 @@ filterSectionsPair infocus filtfn itms filtdescription mfilt = (filtsis, itms')
|
|||||||
$ SelectionInfo
|
$ SelectionInfo
|
||||||
[filtdescription ++ " FILTER/" ++ str ++ [filtcurs], numfiltitems]
|
[filtdescription ++ " FILTER/" ++ str ++ [filtcurs], numfiltitems]
|
||||||
2
|
2
|
||||||
|
15
|
||||||
True
|
True
|
||||||
white
|
white
|
||||||
0
|
0
|
||||||
@@ -370,7 +371,7 @@ enterCombineInv cfig w =
|
|||||||
cm
|
cm
|
||||||
| null cm' =
|
| null cm' =
|
||||||
IM.singleton 0 $
|
IM.singleton 0 $
|
||||||
SelectionInfo ["No possible combinations"] 1 False white 0
|
SelectionInfo ["No possible combinations"] 1 25 False white 0
|
||||||
| otherwise = cm'
|
| otherwise = cm'
|
||||||
selpos
|
selpos
|
||||||
| null cm' = Nothing
|
| null cm' = Nothing
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ invSelectionItem indent cr i ci =
|
|||||||
SelectionItem
|
SelectionItem
|
||||||
{ _siPictures = pics & ix 0 %~ (++ anyequippos ++ anyhotkey)
|
{ _siPictures = pics & ix 0 %~ (++ anyequippos ++ anyhotkey)
|
||||||
, _siHeight = _itInvSize $ _cItem ci
|
, _siHeight = _itInvSize $ _cItem ci
|
||||||
|
, _siWidth = 15
|
||||||
, _siIsSelectable = True
|
, _siIsSelectable = True
|
||||||
, _siColor = col
|
, _siColor = col
|
||||||
, _siOffX = indent
|
, _siOffX = indent
|
||||||
@@ -57,6 +58,7 @@ closeItemToSelectionItem w (NInt i) = do
|
|||||||
SelectionItem
|
SelectionItem
|
||||||
{ _siPictures = pics
|
{ _siPictures = pics
|
||||||
, _siHeight = length pics
|
, _siHeight = length pics
|
||||||
|
, _siWidth = 15
|
||||||
, _siIsSelectable = True
|
, _siIsSelectable = True
|
||||||
, _siColor = col
|
, _siColor = col
|
||||||
, _siOffX = 0
|
, _siOffX = 0
|
||||||
@@ -70,6 +72,7 @@ closeButtonToSelectionItem w i = do
|
|||||||
SelectionItem
|
SelectionItem
|
||||||
{ _siPictures = [_btText bt]
|
{ _siPictures = [_btText bt]
|
||||||
, _siHeight = 1
|
, _siHeight = 1
|
||||||
|
, _siWidth = 15
|
||||||
, _siIsSelectable = True
|
, _siIsSelectable = True
|
||||||
, _siColor = yellow
|
, _siColor = yellow
|
||||||
, _siOffX = 0
|
, _siOffX = 0
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ menuOptionToSelectionItem w padAmount mo =
|
|||||||
SelectionItem
|
SelectionItem
|
||||||
{ _siPictures = [optionText]
|
{ _siPictures = [optionText]
|
||||||
, _siHeight = 1
|
, _siHeight = 1
|
||||||
|
, _siWidth = 50
|
||||||
, _siIsSelectable = isselectable
|
, _siIsSelectable = isselectable
|
||||||
, _siColor = thecol
|
, _siColor = thecol
|
||||||
, _siOffX = 0
|
, _siOffX = 0
|
||||||
|
|||||||
+13
-7
@@ -204,6 +204,7 @@ drawExamineInventory cfig w =
|
|||||||
f str =
|
f str =
|
||||||
SelectionItem
|
SelectionItem
|
||||||
{ _siPictures = [str]
|
{ _siPictures = [str]
|
||||||
|
, _siWidth = 55
|
||||||
, _siHeight = 1
|
, _siHeight = 1
|
||||||
, _siIsSelectable = True
|
, _siIsSelectable = True
|
||||||
, _siColor = white
|
, _siColor = white
|
||||||
@@ -366,7 +367,8 @@ drawTerminalDisplay tid cfig w = fromMaybe mempty $ do
|
|||||||
(drawSelectionListBackground secondColumnParams cfig tsize)
|
(drawSelectionListBackground secondColumnParams cfig tsize)
|
||||||
<> color (dark $ _tmExternalColor tm) (drawTitleBackground cfig)
|
<> color (dark $ _tmExternalColor tm) (drawTitleBackground cfig)
|
||||||
where
|
where
|
||||||
toselitm (str, col) = SelectionItem [str] 1 True col 0 ()
|
toselitm (str, col) = SelectionItem [str] 1 55 True col 0 ()
|
||||||
|
-- not sure if the width (55) is correct here
|
||||||
thesellist tm = thelist tm
|
thesellist tm = thelist tm
|
||||||
thelist tm =
|
thelist tm =
|
||||||
map toselitm . displayTermInput tm
|
map toselitm . displayTermInput tm
|
||||||
@@ -476,17 +478,21 @@ selNumPosCardinal ::
|
|||||||
Maybe Point2
|
Maybe Point2
|
||||||
selNumPosCardinal card cfig ldp sss i j = do
|
selNumPosCardinal card cfig ldp sss i j = do
|
||||||
ipos <- selSecYint i j sss
|
ipos <- selSecYint i j sss
|
||||||
size <- selSecSelSize i j sss
|
-- size <- selSecSelSize i j sss
|
||||||
itmindent <- sss ^? ix i . ssItems . ix j . siOffX
|
ysize <- fromIntegral <$> sss ^? ix i . ssItems . ix j . siHeight
|
||||||
sindent <- sss ^? ix i . ssIndent
|
xsize <- fromIntegral <$> sss ^? ix i . ssItems . ix j . siWidth
|
||||||
|
itmindent <- fromIntegral <$> sss ^? ix i . ssItems . ix j . siOffX
|
||||||
|
sindent <- fromIntegral <$> sss ^? ix i . ssIndent
|
||||||
let indent = itmindent + sindent
|
let indent = itmindent + sindent
|
||||||
let offset = cardEightVec card * V2 0 (fromIntegral size * 0.5 * 20 * s)
|
let offset = cardEightVec card * V2
|
||||||
|
(xsize * 0.5 * 10 * s)
|
||||||
|
(ysize * 0.5 * 20 * s)
|
||||||
return $
|
return $
|
||||||
screenPosAbs cfig (ldp ^. ldpPos)
|
screenPosAbs cfig (ldp ^. ldpPos)
|
||||||
+ offset
|
+ offset
|
||||||
+ V2
|
+ V2
|
||||||
(10 * s * fromIntegral indent)
|
(10 * s * (indent + xsize * 0.5))
|
||||||
(negate (20 * s + ygap) * (fromIntegral ipos + fromIntegral size * 0.5))
|
(negate (20 * s + ygap) * (fromIntegral ipos + ysize * 0.5))
|
||||||
where
|
where
|
||||||
s = _ldpScale ldp
|
s = _ldpScale ldp
|
||||||
ygap = _ldpVerticalGap ldp
|
ygap = _ldpVerticalGap ldp
|
||||||
|
|||||||
Reference in New Issue
Block a user