90 lines
2.2 KiB
Haskell
90 lines
2.2 KiB
Haskell
|
{-# LANGUAGE RankNTypes #-}
|
||
|
module Affection.MessageBus.Message.WindowMessage where
|
||
|
|
||
|
import Affection.MessageBus.Message.Class
|
||
|
|
||
|
import Data.Word (Word32(..))
|
||
|
import Data.Int (Int32(..))
|
||
|
|
||
|
import qualified SDL
|
||
|
|
||
|
import Linear (V2(..))
|
||
|
|
||
|
data SystemMessage
|
||
|
= MsgEngineReady Word32
|
||
|
| MsgWindowShown
|
||
|
{ msgWSWhen :: Word32
|
||
|
, msgWSWindow :: SDL.Window
|
||
|
}
|
||
|
| MsgWindowHidden
|
||
|
{ msgWHWhen :: Word32
|
||
|
, msgWHWindow :: SDL.Window
|
||
|
}
|
||
|
| MsgWindowExposed
|
||
|
{ msgWEWhen :: Word32
|
||
|
, msgWEWindow :: SDL.Window
|
||
|
}
|
||
|
| MsgWindowMoved
|
||
|
{ msgWMWhen :: Word32
|
||
|
, msgWMWindow :: SDL.Window
|
||
|
, msgWMNewPos :: V2 Int32
|
||
|
}
|
||
|
| MsgWindowResized
|
||
|
{ msgWRWhen :: Word32
|
||
|
, msgWRWindow :: SDL.Window
|
||
|
, msgWRNewSize :: V2 Int32
|
||
|
}
|
||
|
| MsgWindowSizeChanged
|
||
|
{ msgWSCWhen :: Word32
|
||
|
, msgWSCWindow :: SDL.Window
|
||
|
}
|
||
|
| MsgWindowMinimized
|
||
|
{ msgWMinWhen :: Word32
|
||
|
, msgWMinWindow :: SDL.Window
|
||
|
}
|
||
|
| MsgWindowMaximized
|
||
|
{ msgWMaxWhen :: Word32
|
||
|
, msgWMaxWindow :: SDL.Window
|
||
|
}
|
||
|
| MsgWindowRestored
|
||
|
{ msgWRestWhen :: Word32
|
||
|
, msgWRestWindow :: SDL.Window
|
||
|
}
|
||
|
| MsgWindowGainedMouseFocus
|
||
|
{ msgWGMFWhen :: Word32
|
||
|
, msgWGMFWindow :: SDL.Window
|
||
|
}
|
||
|
| MsgWindowLostMouseFocus
|
||
|
{ msgWLMFWhen :: Word32
|
||
|
, msgWLMFWindow :: SDL.Window
|
||
|
}
|
||
|
| MsgWindowGainedKeyboardFocus
|
||
|
{ msgWGKFWhen :: Word32
|
||
|
, msgWGKFWindow :: SDL.Window
|
||
|
}
|
||
|
| MsgWindowLostKeyboardFocus
|
||
|
{ msgWLKFWhen :: Word32
|
||
|
, msgWLKFWindow :: SDL.Window
|
||
|
}
|
||
|
| MsgWindowClosed
|
||
|
{ msgWCWhen :: Word32
|
||
|
, msgWCWindow :: SDL.Window
|
||
|
}
|
||
|
|
||
|
instance Message SystemMessage where
|
||
|
msgTime (MsgEngineReady t) = t
|
||
|
msgTime (MsgWindowShown t _) = t
|
||
|
msgTime (MsgWindowHidden t _) = t
|
||
|
msgTime (MsgWindowExposed t _) = t
|
||
|
msgTime (MsgWindowMoved t _ _) = t
|
||
|
msgTime (MsgWindowResized t _ _) = t
|
||
|
msgTime (MsgWindowSizeChanged t _) = t
|
||
|
msgTime (MsgWindowMinimized t _) = t
|
||
|
msgTime (MsgWindowMaximized t _) = t
|
||
|
msgTime (MsgWindowRestored t _) = t
|
||
|
msgTime (MsgWindowGainedMouseFocus t _) = t
|
||
|
msgTime (MsgWindowLostMouseFocus t _) = t
|
||
|
msgTime (MsgWindowGainedKeyboardFocus t _) = t
|
||
|
msgTime (MsgWindowLostKeyboardFocus t _) = t
|
||
|
msgTime (MsgWindowClosed t _) = t
|