Implement terminals
This commit is contained in:
+12
-8
@@ -28,16 +28,16 @@ import SDL (MouseButton (..))
|
||||
--import Data.Bifunctor
|
||||
|
||||
hudDrawings :: Configuration -> World -> Picture
|
||||
hudDrawings cfig w = if _carteDisplay w
|
||||
then drawCarte cfig w
|
||||
else drawInGameHUD cfig w
|
||||
hudDrawings cfig w = case _hudElement $ _hud w of
|
||||
DisplayCarte -> drawCarte cfig w
|
||||
DisplayInventory subinv -> drawInGameHUD cfig w
|
||||
<> subInventoryDisplay subinv cfig w
|
||||
|
||||
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)
|
||||
, inventoryDisplay cfig w
|
||||
, subInventoryDisplay cfig w
|
||||
]
|
||||
|
||||
inventoryDisplay :: Configuration -> World -> Picture
|
||||
@@ -49,7 +49,7 @@ inventoryDisplay cfig w = listTextPicturesAt 0 0 cfig invlist
|
||||
++ displayFreeSlots
|
||||
++ map floorItemsColor (concatMap (closeObjectToTextPictures nfreeslots) (_closeObjects w))
|
||||
floorItemsColor
|
||||
| _inventoryMode w == TopInventory = id
|
||||
| _hudElement (_hud w) == DisplayInventory NoSubInventory = id
|
||||
| otherwise = color invDimColor
|
||||
nfreeslots = crNumFreeSlots cr
|
||||
displayFreeSlots = case nfreeslots of
|
||||
@@ -57,10 +57,10 @@ inventoryDisplay cfig w = listTextPicturesAt 0 0 cfig invlist
|
||||
1 -> [color invDimColor . text $ " +1 FREE SLOT"]
|
||||
x -> [color invDimColor . text $ " +" ++ show x ++ " FREE SLOTS"]
|
||||
|
||||
subInventoryDisplay :: Configuration -> World -> Picture
|
||||
subInventoryDisplay cfig w = case _inventoryMode w of
|
||||
subInventoryDisplay :: SubInventory -> Configuration -> World -> Picture
|
||||
subInventoryDisplay subinv cfig w = case subinv of
|
||||
LockedInventory -> mempty -- topInvCursor col cursPos cfig w
|
||||
TopInventory -> pictures
|
||||
NoSubInventory -> pictures
|
||||
[ selcursor
|
||||
, closeobjectcursor
|
||||
, equipcursor
|
||||
@@ -81,6 +81,10 @@ subInventoryDisplay cfig w = case _inventoryMode w of
|
||||
, invHead cfig "TWEAK"
|
||||
, listTextPicturesAt subInvX 60 cfig $ map text (ammoTweakStrings it)
|
||||
]
|
||||
DisplayTerminal {_termParams = tp} -> pictures
|
||||
[ invHead cfig "TERMINAL"
|
||||
, renderListAt subInvX 60 cfig . reverse $ take (_termMaxLines tp) (_termDisplayedLines tp)
|
||||
]
|
||||
CombineInventory mi -> pictures
|
||||
[ invHead cfig "COMBINE"
|
||||
, listTextPicturesAt subInvX 60 cfig $ combineListStringPictures w
|
||||
|
||||
@@ -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 (negate ty) cfig . map (\(str,col) -> color col $ text str)
|
||||
renderListAt tx ty cfig = listTextPicturesAt 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