make haddockable
This commit is contained in:
parent
670a213a30
commit
3935b7ddb9
4 changed files with 68 additions and 46 deletions
|
@ -23,34 +23,39 @@ import Linear (V2(..))
|
||||||
|
|
||||||
-- | Datatype for handling all possible joystick events handed over from sdl2
|
-- | Datatype for handling all possible joystick events handed over from sdl2
|
||||||
data JoystickMessage
|
data JoystickMessage
|
||||||
= MsgJoystickAxis -- ^ Movement of a Joystick axis
|
-- | Movement of a Joystick axis
|
||||||
|
= MsgJoystickAxis
|
||||||
{ msgJAWhen :: Double -- ^ Time of event
|
{ msgJAWhen :: Double -- ^ Time of event
|
||||||
, msgJAWhich :: Int32 -- ^ Joystick identifier
|
, msgJAWhich :: Int32 -- ^ Joystick identifier
|
||||||
, msgJAAxis :: Word8 -- ^ Axis identifier
|
, msgJAAxis :: Word8 -- ^ Axis identifier
|
||||||
, msgJAValue :: Int16 -- ^ Axis value
|
, msgJAValue :: Int16 -- ^ Axis value
|
||||||
}
|
}
|
||||||
| MsgJoystickBall -- ^ Movement of a joystick ball controller
|
-- | Movement of a joystick ball controller
|
||||||
|
| MsgJoystickBall
|
||||||
{ msgJBWhen :: Double -- ^ Time of event
|
{ msgJBWhen :: Double -- ^ Time of event
|
||||||
, msgJBWhich :: Int32 -- ^ Joystick identifier
|
, msgJBWhich :: Int32 -- ^ Joystick identifier
|
||||||
, msgJBBall :: Word8 -- ^ Ball identifier
|
, msgJBBall :: Word8 -- ^ Ball identifier
|
||||||
, msgJBRelMotion :: V2 Int16 -- ^ Motion relative to previous position
|
, msgJBRelMotion :: V2 Int16 -- ^ Motion relative to previous position
|
||||||
}
|
}
|
||||||
| MsgJoystickHat -- ^ Movement of joystick hat controller
|
-- | Movement of joystick hat controller
|
||||||
{ msgJHWhen :: Double -- Time of event
|
| MsgJoystickHat
|
||||||
, msgJHWhich :: Int32 -- Joystick identifier
|
{ msgJHWhen :: Double -- ^ Time of event
|
||||||
, msgJHHat :: Word8 -- Hat identifier
|
, msgJHWhich :: Int32 -- ^ Joystick identifier
|
||||||
, msgJHPosition :: SDL.JoyHatPosition -- New hat position
|
, msgJHHat :: Word8 -- ^ Hat identifier
|
||||||
|
, msgJHPosition :: SDL.JoyHatPosition -- ^ New hat position
|
||||||
}
|
}
|
||||||
| MsgJoystickButton -- ^ Joystick button event
|
-- | Joystick button event
|
||||||
{ msgJBWhen :: Double -- Time of event
|
| MsgJoystickButton
|
||||||
, msgJBWhich :: Int32 -- Joystick identifier
|
{ msgJBWhen :: Double -- ^ Time of event
|
||||||
, msgJBButton :: Word8 -- Button identifier
|
, msgJBWhich :: Int32 -- ^ Joystick identifier
|
||||||
, msgJBState :: SDL.JoyButtonState -- New Button state
|
, msgJBButton :: Word8 -- ^ Button identifier
|
||||||
|
, msgJBState :: SDL.JoyButtonState -- ^ New Button state
|
||||||
}
|
}
|
||||||
| MsgJoystickDevice -- ^ Joystick device event
|
-- | Joystick device event
|
||||||
{ msgJDWhen :: Double -- Time of event
|
| MsgJoystickDevice
|
||||||
, msgJDWhich :: Int32 -- Joystick identifier
|
{ msgJDWhen :: Double -- ^ Time of event
|
||||||
, msgJDConnection :: SDL.JoyDeviceConnection -- Connection status
|
, msgJDWhich :: Int32 -- ^ Joystick identifier
|
||||||
|
, msgJDConnection :: SDL.JoyDeviceConnection -- ^ Connection status
|
||||||
}
|
}
|
||||||
deriving (Show)
|
deriving (Show)
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,8 @@ import qualified SDL
|
||||||
|
|
||||||
-- | Dataatype for handling all keyboard events haded down from SDL2
|
-- | Dataatype for handling all keyboard events haded down from SDL2
|
||||||
data KeyboardMessage
|
data KeyboardMessage
|
||||||
= MsgKeyboardEvent -- ^ Arbitrary Keyboard event
|
-- | Arbitrary Keyboard event
|
||||||
|
= MsgKeyboardEvent
|
||||||
{ msgKbdWhen :: Double -- ^ Message time
|
{ msgKbdWhen :: Double -- ^ Message time
|
||||||
, msgKbdWindow :: Maybe SDL.Window -- ^ Affected Window
|
, msgKbdWindow :: Maybe SDL.Window -- ^ Affected Window
|
||||||
, msgKbdKeyMotion :: SDL.InputMotion -- ^ Input motion of button (pressed/released)
|
, msgKbdKeyMotion :: SDL.InputMotion -- ^ Input motion of button (pressed/released)
|
||||||
|
|
|
@ -19,7 +19,8 @@ import Linear (V2(..))
|
||||||
|
|
||||||
-- Datatype for handling mouse events handed down from SDL2
|
-- Datatype for handling mouse events handed down from SDL2
|
||||||
data MouseMessage
|
data MouseMessage
|
||||||
= MsgMouseMotion -- ^ Mouse motion event
|
-- | Mouse motion event
|
||||||
|
= MsgMouseMotion
|
||||||
{ msgMMWhen :: Double -- ^ Message time
|
{ msgMMWhen :: Double -- ^ Message time
|
||||||
, msgMMWindow :: Maybe SDL.Window -- ^ Focused window (if any)
|
, msgMMWindow :: Maybe SDL.Window -- ^ Focused window (if any)
|
||||||
, msgMMWhich :: SDL.MouseDevice -- ^ Mouse device identifier
|
, msgMMWhich :: SDL.MouseDevice -- ^ Mouse device identifier
|
||||||
|
@ -27,7 +28,8 @@ data MouseMessage
|
||||||
, msgMMPos :: V2 Int32 -- ^ Absolute mouse positiom
|
, msgMMPos :: V2 Int32 -- ^ Absolute mouse positiom
|
||||||
, msgMMRelMotion :: V2 Int32 -- ^ Mouse movement relative to previous position
|
, msgMMRelMotion :: V2 Int32 -- ^ Mouse movement relative to previous position
|
||||||
}
|
}
|
||||||
| MsgMouseButton -- ^ Mouse button event
|
-- | Mouse button event
|
||||||
|
| MsgMouseButton
|
||||||
{ msgMBWhen :: Double -- ^ Message time
|
{ msgMBWhen :: Double -- ^ Message time
|
||||||
, msgMBWindow :: Maybe SDL.Window -- ^ Focused window (if any)
|
, msgMBWindow :: Maybe SDL.Window -- ^ Focused window (if any)
|
||||||
, msgMBMotion :: SDL.InputMotion -- ^ Button's input motion
|
, msgMBMotion :: SDL.InputMotion -- ^ Button's input motion
|
||||||
|
@ -36,7 +38,8 @@ data MouseMessage
|
||||||
, msgMBClicks :: Word8 -- ^ Number of clicks
|
, msgMBClicks :: Word8 -- ^ Number of clicks
|
||||||
, msgMBPos :: V2 Int32 -- ^ Absolute mouse position
|
, msgMBPos :: V2 Int32 -- ^ Absolute mouse position
|
||||||
}
|
}
|
||||||
| MsgMouseWheel -- ^ Mouse wheel event
|
-- | Mouse wheel event
|
||||||
|
| MsgMouseWheel
|
||||||
{ msgMWWhen :: Double -- ^ Message time
|
{ msgMWWhen :: Double -- ^ Message time
|
||||||
, msgMWWhindow :: Maybe SDL.Window -- ^ Focused window (if any)
|
, msgMWWhindow :: Maybe SDL.Window -- ^ Focused window (if any)
|
||||||
, msgMWWhich :: SDL.MouseDevice -- ^ Mouse device identifier
|
, msgMWWhich :: SDL.MouseDevice -- ^ Mouse device identifier
|
||||||
|
|
|
@ -14,69 +14,82 @@ import Linear (V2(..))
|
||||||
|
|
||||||
-- | Datatype for handling Window events handed down rom SDL2
|
-- | Datatype for handling Window events handed down rom SDL2
|
||||||
data WindowMessage
|
data WindowMessage
|
||||||
= MsgWindowShow -- ^ Window show event
|
-- | Window show event
|
||||||
|
= MsgWindowShow
|
||||||
{ msgWSWhen :: Double -- ^ Message time
|
{ msgWSWhen :: Double -- ^ Message time
|
||||||
, msgWSWindow :: SDL.Window -- ^ Window identifier
|
, msgWSWindow :: SDL.Window -- ^ Window identifier
|
||||||
}
|
}
|
||||||
| MsgWindowHide -- ^ Window hide event
|
-- | Window hide event
|
||||||
|
| MsgWindowHide
|
||||||
{ msgWHWhen :: Double -- ^ Message time
|
{ msgWHWhen :: Double -- ^ Message time
|
||||||
, msgWHWindow :: SDL.Window -- ^ Window identifier
|
, msgWHWindow :: SDL.Window -- ^ Window identifier
|
||||||
}
|
}
|
||||||
| MsgWindowExpose -- ^ Window expose event
|
-- | Window expose event
|
||||||
|
| MsgWindowExpose
|
||||||
{ msgWEWhen :: Double -- ^ Message time
|
{ msgWEWhen :: Double -- ^ Message time
|
||||||
, msgWEWindow :: SDL.Window -- ^ Window identifier
|
, msgWEWindow :: SDL.Window -- ^ Window identifier
|
||||||
}
|
}
|
||||||
| MsgWindowMove -- ^ Window move event
|
-- | Window move event
|
||||||
|
| MsgWindowMove
|
||||||
{ msgWMWhen :: Double -- ^ Message time
|
{ msgWMWhen :: Double -- ^ Message time
|
||||||
, msgWMWindow :: SDL.Window -- ^ Window identifier
|
, msgWMWindow :: SDL.Window -- ^ Window identifier
|
||||||
, msgWMNewPos :: V2 Int32 -- ^ New absolute window position
|
, msgWMNewPos :: V2 Int32 -- ^ New absolute window position
|
||||||
}
|
}
|
||||||
| MsgWindowResize -- ^ Window resize event
|
-- | Window resize event
|
||||||
|
| MsgWindowResize
|
||||||
{ msgWRWhen :: Double -- ^ Message time
|
{ msgWRWhen :: Double -- ^ Message time
|
||||||
, msgWRWindow :: SDL.Window -- ^ Window identifier
|
, msgWRWindow :: SDL.Window -- ^ Window identifier
|
||||||
, msgWRNewSize :: V2 Int32 -- ^ New absolute window size
|
, msgWRNewSize :: V2 Int32 -- ^ New absolute window size
|
||||||
}
|
}
|
||||||
| MsgWindowSizeChange -- ^ Window size change event
|
-- | Window size change event
|
||||||
{ msgWSCWhen :: Double -- ^ Message time
|
| MsgWindowSizeChange
|
||||||
, msgWSCWindow :: SDL.Window -- ^ Window identifier
|
{ msgWSCWhen :: Double -- ^ Message time
|
||||||
, msgWSCNewSize :: V2 Int32 -- ^ New absolute window size
|
, msgWSCWindow :: SDL.Window -- ^ Window identifier
|
||||||
|
, msgWSCNewSize :: V2 Int32 -- ^ New absolute window size
|
||||||
}
|
}
|
||||||
| MsgWindowMinimize -- ^ Window minimize event
|
-- | Window minimize event
|
||||||
{ msgWMinWhen :: Double -- ^ Message time
|
| MsgWindowMinimize
|
||||||
|
{ msgWMinWhen :: Double -- ^ Message time
|
||||||
, msgWMinWindow :: SDL.Window -- ^ Window identifier
|
, msgWMinWindow :: SDL.Window -- ^ Window identifier
|
||||||
}
|
}
|
||||||
| MsgWindowMaximize -- ^ Window maximize event
|
-- | Window maximize event
|
||||||
{ msgWMaxWhen :: Double -- ^ Message time
|
| MsgWindowMaximize
|
||||||
|
{ msgWMaxWhen :: Double -- ^ Message time
|
||||||
, msgWMaxWindow :: SDL.Window -- ^ Window identifier
|
, msgWMaxWindow :: SDL.Window -- ^ Window identifier
|
||||||
}
|
}
|
||||||
| MsgWindowRestore -- ^ Window restore event
|
-- | Window restore event
|
||||||
{ msgWRestWhen :: Double -- ^ Message time
|
| MsgWindowRestore
|
||||||
|
{ msgWRestWhen :: Double -- ^ Message time
|
||||||
, msgWRestWindow :: SDL.Window -- ^ Window identifier
|
, msgWRestWindow :: SDL.Window -- ^ Window identifier
|
||||||
}
|
}
|
||||||
| MsgWindowGainMouseFocus -- ^ Window gain mouse focus event
|
-- | Window gain mouse focus event
|
||||||
{ msgWGMFWhen :: Double -- ^ Message Time
|
| MsgWindowGainMouseFocus
|
||||||
|
{ msgWGMFWhen :: Double -- ^ Message Time
|
||||||
, msgWGMFWindow :: SDL.Window -- ^ Window identifier
|
, msgWGMFWindow :: SDL.Window -- ^ Window identifier
|
||||||
}
|
}
|
||||||
| MsgWindowLoseMouseFocus -- ^ Window lose mouse focus event
|
-- | Window lose mouse focus event
|
||||||
{ msgWLMFWhen :: Double -- ^ Message Time
|
| MsgWindowLoseMouseFocus
|
||||||
|
{ msgWLMFWhen :: Double -- ^ Message Time
|
||||||
, msgWLMFWindow :: SDL.Window -- ^ Window identifier
|
, msgWLMFWindow :: SDL.Window -- ^ Window identifier
|
||||||
}
|
}
|
||||||
| MsgWindowGainKeyboardFocus -- ^ Window gain keyboard focus event
|
-- | Window gain keyboard focus event
|
||||||
{ msgWGKFWhen :: Double -- ^ Message time
|
| MsgWindowGainKeyboardFocus
|
||||||
|
{ msgWGKFWhen :: Double -- ^ Message time
|
||||||
, msgWGKFWindow :: SDL.Window -- ^ Window identifier
|
, msgWGKFWindow :: SDL.Window -- ^ Window identifier
|
||||||
}
|
}
|
||||||
| MsgWindowLoseKeyboardFocus -- ^ Window lose keyboard focus event
|
-- | Window lose keyboard focus event
|
||||||
{ msgWLKFWhen :: Double -- ^ Message time
|
| MsgWindowLoseKeyboardFocus
|
||||||
|
{ msgWLKFWhen :: Double -- ^ Message time
|
||||||
, msgWLKFWindow :: SDL.Window -- ^ Window identifier
|
, msgWLKFWindow :: SDL.Window -- ^ Window identifier
|
||||||
}
|
}
|
||||||
| MsgWindowClose -- ^ Window close event
|
-- | Window close event
|
||||||
{ msgWCWhen :: Double -- ^ Message time
|
| MsgWindowClose
|
||||||
|
{ msgWCWhen :: Double -- ^ Message time
|
||||||
, msgWCWindow :: SDL.Window -- ^ Window identifier
|
, msgWCWindow :: SDL.Window -- ^ Window identifier
|
||||||
}
|
}
|
||||||
deriving (Show)
|
deriving (Show)
|
||||||
|
|
||||||
instance Message WindowMessage where
|
instance Message WindowMessage where
|
||||||
-- msgTime (MsgEngineReady t) = t
|
|
||||||
msgTime (MsgWindowShow t _) = t
|
msgTime (MsgWindowShow t _) = t
|
||||||
msgTime (MsgWindowHide t _) = t
|
msgTime (MsgWindowHide t _) = t
|
||||||
msgTime (MsgWindowExpose t _) = t
|
msgTime (MsgWindowExpose t _) = t
|
||||||
|
|
Loading…
Reference in a new issue