41 lines
1 KiB
Haskell
41 lines
1 KiB
Haskell
|
module Affection.MessageBus.Message.MouseMessage where
|
||
|
|
||
|
import Affection.MessageBus.Message.Class
|
||
|
|
||
|
import Data.Word (Word32(..), Word8(..))
|
||
|
import Data.Int (Int32(..))
|
||
|
|
||
|
import qualified SDL
|
||
|
|
||
|
import Linear (V2(..))
|
||
|
|
||
|
data MouseMessage
|
||
|
= MsgMouseMotion
|
||
|
{ msgMMWhen :: Word32
|
||
|
, msgMMWindow :: Maybe SDL.Window
|
||
|
, msgMMWhich :: SDL.MouseDevice
|
||
|
, msgMMState :: [SDL.MouseButton]
|
||
|
, msgMMPos :: V2 Int32
|
||
|
, msgMMRelMotion :: V2 Int32
|
||
|
}
|
||
|
| MsgMouseButton
|
||
|
{ msgMBWhen :: Word32
|
||
|
, msgMBWindow :: Maybe SDL.Window
|
||
|
, msgMBWhich :: SDL.MouseDevice
|
||
|
, msgMBButton :: SDL.MouseButton
|
||
|
, msgMBClicks :: Word8
|
||
|
, msgMBPos :: V2 Int32
|
||
|
}
|
||
|
| MsgMouseWheel
|
||
|
{ msgMWWhen :: Word32
|
||
|
, msgMWWhindow :: Maybe SDL.Window
|
||
|
, msgMWWhich :: SDL.MouseDevice
|
||
|
, msgMWPos :: V2 Int32
|
||
|
, msgMWDIrection :: SDL.MouseScrollDirection
|
||
|
}
|
||
|
|
||
|
instance Message MouseMessage where
|
||
|
msgTime (MsgMouseMotion t _ _ _ _ _) = t
|
||
|
msgTime (MsgMouseButton t _ _ _ _ _) = t
|
||
|
msgTime (MsgMouseWheel t _ _ _ _) = t
|