This commit is contained in:
2026-04-06 11:38:21 +01:00
parent 9e29550a20
commit 21573d0b05
6 changed files with 14 additions and 23 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ import Dodge.Data.Creature.Misc
crMass :: CreatureType -> Float
crMass = \case
Avatar {} -> 10
ChaseCrit {} -> 12
ChaseCrit {} -> 10
HoverCrit {} -> 5
SwarmCrit -> 2
AutoCrit -> 10
+1 -2
View File
@@ -14,8 +14,7 @@ data MouseContext
= NoMouseContext
| MouseAiming
| MouseInGame
| MouseMenuClick {_mcoMenuClick :: Int}
| MouseMenuCursor
| MouseMenu {_mcoMenuClick :: Maybe Int}
| OverInvDrag {_mcoDragSection :: Int , _mcoMaybeSelect :: Maybe (Int,Int) }
| OverInvDragSelect { _mcoSecSelStart :: Maybe (Int,Int), _mcoSelEnd :: Maybe Int }
| OverInvSelect { _mcoInvSelect :: (Int,Int)}
+4 -3
View File
@@ -67,7 +67,7 @@ fpsText x = scale 0.2 0.2 . color col . text $ "ms/frame " ++ show x
drawMenuOrHUD :: Config -> Universe -> Picture
drawMenuOrHUD cf u = case u ^. uvScreenLayers of
[] -> drawHUD (u ^. uvConfig) (u ^. uvWorld)
(x : _) -> drawMenuScreen (u ^? uvWorld . input . mouseContext . mcoMenuClick) x cf
(x : _) -> drawMenuScreen (u ^? uvWorld . input . mouseContext . mcoMenuClick . _Just) x cf
drawConcurrentMessage :: Universe -> Picture
drawConcurrentMessage u =
@@ -91,8 +91,9 @@ mouseCursorType :: Universe -> Picture
mouseCursorType u = case u ^. uvWorld . input . mouseContext of
NoMouseContext -> drawEmptySet 5
MouseAiming -> rotate a (drawPlus 5)
MouseMenuClick{} -> drawMenuClick 5
MouseMenuCursor -> drawMenuCursor 5
MouseMenu Nothing -> drawMenuCursor 5
MouseMenu{} -> drawMenuClick 5
-- MouseMenuCursor -> drawMenuCursor 5
MouseInGame -> drawPlus 5
OverInvDrag 0 (Just (3, _)) -> drawDragDrop 5
OverInvDrag 0 Nothing -> drawDragDrop 5
+2 -2
View File
@@ -471,10 +471,10 @@ getDebugMouseOver u = fromMaybe MouseInGame $ do
getMenuMouseContext :: ScreenLayer -> Universe -> MouseContext
getMenuMouseContext screen u = case screen ^. scOptions of
[] -> NoMouseContext
_ -> fromMaybe MouseMenuCursor $ do
_ -> fromMaybe (MouseMenu Nothing) $ do
yi <- ldpSelection (u ^. uvConfig) menuLDP (u ^. uvWorld . input . mousePos)
t <- screen ^? scSelectionList . ix yi . siIsSelectable
return $ if t then MouseMenuClick yi else NoMouseContext
return $ if t then MouseMenu (Just yi) else NoMouseContext
updateWheelEvents :: World -> World
updateWheelEvents w = case w ^. input . scrollAmount of
-5
View File
@@ -140,11 +140,6 @@ setPixelOffsetBounded cfig (V2 x y) ldp = ldp & ldpPos . spPixelOff .~ V2 x' y'
$ max (1+20*(ldp^.ldpVerticalGap + ldp^?!ldpSize._Just._y.to fromIntegral)-h*b) y
V2 a b = ldp ^. ldpPos . spScreenOff
--leftHeldPosShift :: World -> Point2
--leftHeldPosShift w = fromMaybe 0 $ do
-- p <- w ^? input . heldPos . ix SDL.ButtonLeft
-- return $ w ^. input . mousePos - p
doDrag :: Config -> Int -> Int -> Maybe (Int, Int) -> World -> World
doDrag cfig n k mmouseover w = fromMaybe w $ do
guard (n /= 0)
+6 -10
View File
@@ -69,17 +69,13 @@ optionScreenDefaultEffect u = fromMaybe u $ do
-- ouch this is not good
mouseClickOptionsList :: Universe -> Universe
mouseClickOptionsList u = fromMaybe u $ do
sl <- u ^? uvScreenLayers . ix 0 . scSelectionList
case u ^. uvWorld . input . mouseButtons of
mbs | mbs ^. at ButtonLeft == Just 0 -> do
i <- u ^? uvWorld . input . mouseContext . mcoMenuClick
f <- sl ^? ix i . siPayload . _Just . _1
return $ f u & uvSoundQueue .:~ click1S
mbs | mbs ^. at ButtonRight == Just 0 -> do
i <- u ^? uvWorld . input . mouseContext . mcoMenuClick
f <- sl ^? ix i . siPayload . _Just . _2
return $ f u & uvSoundQueue .:~ click1S
l <- case u ^. uvWorld . input . mouseButtons of
mbs | mbs ^. at ButtonLeft == Just 0 -> Just _1
mbs | mbs ^. at ButtonRight == Just 0 -> Just _2
_ -> Nothing
i <- u ^? uvWorld . input . mouseContext . mcoMenuClick . _Just
f <- u ^? uvScreenLayers . ix 0 . scSelectionList . ix i . siPayload . _Just . l
return $ f u & uvSoundQueue .:~ click1S
ldpSelection :: Config -> LDParams -> Point2 -> Maybe Int
ldpSelection cfig ldp (V2 _ y)