Record whether a mouse click is continued or not

This commit is contained in:
2022-06-22 17:02:57 +01:00
parent ac0948cb64
commit 698ccb414d
18 changed files with 350 additions and 335 deletions
+5 -4
View File
@@ -32,10 +32,11 @@ import qualified FoldlHelp as L
import Sound.Data
import ShortShow
import qualified Data.Map.Strict as M
--import Data.Bifunctor
import Data.Maybe
--import qualified Control.Foldl as L
import qualified Data.Set as S
--import qualified Data.Set as S
import qualified SDL
autoEffect :: (Item -> Creature -> World -> World) -> Int -> SoundID -> Item -> Creature -> World -> World
autoEffect eff t sid itm cr w
@@ -119,7 +120,7 @@ targetRBCreatureUp it cr w t
& tgPos .~ Nothing
& tgActive .~ False
)
| SDL.ButtonRight `S.member` _mouseButtons w && isJust (t ^? tgID . _Just)
| SDL.ButtonRight `M.member` _mouseButtons w && isJust (t ^? tgID . _Just)
&& canSeeTarget = (w, t & updatePos
& tgActive .~ True
)
@@ -171,7 +172,7 @@ targetUpdateWith f it _ w t
targetCursorUpdate :: World -> Targeting -> Targeting
targetCursorUpdate w t
| SDL.ButtonRight `S.member` _mouseButtons w = t
| SDL.ButtonRight `M.member` _mouseButtons w = t
& tgPos . _Just .~ mouseWorldPos w
& tgActive .~ True
| otherwise = t & tgPos %~ const Nothing
@@ -179,7 +180,7 @@ targetCursorUpdate w t
targetRBPressUpdate :: World -> Targeting -> Targeting
targetRBPressUpdate w t
| SDL.ButtonRight `S.member` _mouseButtons w = t
| SDL.ButtonRight `M.member` _mouseButtons w = t
& tgPos %~ maybe (Just $ mouseWorldPos w) Just
& tgActive .~ True
| otherwise = t & tgPos %~ const Nothing