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
|
import qualified SDL
|
||||||
|
|
||||||
|
-- | Helper function that consumes all Joystick-related 'SDL.EventPayload's
|
||||||
|
-- and emits appropriate 'JoystickMessage's
|
||||||
consumeSDLJoystickEvents
|
consumeSDLJoystickEvents
|
||||||
:: forall am us. (Participant am us, Mesg am us ~ JoystickMessage)
|
:: forall am us. (Participant am us, Mesg am us ~ JoystickMessage)
|
||||||
=> am
|
=> am -- ^ The message system participant
|
||||||
-> [SDL.EventPayload]
|
-> [SDL.EventPayload] -- ^ Incoming events
|
||||||
-> Affection us [SDL.EventPayload]
|
-> Affection us [SDL.EventPayload] -- ^ Leftover SDL events
|
||||||
consumeSDLJoystickEvents am = doConsume
|
consumeSDLJoystickEvents am = doConsume
|
||||||
where
|
where
|
||||||
doConsume
|
doConsume
|
||||||
|
|
|
@ -14,11 +14,13 @@ import Control.Monad.IO.Class (liftIO)
|
||||||
|
|
||||||
import qualified SDL
|
import qualified SDL
|
||||||
|
|
||||||
|
-- | Helper function that consumes all Keyboard-related 'SDL.EventPayload's
|
||||||
|
-- and emits appropriate 'KeyboardMessage's
|
||||||
consumeSDLKeyboardEvents
|
consumeSDLKeyboardEvents
|
||||||
:: forall ak us. (Participant ak us, Mesg ak us ~ KeyboardMessage)
|
:: forall ak us. (Participant ak us, Mesg ak us ~ KeyboardMessage)
|
||||||
=> ak
|
=> ak -- ^ The message system participant
|
||||||
-> [SDL.EventPayload]
|
-> [SDL.EventPayload] -- ^ Incoming events
|
||||||
-> Affection us [SDL.EventPayload]
|
-> Affection us [SDL.EventPayload] -- ^ Leftover SDL Events
|
||||||
consumeSDLKeyboardEvents ak = doConsume
|
consumeSDLKeyboardEvents ak = doConsume
|
||||||
where
|
where
|
||||||
doConsume [] = return []
|
doConsume [] = return []
|
||||||
|
|
|
@ -16,11 +16,13 @@ import Linear.Affine (unP)
|
||||||
|
|
||||||
import qualified SDL
|
import qualified SDL
|
||||||
|
|
||||||
|
-- | Helper funtion that consumes all Mouse-related 'SDL.Eventpayload's
|
||||||
|
-- and emits appropriate 'MouseMessage's
|
||||||
consumeSDLMouseEvents
|
consumeSDLMouseEvents
|
||||||
:: forall am us. (Participant am us, Mesg am us ~ MouseMessage)
|
:: forall am us. (Participant am us, Mesg am us ~ MouseMessage)
|
||||||
=> am
|
=> am -- ^ The message system participant
|
||||||
-> [SDL.EventPayload]
|
-> [SDL.EventPayload] -- ^ Incoming events
|
||||||
-> Affection us [SDL.EventPayload]
|
-> Affection us [SDL.EventPayload] -- ^ Leftover SDL events
|
||||||
consumeSDLMouseEvents am = doConsume
|
consumeSDLMouseEvents am = doConsume
|
||||||
where
|
where
|
||||||
doConsume
|
doConsume
|
||||||
|
|
|
@ -16,11 +16,13 @@ import Control.Monad.IO.Class (liftIO)
|
||||||
|
|
||||||
import qualified SDL
|
import qualified SDL
|
||||||
|
|
||||||
|
-- | Helper function that consumes all Window-related 'SDL.EventPayload's
|
||||||
|
-- and emits appropriate 'WindowMessage's.
|
||||||
consumeSDLWindowEvents
|
consumeSDLWindowEvents
|
||||||
:: forall aw us. (Participant aw us, Mesg aw us ~ WindowMessage)
|
:: forall aw us. (Participant aw us, Mesg aw us ~ WindowMessage)
|
||||||
=> aw
|
=> aw -- ^ The message system participant
|
||||||
-> [SDL.EventPayload]
|
-> [SDL.EventPayload] -- ^ Incoming events
|
||||||
-> Affection us [SDL.EventPayload]
|
-> Affection us [SDL.EventPayload] -- ^ Leftover SDL events
|
||||||
consumeSDLWindowEvents aw = doConsume
|
consumeSDLWindowEvents aw = doConsume
|
||||||
where
|
where
|
||||||
doConsume
|
doConsume
|
||||||
|
|
|
@ -7,5 +7,8 @@ import Affection.MessageBus
|
||||||
|
|
||||||
import qualified SDL
|
import qualified SDL
|
||||||
|
|
||||||
|
-- | This class denotes a Subsystem to be part of SDL
|
||||||
class SDLSubsystem s us where
|
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]
|
consumeSDLEvents :: s -> [SDL.EventPayload] -> Affection us [SDL.EventPayload]
|
||||||
|
|
Loading…
Reference in a new issue