affection/src/Affection/MessageBus/Message/WindowMessage.hs
2017-12-12 13:12:47 +01:00

89 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 WindowMessage
-- = MsgEngineReady Word32
= MsgWindowShow
{ msgWSWhen :: Word32
, msgWSWindow :: SDL.Window
}
| MsgWindowHide
{ msgWHWhen :: Word32
, msgWHWindow :: SDL.Window
}
| MsgWindowExpose
{ msgWEWhen :: Word32
, msgWEWindow :: SDL.Window
}
| MsgWindowMove
{ msgWMWhen :: Word32
, msgWMWindow :: SDL.Window
, msgWMNewPos :: V2 Int32
}
| MsgWindowResize
{ msgWRWhen :: Word32
, msgWRWindow :: SDL.Window
, msgWRNewSize :: V2 Int32
}
| MsgWindowSizeChange
{ msgWSCWhen :: Word32
, msgWSCWindow :: SDL.Window
}
| MsgWindowMinimize
{ msgWMinWhen :: Word32
, msgWMinWindow :: SDL.Window
}
| MsgWindowMaximize
{ msgWMaxWhen :: Word32
, msgWMaxWindow :: SDL.Window
}
| MsgWindowRestore
{ msgWRestWhen :: Word32
, msgWRestWindow :: SDL.Window
}
| MsgWindowGainMouseFocus
{ msgWGMFWhen :: Word32
, msgWGMFWindow :: SDL.Window
}
| MsgWindowLoseMouseFocus
{ msgWLMFWhen :: Word32
, msgWLMFWindow :: SDL.Window
}
| MsgWindowGainKeyboardFocus
{ msgWGKFWhen :: Word32
, msgWGKFWindow :: SDL.Window
}
| MsgWindowLoseKeyboardFocus
{ msgWLKFWhen :: Word32
, msgWLKFWindow :: SDL.Window
}
| MsgWindowClose
{ msgWCWhen :: Word32
, msgWCWindow :: SDL.Window
}
instance Message WindowMessage where
-- msgTime (MsgEngineReady t) = t
msgTime (MsgWindowShow t _) = t
msgTime (MsgWindowHide t _) = t
msgTime (MsgWindowExpose t _) = t
msgTime (MsgWindowMove t _ _) = t
msgTime (MsgWindowResize t _ _) = t
msgTime (MsgWindowSizeChange t _) = t
msgTime (MsgWindowMinimize t _) = t
msgTime (MsgWindowMaximize t _) = t
msgTime (MsgWindowRestore t _) = t
msgTime (MsgWindowGainMouseFocus t _) = t
msgTime (MsgWindowLoseMouseFocus t _) = t
msgTime (MsgWindowGainKeyboardFocus t _) = t
msgTime (MsgWindowLoseKeyboardFocus t _) = t
msgTime (MsgWindowClose t _) = t