2018-09-25 05:02:33 +00:00
|
|
|
module Affection.MessageBus.Message.KeyboardMessage
|
|
|
|
( KeyboardMessage(..)
|
|
|
|
-- | SDL reexports
|
|
|
|
, SDL.Window
|
|
|
|
, SDL.InputMotion
|
|
|
|
, SDL.Keysym
|
|
|
|
) where
|
2017-12-12 12:10:55 +00:00
|
|
|
|
|
|
|
import Affection.MessageBus.Message.Class
|
|
|
|
|
|
|
|
import qualified SDL
|
|
|
|
|
2018-09-25 05:02:33 +00:00
|
|
|
-- | Dataatype for handling all keyboard events haded down from SDL2
|
2017-12-20 01:00:48 +00:00
|
|
|
data KeyboardMessage
|
2018-09-25 05:02:33 +00:00
|
|
|
= MsgKeyboardEvent -- ^ Arbitrary Keyboard event
|
|
|
|
{ msgKbdWhen :: Double -- ^ Message time
|
|
|
|
, msgKbdWindow :: Maybe SDL.Window -- ^ Affected Window
|
|
|
|
, msgKbdKeyMotion :: SDL.InputMotion -- ^ Input motion of button (pressed/released)
|
|
|
|
, msgKbdKeyRepeat :: Bool -- ^ Is this a repeated event?
|
|
|
|
, msgKbdKeysym :: SDL.Keysym -- ^ The button's 'SDL.Keysym'
|
2017-12-20 01:00:48 +00:00
|
|
|
}
|
|
|
|
deriving (Show)
|
2017-12-12 12:10:55 +00:00
|
|
|
|
|
|
|
instance Message KeyboardMessage where
|
|
|
|
msgTime (MsgKeyboardEvent t _ _ _ _) = t
|