Tweak debug display
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
|
||||
module Dodge.Update (updateUniverse) where
|
||||
|
||||
import qualified Data.Set as S
|
||||
import Color
|
||||
import Control.Applicative
|
||||
import Control.Monad
|
||||
@@ -340,6 +342,7 @@ updateMouseContextGame cfig u = \case
|
||||
return MouseGameRotate
|
||||
aimcontext
|
||||
| ButtonRight `M.member` (w ^. input . mouseButtons) = MouseAiming
|
||||
| Display_debug `S.member` (cfig ^. debug_booleans) = getDebugMouseOver u
|
||||
| otherwise = MouseInGame
|
||||
mpos = w ^. input . mousePos
|
||||
disss = w ^. hud . diSections
|
||||
@@ -370,6 +373,18 @@ updateMouseContextGame cfig u = \case
|
||||
then OverTerminal tmid (tm ^. tmStatus)
|
||||
else OutsideTerminal
|
||||
|
||||
getDebugMouseOver :: Universe -> MouseContext
|
||||
getDebugMouseOver u = fromMaybe MouseInGame $ do
|
||||
guard $ x >0 && x < 100
|
||||
(db,j) <- m ^? ix i
|
||||
return $ OverDebug db j
|
||||
where
|
||||
f (a,as) = (a,) <$> [0..length as - 1]
|
||||
m = foldMap f . M.toList $ u ^. uvDebug
|
||||
i = floor (y /20)
|
||||
y = halfHeight (u^.uvConfig) - y'
|
||||
V2 x y' = u^.uvWorld.input.mousePos
|
||||
|
||||
getMenuMouseContext :: ScreenLayer -> Universe -> MouseContext
|
||||
getMenuMouseContext screen u = case screen ^. scOptions of
|
||||
[] -> NoMouseContext
|
||||
|
||||
Reference in New Issue
Block a user