Handle menu selection with mouse context, remove wheel scroll control
This commit is contained in:
@@ -14,6 +14,7 @@ module Dodge.Render.List (
|
||||
listCursorChooseBorderScale,
|
||||
selSecDrawCursorAt,
|
||||
drawTitleBackground, -- should be renamed, made sensible
|
||||
drawCursorAt,
|
||||
) where
|
||||
|
||||
import Dodge.ListDisplayParams
|
||||
@@ -38,11 +39,11 @@ drawSelectionList ldps cfig sl =
|
||||
(ldps ^. ldpScale)
|
||||
0
|
||||
(makeSelectionListPictures sl)
|
||||
<> drawCursorAt
|
||||
(sl ^. slSelPos)
|
||||
(sl ^. slItems)
|
||||
ldps
|
||||
(BoundaryCursor [North, South])
|
||||
-- <> drawCursorAt
|
||||
-- (sl ^. slSelPos)
|
||||
-- (sl ^. slItems)
|
||||
-- ldps
|
||||
-- (BoundaryCursor [North, South])
|
||||
|
||||
drawTitleBackground :: Configuration -> Picture
|
||||
drawTitleBackground cfig =
|
||||
|
||||
@@ -3,16 +3,19 @@ module Dodge.Render.MenuScreen (
|
||||
drawMenuScreen,
|
||||
) where
|
||||
|
||||
import Dodge.ScreenPos
|
||||
import Dodge.Data.CardinalPoint
|
||||
import Control.Lens
|
||||
import Dodge.Render.List
|
||||
import Dodge.Base.Window
|
||||
import Dodge.Data.SelectionList
|
||||
import Dodge.Data.Universe
|
||||
import Dodge.Render.List
|
||||
import Picture
|
||||
|
||||
drawMenuScreen :: Configuration -> ScreenLayer -> Picture
|
||||
drawMenuScreen cfig screen = case screen of
|
||||
OptionScreen{_scTitle = titf, _scSelectionList = selpos, _scListDisplayParams = ldps} ->
|
||||
drawOptions ldps cfig titf selpos
|
||||
drawMenuScreen :: Configuration -> Maybe Int -> ScreenLayer -> Picture
|
||||
drawMenuScreen cfig spos screen = case screen of
|
||||
OptionScreen{_scTitle = titf, _scSelectionList = slist, _scListDisplayParams = ldps} ->
|
||||
drawOptions ldps cfig titf spos slist
|
||||
InputScreen inputstr help -> drawInputMenu cfig ('>' : inputstr) help
|
||||
|
||||
drawInputMenu ::
|
||||
@@ -34,13 +37,19 @@ drawOptions ::
|
||||
Configuration ->
|
||||
-- | Title
|
||||
String ->
|
||||
-- | Select position
|
||||
Maybe Int ->
|
||||
SelectionList a ->
|
||||
Picture
|
||||
drawOptions ldps cfig title sl =
|
||||
drawOptions ldps cfig title msel sl =
|
||||
darkenBackground cfig
|
||||
<> drawTitle cfig title
|
||||
<> drawSelectionList ldps cfig sl
|
||||
<> translateScreenPos cfig (ldps ^. ldpPos) (drawCursorAt
|
||||
msel
|
||||
(sl ^. slItems)
|
||||
ldps
|
||||
(BoundaryCursor [North, South])
|
||||
)
|
||||
|
||||
darkenBackground :: Configuration -> Picture
|
||||
darkenBackground = color (withAlpha 0.5 black) . polygon . reverse . screenBox
|
||||
|
||||
@@ -57,7 +57,7 @@ fpsText x = color col . text $ "ms/frame " ++ show x
|
||||
drawMenuOrHUD :: Configuration -> Universe -> Picture
|
||||
drawMenuOrHUD cfig u = case u ^. uvScreenLayers of
|
||||
[] -> drawHUD (u ^. uvConfig) (u ^. uvWorld)
|
||||
(lay : _) -> drawMenuScreen cfig lay
|
||||
(lay : _) -> drawMenuScreen cfig (u ^? uvWorld . input . mouseContext . mcoMenuClick) lay
|
||||
|
||||
drawConcurrentMessage :: Universe -> Picture
|
||||
drawConcurrentMessage u =
|
||||
|
||||
Reference in New Issue
Block a user