Work towards adding external ammo sources
This commit is contained in:
@@ -19,7 +19,7 @@ import SDL
|
||||
updateUseInputOnScreen :: ScreenLayer -> Universe -> Universe
|
||||
updateUseInputOnScreen sl = case sl of
|
||||
InputScreen{} -> doInputScreenInput (sl ^. scInput)
|
||||
_ -> optionScreenUpdate sl
|
||||
_ -> optionScreenUpdate
|
||||
|
||||
doInputScreenInput :: String -> Universe -> Universe
|
||||
doInputScreenInput s u =
|
||||
@@ -35,37 +35,28 @@ doInputScreenInput s u =
|
||||
| ispressed ScancodeEscape = uvScreenLayers %~ tail
|
||||
| otherwise = id
|
||||
|
||||
optionScreenUpdate ::
|
||||
ScreenLayer ->
|
||||
Universe ->
|
||||
Universe
|
||||
optionScreenUpdate screen u =
|
||||
optionScreenUpdate :: Universe -> Universe
|
||||
optionScreenUpdate u =
|
||||
(uvScreenLayers . ix 0 . scDisplayTime +~ 1)
|
||||
. refreshOptionsSelectionList
|
||||
. mouseOverSelectionList
|
||||
. optionScreenDefaultEffect mop
|
||||
. mouseClickOptionsList screen
|
||||
. optionScreenDefaultEffect
|
||||
. mouseClickOptionsList
|
||||
. menuWheelEvents
|
||||
. over (uvScreenLayers . _head) (setSelectionListRestriction (u ^. uvConfig))
|
||||
$ u
|
||||
where
|
||||
mop = _scPositionedMenuOption screen
|
||||
|
||||
optionScreenDefaultEffect :: EscapeMenuOption -> Universe -> Universe
|
||||
optionScreenDefaultEffect f u =
|
||||
fromMaybe
|
||||
id
|
||||
( do
|
||||
ptype <- u ^. uvWorld . input . pressedKeys . at ScancodeEscape
|
||||
guard $ ptype == InitialPress
|
||||
f ^? emoMenuOption . moEff
|
||||
)
|
||||
u
|
||||
optionScreenDefaultEffect :: Universe -> Universe
|
||||
optionScreenDefaultEffect u = fromMaybe u $ do
|
||||
f <- u ^? uvScreenLayers . ix 0 . scPositionedMenuOption
|
||||
ptype <- u ^. uvWorld . input . pressedKeys . at ScancodeEscape
|
||||
guard $ ptype == InitialPress
|
||||
(f ^? emoMenuOption . moEff) <*> return u
|
||||
|
||||
-- ouch this is not good
|
||||
mouseClickOptionsList :: ScreenLayer -> Universe -> Universe
|
||||
mouseClickOptionsList screen u = fromMaybe u $ do
|
||||
sl <- screen ^? scSelectionList
|
||||
mouseClickOptionsList :: Universe -> Universe
|
||||
mouseClickOptionsList u = fromMaybe u $ do
|
||||
sl <- u ^? uvScreenLayers . ix 0 . scSelectionList
|
||||
Just $ case u ^. uvWorld . input . mouseButtons . at ButtonLeft of
|
||||
Just 0 -> fromMaybe u $ do
|
||||
i <- sl ^. slSelPos
|
||||
|
||||
Reference in New Issue
Block a user