documentation
This commit is contained in:
parent
276966f80d
commit
6b1e7b557a
5 changed files with 23 additions and 12 deletions
|
@ -20,11 +20,13 @@ import Foreign.C.Types (CInt(..))
|
|||
|
||||
import qualified SDL
|
||||
|
||||
-- | Helper function that consumes all Joystick-related 'SDL.EventPayload's
|
||||
-- and emits appropriate 'JoystickMessage's
|
||||
consumeSDLJoystickEvents
|
||||
:: forall am us. (Participant am us, Mesg am us ~ JoystickMessage)
|
||||
=> am
|
||||
-> [SDL.EventPayload]
|
||||
-> Affection us [SDL.EventPayload]
|
||||
=> am -- ^ The message system participant
|
||||
-> [SDL.EventPayload] -- ^ Incoming events
|
||||
-> Affection us [SDL.EventPayload] -- ^ Leftover SDL events
|
||||
consumeSDLJoystickEvents am = doConsume
|
||||
where
|
||||
doConsume
|
||||
|
|
|
@ -14,11 +14,13 @@ import Control.Monad.IO.Class (liftIO)
|
|||
|
||||
import qualified SDL
|
||||
|
||||
-- | Helper function that consumes all Keyboard-related 'SDL.EventPayload's
|
||||
-- and emits appropriate 'KeyboardMessage's
|
||||
consumeSDLKeyboardEvents
|
||||
:: forall ak us. (Participant ak us, Mesg ak us ~ KeyboardMessage)
|
||||
=> ak
|
||||
-> [SDL.EventPayload]
|
||||
-> Affection us [SDL.EventPayload]
|
||||
=> ak -- ^ The message system participant
|
||||
-> [SDL.EventPayload] -- ^ Incoming events
|
||||
-> Affection us [SDL.EventPayload] -- ^ Leftover SDL Events
|
||||
consumeSDLKeyboardEvents ak = doConsume
|
||||
where
|
||||
doConsume [] = return []
|
||||
|
|
|
@ -16,11 +16,13 @@ import Linear.Affine (unP)
|
|||
|
||||
import qualified SDL
|
||||
|
||||
-- | Helper funtion that consumes all Mouse-related 'SDL.Eventpayload's
|
||||
-- and emits appropriate 'MouseMessage's
|
||||
consumeSDLMouseEvents
|
||||
:: forall am us. (Participant am us, Mesg am us ~ MouseMessage)
|
||||
=> am
|
||||
-> [SDL.EventPayload]
|
||||
-> Affection us [SDL.EventPayload]
|
||||
=> am -- ^ The message system participant
|
||||
-> [SDL.EventPayload] -- ^ Incoming events
|
||||
-> Affection us [SDL.EventPayload] -- ^ Leftover SDL events
|
||||
consumeSDLMouseEvents am = doConsume
|
||||
where
|
||||
doConsume
|
||||
|
|
|
@ -16,11 +16,13 @@ import Control.Monad.IO.Class (liftIO)
|
|||
|
||||
import qualified SDL
|
||||
|
||||
-- | Helper function that consumes all Window-related 'SDL.EventPayload's
|
||||
-- and emits appropriate 'WindowMessage's.
|
||||
consumeSDLWindowEvents
|
||||
:: forall aw us. (Participant aw us, Mesg aw us ~ WindowMessage)
|
||||
=> aw
|
||||
-> [SDL.EventPayload]
|
||||
-> Affection us [SDL.EventPayload]
|
||||
=> aw -- ^ The message system participant
|
||||
-> [SDL.EventPayload] -- ^ Incoming events
|
||||
-> Affection us [SDL.EventPayload] -- ^ Leftover SDL events
|
||||
consumeSDLWindowEvents aw = doConsume
|
||||
where
|
||||
doConsume
|
||||
|
|
|
@ -7,5 +7,8 @@ import Affection.MessageBus
|
|||
|
||||
import qualified SDL
|
||||
|
||||
-- | This class denotes a Subsystem to be part of SDL
|
||||
class SDLSubsystem s us where
|
||||
-- | Consume the given 'SDL.EventPayload's and return only those not
|
||||
-- recognised
|
||||
consumeSDLEvents :: s -> [SDL.EventPayload] -> Affection us [SDL.EventPayload]
|
||||
|
|
Loading…
Reference in a new issue