Improve mouse menu controls, tweak charmap

This commit is contained in:
2022-12-21 11:33:11 +00:00
parent 860d63df45
commit 03c945d189
12 changed files with 68 additions and 50 deletions
-3
View File
@@ -43,7 +43,6 @@ drawInGameHUD :: SubInventory -> Universe -> Picture
drawInGameHUD subinv uv =
pictures
[ winScale cfig . dShadCol white $ displayHP 0 cfig w
, listPicturesAt (halfWidth cfig) 0 cfig $ map text (_uvTestString uv uv)
, inventoryDisplay subinv cfig w
]
where
@@ -64,7 +63,6 @@ defaultSelectionList = SelectionList
, _slWidth = FixedSelectionWidth 15
, _slLength = 0
, _slSizeRestriction = NoSelectionSizeRestriction
, _slSpecialItem = NoSpecialSelectionItem
}
subInvSelectionList :: SelectionList
@@ -81,7 +79,6 @@ subInvSelectionList = SelectionList
, _slWidth = FixedSelectionWidth 15
, _slLength = 0
, _slSizeRestriction = NoSelectionSizeRestriction
, _slSpecialItem = NoSpecialSelectionItem
}
inventorySelectionList :: World -> [SelectionItem]
+1 -1
View File
@@ -23,7 +23,7 @@ drawSelectionList cfig sl =
(_slPosX sl)
(_slPosY sl)
cfig
(_slOffset sl)
0 --(_slOffset sl)
(makeSelectionListPictures sl)
<> drawSelectionCursor cfig sl
+14 -15
View File
@@ -1,7 +1,6 @@
{- The menu picture. -}
module Dodge.Render.MenuScreen (
menuScreen,
menuScreen',
drawMenuScreen,
) where
--import LensHelp
@@ -15,8 +14,8 @@ import Dodge.Data.Universe
import Padding
import Picture
menuScreen' :: Configuration -> ScreenLayer -> Picture
menuScreen' cfig screen = case screen of
drawMenuScreen :: Configuration -> ScreenLayer -> Picture
drawMenuScreen cfig screen = case screen of
OptionScreen{_scTitle = titf, _scSelectionList = selpos} ->
drawOptions cfig titf selpos "Use keys to navigate the menu"
-- (WaitScreen sf _) -> drawOptions w (sf w) [] 0 ""
@@ -24,12 +23,12 @@ menuScreen' cfig screen = case screen of
-- (DisplayScreen sd) -> sd w
(ColumnsScreen titf pairs) -> drawTwoColumnsScreen cfig titf pairs
menuScreen :: Configuration -> ScreenLayer -> Picture
menuScreen cfig screen = case screen of
OptionScreen{_scTitle = titf, _scSelectionList = selpos} ->
drawOptions cfig titf selpos "Use keys to navigate the menu"
(InputScreen inputstr help) -> drawInputMenu cfig ('>' : T.unpack inputstr) help
(ColumnsScreen titf pairs) -> drawTwoColumnsScreen cfig titf pairs
--menuScreen :: Configuration -> ScreenLayer -> Picture
--menuScreen cfig screen = case screen of
-- OptionScreen{_scTitle = titf, _scSelectionList = selpos} ->
-- drawOptions cfig titf selpos "Use keys to navigate the menu"
-- (InputScreen inputstr help) -> drawInputMenu cfig ('>' : T.unpack inputstr) help
-- (ColumnsScreen titf pairs) -> drawTwoColumnsScreen cfig titf pairs
--displayStringList :: World -> [String] -> Picture
--displayStringList w ss = pictures
@@ -72,8 +71,8 @@ drawInputMenu ::
Picture
drawInputMenu cfig title footer =
pictures
[ --darkenBackground cfig
drawTitle cfig title
[ darkenBackground cfig
, drawTitle cfig title
, drawFooterText cfig red footer
]
@@ -88,14 +87,14 @@ drawOptions ::
Picture
drawOptions cfig title sl footer =
pictures
[ --darkenBackground cfig
drawTitle cfig title
[ darkenBackground cfig
, drawTitle cfig title
, drawFooterText cfig red footer
, drawSelectionList cfig sl
]
darkenBackground :: Configuration -> Picture
darkenBackground = color (withAlpha 0.5 black) . polygon . reverse . screenBox
darkenBackground cfig = winScale cfig . color (withAlpha 0.5 black) . polygon . reverse . screenBox $ cfig
drawTitle :: Configuration -> String -> Picture
drawTitle cfig = winScale cfig . translate (30 - hw) (hh-50) . scale 0.4 0.4 . text
+9 -5
View File
@@ -13,14 +13,18 @@ import Geometry
import Picture
fixedCoordPictures :: Universe -> Picture
fixedCoordPictures u =
drawConcurrentMessage u <> customMouseCursor cfig (u ^. uvWorld . input) <> case u ^. uvScreenLayers of
[] -> drawHUD u
(lay : _) -> setDepth (-1) (menuScreen' cfig lay)
-- <> (setDepth (-1) . winScale cfig $ menuScreen cfig lay)
fixedCoordPictures u = drawMenuOrHUD cfig u
<> drawConcurrentMessage u
<> customMouseCursor cfig (u ^. uvWorld . input)
<> listPicturesAt (halfWidth cfig) 0 cfig (map text (_uvTestString u u))
where
cfig = _uvConfig u
drawMenuOrHUD :: Configuration -> Universe -> Picture
drawMenuOrHUD cfig u = case u ^. uvScreenLayers of
[] -> drawHUD u
(lay : _) -> drawMenuScreen cfig lay
drawConcurrentMessage :: Universe -> Picture
drawConcurrentMessage u =
stackPicturesAt