diff --git a/src/Dodge/Event.hs b/src/Dodge/Event.hs index 24b123238..631c58671 100644 --- a/src/Dodge/Event.hs +++ b/src/Dodge/Event.hs @@ -3,17 +3,17 @@ Module : Dodge.Event Description : Direct event handling Deals with direct events. -This includes individual key or mouse presses, but /not/ continuous held down input. -We cannot handle multiple keys held down at once here, +This could include individual key or mouse presses. +However, we cannot handle multiple keys held down at once here, (eg left mouse button + right mouse button) because these are separate events. -Instead we store the events in a set, and deal with the combinations in -"Dodge.Update"; in particular see 'updatePressedButtons'. +Nor could we handle continuous mouse button input. +Instead we store button presses (in a Map) and deal with the combinations in +the simulation step; in particular see 'updatePressedButtons'. -} module Dodge.Event ( handleEvent ) where -import Dodge.Terminal import Dodge.InputFocus import Dodge.Combine import Dodge.Event.Keyboard @@ -26,13 +26,11 @@ import Dodge.Data import Dodge.PreloadData --import Dodge.Creature.Action import Dodge.Inventory -import Dodge.Inventory.Add import Dodge.SoundLogic --import Geometry --import Preload.Update --import Dodge.FloorItem import qualified IntMapHelp as IM -import ListHelp --import Data.Monoid import Control.Lens diff --git a/src/Dodge/Update/UsingInput.hs b/src/Dodge/Update/UsingInput.hs index 744e257e4..89d4b1866 100644 --- a/src/Dodge/Update/UsingInput.hs +++ b/src/Dodge/Update/UsingInput.hs @@ -25,7 +25,6 @@ updateUsingInput w = case _hudElement $ _hud w of DisplayCarte -> updatePressedButtonsCarte (_mouseButtons w) w --- ugly check for subinventory inventory hammer, this should change updatePressedButtons :: SubInventory -> M.Map MouseButton Bool -> World -> World updatePressedButtons subinv pkeys w = case subinv of NoSubInventory diff --git a/src/Dodge/WorldEvent/ThingsHit.hs b/src/Dodge/WorldEvent/ThingsHit.hs index 468a498ef..18214e99e 100644 --- a/src/Dodge/WorldEvent/ThingsHit.hs +++ b/src/Dodge/WorldEvent/ThingsHit.hs @@ -16,7 +16,7 @@ import Geometry import Data.Maybe import Data.Bifunctor -import Streaming +import StreamingHelp import qualified Streaming.Prelude as S {- List those objects that appear on a line. -} @@ -24,12 +24,12 @@ thingsHit :: Point2 -- ^ Line start point -> Point2 -- ^ Line end point -> World - -> Stream (Of (Point2, Either Creature Wall)) Identity () + -> StreamOf (Point2, Either Creature Wall) thingsHit sp ep w = void $ S.mergeOn (dist sp . fst) (S.map (second Left) (crsHit sp ep w)) (S.map (second Right) (wlsHit sp ep w)) -crsHit :: Point2 -> Point2 -> World -> Stream (Of (Point2, Creature)) Identity () +crsHit :: Point2 -> Point2 -> World -> StreamOf (Point2, Creature) crsHit sp ep | sp == ep = const mempty | otherwise = sortStreamOn (dist sp . fst) @@ -48,14 +48,14 @@ thingsHitExceptCr -> Point2 -- ^ Line start point -> Point2 -- ^ Line end point -> World - -> Stream (Of (Point2, Either Creature Wall)) Identity () + -> StreamOf (Point2, Either Creature Wall) thingsHitExceptCr Nothing sp ep = thingsHit sp ep thingsHitExceptCr (Just cid) sp ep = S.filter crNotCid . thingsHit sp ep where crNotCid (_,Left cr) = _crID cr /= cid crNotCid _ = True -wlsHit :: Point2 -> Point2 -> World -> Stream (Of (Point2, Wall)) Identity () +wlsHit :: Point2 -> Point2 -> World -> StreamOf (Point2, Wall) wlsHit sp ep | sp == ep = const mempty | otherwise = sortStreamOn (dist sp . fst)