Cleanup
This commit is contained in:
@@ -5,7 +5,7 @@ import Dodge.Data.Creature.Misc
|
|||||||
crMass :: CreatureType -> Float
|
crMass :: CreatureType -> Float
|
||||||
crMass = \case
|
crMass = \case
|
||||||
Avatar {} -> 10
|
Avatar {} -> 10
|
||||||
ChaseCrit {} -> 12
|
ChaseCrit {} -> 10
|
||||||
HoverCrit {} -> 5
|
HoverCrit {} -> 5
|
||||||
SwarmCrit -> 2
|
SwarmCrit -> 2
|
||||||
AutoCrit -> 10
|
AutoCrit -> 10
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ data MouseContext
|
|||||||
= NoMouseContext
|
= NoMouseContext
|
||||||
| MouseAiming
|
| MouseAiming
|
||||||
| MouseInGame
|
| MouseInGame
|
||||||
| MouseMenuClick {_mcoMenuClick :: Int}
|
| MouseMenu {_mcoMenuClick :: Maybe Int}
|
||||||
| MouseMenuCursor
|
|
||||||
| OverInvDrag {_mcoDragSection :: Int , _mcoMaybeSelect :: Maybe (Int,Int) }
|
| OverInvDrag {_mcoDragSection :: Int , _mcoMaybeSelect :: Maybe (Int,Int) }
|
||||||
| OverInvDragSelect { _mcoSecSelStart :: Maybe (Int,Int), _mcoSelEnd :: Maybe Int }
|
| OverInvDragSelect { _mcoSecSelStart :: Maybe (Int,Int), _mcoSelEnd :: Maybe Int }
|
||||||
| OverInvSelect { _mcoInvSelect :: (Int,Int)}
|
| OverInvSelect { _mcoInvSelect :: (Int,Int)}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ fpsText x = scale 0.2 0.2 . color col . text $ "ms/frame " ++ show x
|
|||||||
drawMenuOrHUD :: Config -> Universe -> Picture
|
drawMenuOrHUD :: Config -> Universe -> Picture
|
||||||
drawMenuOrHUD cf u = case u ^. uvScreenLayers of
|
drawMenuOrHUD cf u = case u ^. uvScreenLayers of
|
||||||
[] -> drawHUD (u ^. uvConfig) (u ^. uvWorld)
|
[] -> 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 :: Universe -> Picture
|
||||||
drawConcurrentMessage u =
|
drawConcurrentMessage u =
|
||||||
@@ -91,8 +91,9 @@ mouseCursorType :: Universe -> Picture
|
|||||||
mouseCursorType u = case u ^. uvWorld . input . mouseContext of
|
mouseCursorType u = case u ^. uvWorld . input . mouseContext of
|
||||||
NoMouseContext -> drawEmptySet 5
|
NoMouseContext -> drawEmptySet 5
|
||||||
MouseAiming -> rotate a (drawPlus 5)
|
MouseAiming -> rotate a (drawPlus 5)
|
||||||
MouseMenuClick{} -> drawMenuClick 5
|
MouseMenu Nothing -> drawMenuCursor 5
|
||||||
MouseMenuCursor -> drawMenuCursor 5
|
MouseMenu{} -> drawMenuClick 5
|
||||||
|
-- MouseMenuCursor -> drawMenuCursor 5
|
||||||
MouseInGame -> drawPlus 5
|
MouseInGame -> drawPlus 5
|
||||||
OverInvDrag 0 (Just (3, _)) -> drawDragDrop 5
|
OverInvDrag 0 (Just (3, _)) -> drawDragDrop 5
|
||||||
OverInvDrag 0 Nothing -> drawDragDrop 5
|
OverInvDrag 0 Nothing -> drawDragDrop 5
|
||||||
|
|||||||
+2
-2
@@ -471,10 +471,10 @@ getDebugMouseOver u = fromMaybe MouseInGame $ do
|
|||||||
getMenuMouseContext :: ScreenLayer -> Universe -> MouseContext
|
getMenuMouseContext :: ScreenLayer -> Universe -> MouseContext
|
||||||
getMenuMouseContext screen u = case screen ^. scOptions of
|
getMenuMouseContext screen u = case screen ^. scOptions of
|
||||||
[] -> NoMouseContext
|
[] -> NoMouseContext
|
||||||
_ -> fromMaybe MouseMenuCursor $ do
|
_ -> fromMaybe (MouseMenu Nothing) $ do
|
||||||
yi <- ldpSelection (u ^. uvConfig) menuLDP (u ^. uvWorld . input . mousePos)
|
yi <- ldpSelection (u ^. uvConfig) menuLDP (u ^. uvWorld . input . mousePos)
|
||||||
t <- screen ^? scSelectionList . ix yi . siIsSelectable
|
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 :: World -> World
|
||||||
updateWheelEvents w = case w ^. input . scrollAmount of
|
updateWheelEvents w = case w ^. input . scrollAmount of
|
||||||
|
|||||||
@@ -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
|
$ max (1+20*(ldp^.ldpVerticalGap + ldp^?!ldpSize._Just._y.to fromIntegral)-h*b) y
|
||||||
V2 a b = ldp ^. ldpPos . spScreenOff
|
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 :: Config -> Int -> Int -> Maybe (Int, Int) -> World -> World
|
||||||
doDrag cfig n k mmouseover w = fromMaybe w $ do
|
doDrag cfig n k mmouseover w = fromMaybe w $ do
|
||||||
guard (n /= 0)
|
guard (n /= 0)
|
||||||
|
|||||||
@@ -69,17 +69,13 @@ optionScreenDefaultEffect u = fromMaybe u $ do
|
|||||||
-- ouch this is not good
|
-- ouch this is not good
|
||||||
mouseClickOptionsList :: Universe -> Universe
|
mouseClickOptionsList :: Universe -> Universe
|
||||||
mouseClickOptionsList u = fromMaybe u $ do
|
mouseClickOptionsList u = fromMaybe u $ do
|
||||||
sl <- u ^? uvScreenLayers . ix 0 . scSelectionList
|
l <- case u ^. uvWorld . input . mouseButtons of
|
||||||
case u ^. uvWorld . input . mouseButtons of
|
mbs | mbs ^. at ButtonLeft == Just 0 -> Just _1
|
||||||
mbs | mbs ^. at ButtonLeft == Just 0 -> do
|
mbs | mbs ^. at ButtonRight == Just 0 -> Just _2
|
||||||
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
|
|
||||||
_ -> Nothing
|
_ -> 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 :: Config -> LDParams -> Point2 -> Maybe Int
|
||||||
ldpSelection cfig ldp (V2 _ y)
|
ldpSelection cfig ldp (V2 _ y)
|
||||||
|
|||||||
Reference in New Issue
Block a user