Highlight moused-over inventory items
This commit is contained in:
+13
-2
@@ -6,6 +6,8 @@ Description : Simulation update
|
||||
-}
|
||||
module Dodge.Update (updateUniverse) where
|
||||
|
||||
import Dodge.ListDisplayParams
|
||||
import Dodge.SelectionSections
|
||||
import Data.Monoid
|
||||
import NewInt
|
||||
import Control.Monad
|
||||
@@ -232,7 +234,7 @@ scrollTimeForward w = case w ^? timeFlow . futureWorlds . _head of
|
||||
|
||||
-- | The update step.
|
||||
functionalUpdate :: Universe -> Universe
|
||||
functionalUpdate w =
|
||||
functionalUpdate u =
|
||||
checkEndGame
|
||||
. over uvWorld (cWorld . lWorld . lClock +~ 1)
|
||||
. over uvWorld updateDistortions
|
||||
@@ -276,11 +278,12 @@ functionalUpdate w =
|
||||
. over uvWorld updateRBList
|
||||
. over uvWorld updateCloseObjects
|
||||
. over uvWorld updateWheelEvents
|
||||
. over uvWorld (updateMouseOverInventory (u ^. uvConfig))
|
||||
. over uvWorld zoneClouds
|
||||
. over uvWorld zoneCreatures
|
||||
-- . over uvWorld updateInventorySelectionList
|
||||
. set (uvWorld . cWorld . lWorld . flares) []
|
||||
$ over uvWorld updatePastWorlds w
|
||||
$ over uvWorld updatePastWorlds u
|
||||
|
||||
checkTermDist :: World -> World
|
||||
checkTermDist w = fromMaybe w $ do
|
||||
@@ -290,6 +293,14 @@ checkTermDist w = fromMaybe w $ do
|
||||
guard $ dist btpos (_crPos $ you w) > 40
|
||||
return (w & hud . hudElement . subInventory .~ NoSubInventory Nothing Nothing)
|
||||
|
||||
updateMouseOverInventory :: Configuration -> World -> World
|
||||
updateMouseOverInventory cfig w = fromMaybe w $ do
|
||||
sss <- w ^? hud . hudElement . diSections
|
||||
guard $ w ^. input . mouseMoving
|
||||
let x = inverseSelNumPos cfig ldp sss (w ^. input . mousePos)
|
||||
return $ w & hud . hudElement . subInventory . nsMouseOver .~ x
|
||||
where
|
||||
ldp = invDisplayParams w
|
||||
|
||||
updateWheelEvents :: World -> World
|
||||
updateWheelEvents w
|
||||
|
||||
Reference in New Issue
Block a user