25 lines
845 B
Haskell
25 lines
845 B
Haskell
module Affection.MessageBus.Message.KeyboardMessage
|
|
( KeyboardMessage(..)
|
|
-- | SDL reexports
|
|
, SDL.Window
|
|
, SDL.InputMotion
|
|
, SDL.Keysym
|
|
) where
|
|
|
|
import Affection.MessageBus.Message.Class
|
|
|
|
import qualified SDL
|
|
|
|
-- | Dataatype for handling all keyboard events haded down from SDL2
|
|
data KeyboardMessage
|
|
= 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'
|
|
}
|
|
deriving (Show)
|
|
|
|
instance Message KeyboardMessage where
|
|
msgTime (MsgKeyboardEvent t _ _ _ _) = t
|