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

90 lines
2.2 KiB
Haskell
Raw Normal View History

2017-11-29 16:49:56 +00:00
module Affection.MessageBus.Message.WindowMessage where
import Affection.MessageBus.Message.Class
import Data.Int (Int32(..))
import qualified SDL
import Linear (V2(..))
2017-12-06 05:36:25 +00:00
data WindowMessage
2017-12-13 14:19:53 +00:00
-- = MsgEngineReady Double
2017-12-12 12:12:47 +00:00
= MsgWindowShow
2017-12-13 14:19:53 +00:00
{ msgWSWhen :: Double
2017-11-29 16:49:56 +00:00
, msgWSWindow :: SDL.Window
}
2017-12-12 12:12:47 +00:00
| MsgWindowHide
2017-12-13 14:19:53 +00:00
{ msgWHWhen :: Double
2017-11-29 16:49:56 +00:00
, msgWHWindow :: SDL.Window
}
2017-12-12 12:12:47 +00:00
| MsgWindowExpose
2017-12-13 14:19:53 +00:00
{ msgWEWhen :: Double
2017-11-29 16:49:56 +00:00
, msgWEWindow :: SDL.Window
}
2017-12-12 12:12:47 +00:00
| MsgWindowMove
2017-12-13 14:19:53 +00:00
{ msgWMWhen :: Double
2017-11-29 16:49:56 +00:00
, msgWMWindow :: SDL.Window
, msgWMNewPos :: V2 Int32
}
2017-12-12 12:12:47 +00:00
| MsgWindowResize
2017-12-13 14:19:53 +00:00
{ msgWRWhen :: Double
2017-11-29 16:49:56 +00:00
, msgWRWindow :: SDL.Window
, msgWRNewSize :: V2 Int32
}
2017-12-12 12:12:47 +00:00
| MsgWindowSizeChange
2017-12-13 14:19:53 +00:00
{ msgWSCWhen :: Double
2017-11-29 16:49:56 +00:00
, msgWSCWindow :: SDL.Window
2018-03-17 01:49:16 +00:00
, msgWRNewSize :: V2 Int32
2017-11-29 16:49:56 +00:00
}
2017-12-12 12:12:47 +00:00
| MsgWindowMinimize
2017-12-13 14:19:53 +00:00
{ msgWMinWhen :: Double
2017-11-29 16:49:56 +00:00
, msgWMinWindow :: SDL.Window
}
2017-12-12 12:12:47 +00:00
| MsgWindowMaximize
2017-12-13 14:19:53 +00:00
{ msgWMaxWhen :: Double
2017-11-29 16:49:56 +00:00
, msgWMaxWindow :: SDL.Window
}
2017-12-12 12:12:47 +00:00
| MsgWindowRestore
2017-12-13 14:19:53 +00:00
{ msgWRestWhen :: Double
2017-11-29 16:49:56 +00:00
, msgWRestWindow :: SDL.Window
}
2017-12-12 12:12:47 +00:00
| MsgWindowGainMouseFocus
2017-12-13 14:19:53 +00:00
{ msgWGMFWhen :: Double
2017-11-29 16:49:56 +00:00
, msgWGMFWindow :: SDL.Window
}
2017-12-12 12:12:47 +00:00
| MsgWindowLoseMouseFocus
2017-12-13 14:19:53 +00:00
{ msgWLMFWhen :: Double
2017-11-29 16:49:56 +00:00
, msgWLMFWindow :: SDL.Window
}
2017-12-12 12:12:47 +00:00
| MsgWindowGainKeyboardFocus
2017-12-13 14:19:53 +00:00
{ msgWGKFWhen :: Double
2017-11-29 16:49:56 +00:00
, msgWGKFWindow :: SDL.Window
}
2017-12-12 12:12:47 +00:00
| MsgWindowLoseKeyboardFocus
2017-12-13 14:19:53 +00:00
{ msgWLKFWhen :: Double
2017-11-29 16:49:56 +00:00
, msgWLKFWindow :: SDL.Window
}
2017-12-12 12:12:47 +00:00
| MsgWindowClose
2017-12-13 14:19:53 +00:00
{ msgWCWhen :: Double
2017-11-29 16:49:56 +00:00
, msgWCWindow :: SDL.Window
}
2017-12-13 03:37:16 +00:00
deriving (Show)
2017-11-29 16:49:56 +00:00
2017-12-06 05:36:25 +00:00
instance Message WindowMessage where
2017-12-12 12:12:47 +00:00
-- msgTime (MsgEngineReady t) = t
msgTime (MsgWindowShow t _) = t
msgTime (MsgWindowHide t _) = t
msgTime (MsgWindowExpose t _) = t
msgTime (MsgWindowMove t _ _) = t
msgTime (MsgWindowResize t _ _) = t
2018-03-17 01:49:16 +00:00
msgTime (MsgWindowSizeChange t _ _) = t
2017-12-12 12:12:47 +00:00
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