Cleanup
This commit is contained in:
+21
-23
@@ -39,12 +39,12 @@ hudDrawings cfig w = case _hudElement $ _hud w of
|
||||
drawInGameHUD :: Configuration -> World -> Picture
|
||||
drawInGameHUD cfig w = pictures
|
||||
[ winScale cfig . dShadCol white $ displayHP 0 cfig w
|
||||
, listTextPicturesAt (halfWidth cfig) 0 cfig $ map text (_testString w w)
|
||||
, listPicturesAt (halfWidth cfig) 0 cfig $ map text (_testString w w)
|
||||
, inventoryDisplay cfig w
|
||||
]
|
||||
|
||||
inventoryDisplay :: Configuration -> World -> Picture
|
||||
inventoryDisplay cfig w = listTextPicturesAt 0 0 cfig invlist
|
||||
inventoryDisplay cfig w = listPicturesAt 0 0 cfig invlist
|
||||
where
|
||||
cr = you w
|
||||
inv = _crInv cr
|
||||
@@ -84,36 +84,34 @@ subInventoryDisplay subinv cfig w = case subinv of
|
||||
return $ lnkMidInvSel cfig w curpos tweaki
|
||||
<> listCursorNSW subInvX 60 cfig tweaki white (length $ tweakstring ++ tweakname) 1
|
||||
, invHead cfig "TWEAK"
|
||||
, listTextPicturesAt subInvX 60 cfig $ map text (ammoTweakStrings it)
|
||||
, listPicturesAt subInvX 60 cfig $ map text (ammoTweakStrings it)
|
||||
]
|
||||
DisplayTerminal tid -> displayTerminal tid cfig w
|
||||
CombineInventory mi -> pictures
|
||||
[ invHead cfig "COMBINE"
|
||||
, listTextPicturesAt subInvX 60 cfig $ combineListStringPictures w
|
||||
, listPicturesAt subInvX 60 cfig $ combineListStringPictures w
|
||||
, fromMaybe mempty $ do
|
||||
i <- mi
|
||||
cpos <- combinePoss w !? i
|
||||
strs <- fmap (fst . snd) (combineItemListStringInfo w !? i)
|
||||
return $ listTextPicturesAtOffset (subInvX + 150) 60 cfig cpos $ map (color red . text) strs
|
||||
, fromMaybe mempty $ do
|
||||
i <- mi
|
||||
cpos <- combinePoss w !? i
|
||||
csize <- combineSizes w !? i
|
||||
i <- mi
|
||||
cpos <- combinePoss w !? i
|
||||
col <- (combineItemListYou w !? i) <&> _itInvColor . snd
|
||||
return $ listCursorNSW subInvX 60 cfig cpos col 15 csize
|
||||
, fromMaybe mempty $ do
|
||||
i <- mi
|
||||
cpos <- combinePoss w !? i
|
||||
col <- (combineItemListYou w !? i) <&> _itInvColor . snd
|
||||
lnks <- map fst (combineItemListYou w) !? i
|
||||
return $ lnkMidPosInvSelsCol cfig w cpos col lnks
|
||||
<> foldMap (topCursorTypeWidth listCursorNESW (topInvW +2) cfig w) lnks
|
||||
<> combineCounts cfig w lnks
|
||||
return $ pictures
|
||||
[ fromMaybe mempty $ do
|
||||
strs <- fmap (fst . snd) (combineListInfo w !? i)
|
||||
return $ listPicturesAtOff (subInvX + 150) 60 cfig cpos $ map (color red . text) strs
|
||||
, fromMaybe mempty $ do
|
||||
csize <- combineSizes w !? i
|
||||
return $ listCursorNSW subInvX 60 cfig cpos col 15 csize
|
||||
, fromMaybe mempty $ do
|
||||
lnks <- map fst (combineItemListYou w) !? i
|
||||
return $ lnkMidPosInvSelsCol cfig w cpos col lnks
|
||||
<> foldMap (topCursorTypeWidth listCursorNESW (topInvW +2) cfig w) lnks
|
||||
<> combineCounts cfig w lnks
|
||||
]
|
||||
]
|
||||
InspectInventory -> mconcat
|
||||
[ selcursor' listCursorNESW
|
||||
, invHead cfig "INSPECT"
|
||||
, listTextPicturesAt subInvX 60 cfig $ map text (itmInfo it)
|
||||
, listPicturesAt subInvX 60 cfig $ map text (itmInfo it)
|
||||
]
|
||||
where
|
||||
closeobjectcursor = case selectedCloseObject w of
|
||||
@@ -165,7 +163,7 @@ displayTerminal tid cfig w = fromMaybe mempty $ do
|
||||
|
||||
drawRBOptions :: Configuration -> World -> RightButtonOptions -> Picture
|
||||
drawRBOptions cfig w EquipOptions{_opEquip = es,_opSel=i, _opAllocateEquipment=ae} =
|
||||
listTextPicturesAtOffset 342 0 cfig (curpos-i) (map (text . eqPosText) es)
|
||||
listPicturesAtOff 342 0 cfig (curpos-i) (map (text . eqPosText) es)
|
||||
<> case ae of
|
||||
DoNotMoveEquipment -> mempty
|
||||
PutOnEquipment {}
|
||||
|
||||
@@ -9,11 +9,11 @@ import Data.Maybe
|
||||
|
||||
-- given a list of pictures that are each the size of a "text" call, displays them as
|
||||
-- a list on the screen
|
||||
listTextPicturesAt :: Float -> Float -> Configuration -> [Picture] -> Picture
|
||||
listTextPicturesAt tx ty cfig = listTextPicturesAtOffset tx ty cfig 0
|
||||
listPicturesAt :: Float -> Float -> Configuration -> [Picture] -> Picture
|
||||
listPicturesAt tx ty cfig = listPicturesAtOff tx ty cfig 0
|
||||
|
||||
listTextPicturesAtOffset :: Float -> Float -> Configuration -> Int -> [Picture] -> Picture
|
||||
listTextPicturesAtOffset tx ty cfig i = mconcat . zipWith (listTextPictureAt tx ty cfig) [i..]
|
||||
listPicturesAtOff :: Float -> Float -> Configuration -> Int -> [Picture] -> Picture
|
||||
listPicturesAtOff tx ty cfig i = mconcat . zipWith (listTextPictureAt tx ty cfig) [i..]
|
||||
|
||||
-- displays a cursor that should match up to list text pictures
|
||||
-- the width of a character appears to be 9(?!)
|
||||
@@ -61,7 +61,7 @@ listTextPictureAt xoff yoff cfig yint = winScale cfig
|
||||
hh = halfHeight cfig
|
||||
|
||||
renderListAt :: Float -> Float -> Configuration -> [(String,Color)] -> Picture
|
||||
renderListAt tx ty cfig = listTextPicturesAt tx ty cfig . map (\(str,col) -> color col $ text str)
|
||||
renderListAt tx ty cfig = listPicturesAt tx ty cfig . map (\(str,col) -> color col $ text str)
|
||||
-- concatMapPic (winScale cfig) . zipWith (listPairAt tx ty cfig) [0..]
|
||||
|
||||
--TODO put the following functions in an appropriate place
|
||||
|
||||
Reference in New Issue
Block a user