Record whether a mouse click is continued or not
This commit is contained in:
@@ -4,6 +4,7 @@ module Dodge.Creature.Impulse.UseItem
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Inventory
|
||||
import Dodge.Reloading
|
||||
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
--import qualified Data.IntSet as IS
|
||||
|
||||
@@ -12,7 +12,8 @@ import Geometry
|
||||
|
||||
import Control.Lens
|
||||
import qualified SDL
|
||||
import qualified Data.Set as S
|
||||
--import qualified Data.Set as S
|
||||
import qualified Data.Map.Strict as M
|
||||
--import qualified Data.IntMap.Strict as IM
|
||||
--import Data.Maybe
|
||||
{- | The AI equivalent for your control. -}
|
||||
@@ -34,7 +35,7 @@ wasdWithAiming
|
||||
-> Creature
|
||||
wasdWithAiming w speed cr
|
||||
| isAiming = addAnyTwist $ set crDir mouseDir $ theMovement cr
|
||||
| crIsReloading cr && SDL.ButtonRight `S.member` _mouseButtons w
|
||||
| crIsReloading cr && SDL.ButtonRight `M.member` _mouseButtons w
|
||||
= addAnyTwist $ set crDir (mouseDir + anytwist) $ theMovement cr
|
||||
| otherwise = theMovement $ theTurn $ removeTwist cr
|
||||
where
|
||||
@@ -70,9 +71,9 @@ wasdDir :: World -> Point2
|
||||
wasdDir = foldr ((+.+) . wasdM) (V2 0 0) . _keys
|
||||
|
||||
{- | Set posture according to mouse presses. -}
|
||||
mouseActionsCr :: S.Set SDL.MouseButton -> Creature -> Creature
|
||||
mouseActionsCr :: M.Map SDL.MouseButton Bool -> Creature -> Creature
|
||||
mouseActionsCr pkeys cr
|
||||
| rbPressed = cr & crStance . posture .~ Aiming
|
||||
| otherwise = cr & crStance . posture .~ AtEase
|
||||
where
|
||||
rbPressed = SDL.ButtonRight `S.member` pkeys
|
||||
rbPressed = SDL.ButtonRight `M.member` pkeys
|
||||
|
||||
Reference in New Issue
Block a user