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
  -- | Arbitrary Keyboard event
  = MsgKeyboardEvent
    { 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