Remove explicit scancode from menu items
This commit is contained in:
+17
-10
@@ -78,16 +78,17 @@ subInvSelectionList = SelectionList
|
||||
|
||||
inventorySelectionList :: World -> [SelectionItem]
|
||||
inventorySelectionList w = map (invSelectionItem cr) (IM.toList inv)
|
||||
++ [SelectionItem displayFreeSlots 1 False white 0]
|
||||
++ [SelectionItem displayFreeSlots 1 False (length thetext) white 0]
|
||||
++ map (closeObjectToSelectionItem nfreeslots) (w ^. cWorld . lWorld . closeObjects)
|
||||
where
|
||||
cr = you w
|
||||
inv = _crInv cr
|
||||
nfreeslots = crNumFreeSlots cr
|
||||
displayFreeSlots = case nfreeslots of
|
||||
0 -> [color invDimColor . text $ " INVENTORY FULL"]
|
||||
1 -> [color invDimColor . text $ " +1 FREE SLOT"]
|
||||
x -> [color invDimColor . text $ " +" ++ show x ++ " FREE SLOTS"]
|
||||
thetext = case nfreeslots of
|
||||
0 -> " INVENTORY FULL"
|
||||
1 -> " +1 FREE SLOT"
|
||||
x -> " +" ++ show x ++ " FREE SLOTS"
|
||||
displayFreeSlots = [color invDimColor $ text thetext]
|
||||
|
||||
inventoryCursorPos :: SubInventory -> World -> Maybe Int
|
||||
inventoryCursorPos subinv w = case subinv of
|
||||
@@ -316,11 +317,14 @@ combineListSelection w = subInvSelectionList & slItems .~ combineListSelectionIt
|
||||
|
||||
combineListSelectionItems :: World -> [SelectionItem]
|
||||
combineListSelectionItems w = case combineListSelectionItems' w of
|
||||
[] -> [SelectionItem [text "NO POSSIBLE COMBINATIONS"] 1 False white 0]
|
||||
[] -> [SelectionItem [text thetext] 1 False (length thetext) white 0]
|
||||
xs -> xs
|
||||
where
|
||||
thetext = "NO POSSIBLE COMBINATIONS"
|
||||
|
||||
|
||||
combineListSelectionItems' :: World -> [SelectionItem]
|
||||
combineListSelectionItems' w = map (picsToSelectable . itemText . snd) $ combineItemListYou w
|
||||
combineListSelectionItems' w = map (picsToSelectable 15 . itemText . snd) $ combineItemListYou w
|
||||
|
||||
ammoTweakSelectionItems :: Maybe Item -> [SelectionItem]
|
||||
ammoTweakSelectionItems = textSelItems . ammoTweakStrings
|
||||
@@ -349,6 +353,7 @@ closeObjectToSelectionItem n e = SelectionItem
|
||||
{ _siPictures = pics
|
||||
, _siHeight = length pics
|
||||
, _siIsSelectable = True
|
||||
, _siWidth = 15
|
||||
, _siColor = col
|
||||
, _siOffX = 2
|
||||
}
|
||||
@@ -447,23 +452,25 @@ mapWall cfig thehud wl =
|
||||
mainListCursor :: Color -> Int -> Configuration -> Picture
|
||||
mainListCursor c = openCursorAt 120 c 5 0
|
||||
|
||||
picsToSelectable :: [Picture] -> SelectionItem
|
||||
picsToSelectable pics = SelectionItem
|
||||
picsToSelectable :: Int -> [Picture] -> SelectionItem
|
||||
picsToSelectable wdth pics = SelectionItem
|
||||
{ _siPictures = pics
|
||||
, _siHeight = length pics
|
||||
, _siIsSelectable = True
|
||||
, _siWidth = wdth
|
||||
, _siColor = white
|
||||
, _siOffX = 0
|
||||
}
|
||||
|
||||
textSelItems :: [String] -> [SelectionItem]
|
||||
textSelItems = map (picsToSelectable . (:[]) . text)
|
||||
textSelItems = map (picsToSelectable 15 . (:[]) . text)
|
||||
|
||||
invSelectionItem :: Creature -> (Int,Item) -> SelectionItem
|
||||
invSelectionItem cr (i,it) = SelectionItem
|
||||
{ _siPictures = pics
|
||||
, _siHeight = length pics
|
||||
, _siIsSelectable = True
|
||||
, _siWidth = 15
|
||||
, _siColor = col
|
||||
, _siOffX = 0
|
||||
}
|
||||
|
||||
@@ -5,17 +5,14 @@ module Dodge.Render.MenuScreen (
|
||||
) where
|
||||
|
||||
import Dodge.Menu.Option
|
||||
import Dodge.Data.CardinalPoint
|
||||
import Dodge.Render.List
|
||||
import Dodge.Data.SelectionList
|
||||
import qualified Data.Text as T
|
||||
import Dodge.Base.Window
|
||||
import Dodge.Data.Universe
|
||||
import Dodge.ScodeToChar
|
||||
import Dodge.WindowLayout
|
||||
import Padding
|
||||
import Picture
|
||||
import qualified Data.Set as Set
|
||||
|
||||
menuScreen' :: Universe -> ScreenLayer -> Picture
|
||||
menuScreen' w screen = case screen of
|
||||
@@ -95,8 +92,8 @@ drawOptions u title ops off mselpos footer =
|
||||
x | x < length ops -> take (availableMenuLines cfig) (drop off visibleops)
|
||||
_ -> visibleops
|
||||
ops'' = case availableMenuLines cfig of
|
||||
x | x < length ops -> map (menuOptionToString u maxOptionLength) ops' ++ [(white, "SPACE: MORE OPTIONS")]
|
||||
_ -> map (menuOptionToString u maxOptionLength) ops'
|
||||
x | x < length ops -> zipWith (menuOptionToString u maxOptionLength) ['A'..] ops' ++ [(white, "SPACE: MORE OPTIONS")]
|
||||
_ -> zipWith (menuOptionToString u maxOptionLength) ['A'..] ops'
|
||||
visibleops = filter notInvisible ops
|
||||
notInvisible InvisibleToggle{} = False
|
||||
notInvisible _ = True
|
||||
|
||||
Reference in New Issue
Block a user