affection/src/Affection/MessageBus/Message/MouseMessage.hs

42 lines
1 KiB
Haskell
Raw Normal View History

2017-12-13 03:37:16 +00:00
module Affection.MessageBus.Message.MouseMessage where
import Affection.MessageBus.Message.Class
2017-12-13 14:19:53 +00:00
import Data.Word (Word8(..))
2017-12-13 03:37:16 +00:00
import Data.Int (Int32(..))
import qualified SDL
import Linear (V2(..))
data MouseMessage
= MsgMouseMotion
2017-12-13 14:19:53 +00:00
{ msgMMWhen :: Double
2017-12-13 03:37:16 +00:00
, msgMMWindow :: Maybe SDL.Window
, msgMMWhich :: SDL.MouseDevice
, msgMMState :: [SDL.MouseButton]
, msgMMPos :: V2 Int32
, msgMMRelMotion :: V2 Int32
}
| MsgMouseButton
2017-12-13 14:19:53 +00:00
{ msgMBWhen :: Double
2017-12-13 03:37:16 +00:00
, msgMBWindow :: Maybe SDL.Window
, msgMBWhich :: SDL.MouseDevice
, msgMBButton :: SDL.MouseButton
, msgMBClicks :: Word8
, msgMBPos :: V2 Int32
}
| MsgMouseWheel
2017-12-13 14:19:53 +00:00
{ msgMWWhen :: Double
2017-12-13 03:37:16 +00:00
, msgMWWhindow :: Maybe SDL.Window
, msgMWWhich :: SDL.MouseDevice
, msgMWPos :: V2 Int32
, msgMWDIrection :: SDL.MouseScrollDirection
}
2017-12-13 04:05:18 +00:00
deriving (Show)
2017-12-13 03:37:16 +00:00
instance Message MouseMessage where
msgTime (MsgMouseMotion t _ _ _ _ _) = t
msgTime (MsgMouseButton t _ _ _ _ _) = t
msgTime (MsgMouseWheel t _ _ _ _) = t