make haddockable

This commit is contained in:
nek0 2018-09-25 17:12:18 +02:00
parent 670a213a30
commit 3935b7ddb9
4 changed files with 68 additions and 46 deletions

View file

@ -23,34 +23,39 @@ import Linear (V2(..))
-- | Datatype for handling all possible joystick events handed over from sdl2
data JoystickMessage
= MsgJoystickAxis -- ^ Movement of a Joystick axis
-- | Movement of a Joystick axis
= MsgJoystickAxis
{ msgJAWhen :: Double -- ^ Time of event
, msgJAWhich :: Int32 -- ^ Joystick identifier
, msgJAAxis :: Word8 -- ^ Axis identifier
, msgJAValue :: Int16 -- ^ Axis value
}
| MsgJoystickBall -- ^ Movement of a joystick ball controller
-- | Movement of a joystick ball controller
| MsgJoystickBall
{ msgJBWhen :: Double -- ^ Time of event
, msgJBWhich :: Int32 -- ^ Joystick identifier
, msgJBBall :: Word8 -- ^ Ball identifier
, msgJBRelMotion :: V2 Int16 -- ^ Motion relative to previous position
}
| MsgJoystickHat -- ^ Movement of joystick hat controller
{ msgJHWhen :: Double -- Time of event
, msgJHWhich :: Int32 -- Joystick identifier
, msgJHHat :: Word8 -- Hat identifier
, msgJHPosition :: SDL.JoyHatPosition -- New hat position
-- | Movement of joystick hat controller
| MsgJoystickHat
{ msgJHWhen :: Double -- ^ Time of event
, msgJHWhich :: Int32 -- ^ Joystick identifier
, msgJHHat :: Word8 -- ^ Hat identifier
, msgJHPosition :: SDL.JoyHatPosition -- ^ New hat position
}
| MsgJoystickButton -- ^ Joystick button event
{ msgJBWhen :: Double -- Time of event
, msgJBWhich :: Int32 -- Joystick identifier
, msgJBButton :: Word8 -- Button identifier
, msgJBState :: SDL.JoyButtonState -- New Button state
-- | Joystick button event
| MsgJoystickButton
{ msgJBWhen :: Double -- ^ Time of event
, msgJBWhich :: Int32 -- ^ Joystick identifier
, msgJBButton :: Word8 -- ^ Button identifier
, msgJBState :: SDL.JoyButtonState -- ^ New Button state
}
| MsgJoystickDevice -- ^ Joystick device event
{ msgJDWhen :: Double -- Time of event
, msgJDWhich :: Int32 -- Joystick identifier
, msgJDConnection :: SDL.JoyDeviceConnection -- Connection status
-- | Joystick device event
| MsgJoystickDevice
{ msgJDWhen :: Double -- ^ Time of event
, msgJDWhich :: Int32 -- ^ Joystick identifier
, msgJDConnection :: SDL.JoyDeviceConnection -- ^ Connection status
}
deriving (Show)

View file

@ -12,7 +12,8 @@ import qualified SDL
-- | Dataatype for handling all keyboard events haded down from SDL2
data KeyboardMessage
= MsgKeyboardEvent -- ^ Arbitrary Keyboard event
-- | Arbitrary Keyboard event
= MsgKeyboardEvent
{ msgKbdWhen :: Double -- ^ Message time
, msgKbdWindow :: Maybe SDL.Window -- ^ Affected Window
, msgKbdKeyMotion :: SDL.InputMotion -- ^ Input motion of button (pressed/released)

View file

@ -19,7 +19,8 @@ import Linear (V2(..))
-- Datatype for handling mouse events handed down from SDL2
data MouseMessage
= MsgMouseMotion -- ^ Mouse motion event
-- | Mouse motion event
= MsgMouseMotion
{ msgMMWhen :: Double -- ^ Message time
, msgMMWindow :: Maybe SDL.Window -- ^ Focused window (if any)
, msgMMWhich :: SDL.MouseDevice -- ^ Mouse device identifier
@ -27,7 +28,8 @@ data MouseMessage
, msgMMPos :: V2 Int32 -- ^ Absolute mouse positiom
, msgMMRelMotion :: V2 Int32 -- ^ Mouse movement relative to previous position
}
| MsgMouseButton -- ^ Mouse button event
-- | Mouse button event
| MsgMouseButton
{ msgMBWhen :: Double -- ^ Message time
, msgMBWindow :: Maybe SDL.Window -- ^ Focused window (if any)
, msgMBMotion :: SDL.InputMotion -- ^ Button's input motion
@ -36,7 +38,8 @@ data MouseMessage
, msgMBClicks :: Word8 -- ^ Number of clicks
, msgMBPos :: V2 Int32 -- ^ Absolute mouse position
}
| MsgMouseWheel -- ^ Mouse wheel event
-- | Mouse wheel event
| MsgMouseWheel
{ msgMWWhen :: Double -- ^ Message time
, msgMWWhindow :: Maybe SDL.Window -- ^ Focused window (if any)
, msgMWWhich :: SDL.MouseDevice -- ^ Mouse device identifier

View file

@ -14,69 +14,82 @@ import Linear (V2(..))
-- | Datatype for handling Window events handed down rom SDL2
data WindowMessage
= MsgWindowShow -- ^ Window show event
-- | Window show event
= MsgWindowShow
{ msgWSWhen :: Double -- ^ Message time
, msgWSWindow :: SDL.Window -- ^ Window identifier
}
| MsgWindowHide -- ^ Window hide event
-- | Window hide event
| MsgWindowHide
{ msgWHWhen :: Double -- ^ Message time
, msgWHWindow :: SDL.Window -- ^ Window identifier
}
| MsgWindowExpose -- ^ Window expose event
-- | Window expose event
| MsgWindowExpose
{ msgWEWhen :: Double -- ^ Message time
, msgWEWindow :: SDL.Window -- ^ Window identifier
}
| MsgWindowMove -- ^ Window move event
-- | Window move event
| MsgWindowMove
{ msgWMWhen :: Double -- ^ Message time
, msgWMWindow :: SDL.Window -- ^ Window identifier
, msgWMNewPos :: V2 Int32 -- ^ New absolute window position
}
| MsgWindowResize -- ^ Window resize event
-- | Window resize event
| MsgWindowResize
{ msgWRWhen :: Double -- ^ Message time
, msgWRWindow :: SDL.Window -- ^ Window identifier
, msgWRNewSize :: V2 Int32 -- ^ New absolute window size
}
| MsgWindowSizeChange -- ^ Window size change event
{ msgWSCWhen :: Double -- ^ Message time
, msgWSCWindow :: SDL.Window -- ^ Window identifier
, msgWSCNewSize :: V2 Int32 -- ^ New absolute window size
-- | Window size change event
| MsgWindowSizeChange
{ msgWSCWhen :: Double -- ^ Message time
, msgWSCWindow :: SDL.Window -- ^ Window identifier
, msgWSCNewSize :: V2 Int32 -- ^ New absolute window size
}
| MsgWindowMinimize -- ^ Window minimize event
{ msgWMinWhen :: Double -- ^ Message time
-- | Window minimize event
| MsgWindowMinimize
{ msgWMinWhen :: Double -- ^ Message time
, msgWMinWindow :: SDL.Window -- ^ Window identifier
}
| MsgWindowMaximize -- ^ Window maximize event
{ msgWMaxWhen :: Double -- ^ Message time
-- | Window maximize event
| MsgWindowMaximize
{ msgWMaxWhen :: Double -- ^ Message time
, msgWMaxWindow :: SDL.Window -- ^ Window identifier
}
| MsgWindowRestore -- ^ Window restore event
{ msgWRestWhen :: Double -- ^ Message time
-- | Window restore event
| MsgWindowRestore
{ msgWRestWhen :: Double -- ^ Message time
, msgWRestWindow :: SDL.Window -- ^ Window identifier
}
| MsgWindowGainMouseFocus -- ^ Window gain mouse focus event
{ msgWGMFWhen :: Double -- ^ Message Time
-- | Window gain mouse focus event
| MsgWindowGainMouseFocus
{ msgWGMFWhen :: Double -- ^ Message Time
, msgWGMFWindow :: SDL.Window -- ^ Window identifier
}
| MsgWindowLoseMouseFocus -- ^ Window lose mouse focus event
{ msgWLMFWhen :: Double -- ^ Message Time
-- | Window lose mouse focus event
| MsgWindowLoseMouseFocus
{ msgWLMFWhen :: Double -- ^ Message Time
, msgWLMFWindow :: SDL.Window -- ^ Window identifier
}
| MsgWindowGainKeyboardFocus -- ^ Window gain keyboard focus event
{ msgWGKFWhen :: Double -- ^ Message time
-- | Window gain keyboard focus event
| MsgWindowGainKeyboardFocus
{ msgWGKFWhen :: Double -- ^ Message time
, msgWGKFWindow :: SDL.Window -- ^ Window identifier
}
| MsgWindowLoseKeyboardFocus -- ^ Window lose keyboard focus event
{ msgWLKFWhen :: Double -- ^ Message time
-- | Window lose keyboard focus event
| MsgWindowLoseKeyboardFocus
{ msgWLKFWhen :: Double -- ^ Message time
, msgWLKFWindow :: SDL.Window -- ^ Window identifier
}
| MsgWindowClose -- ^ Window close event
{ msgWCWhen :: Double -- ^ Message time
-- | Window close event
| MsgWindowClose
{ msgWCWhen :: Double -- ^ Message time
, msgWCWindow :: SDL.Window -- ^ Window identifier
}
deriving (Show)
instance Message WindowMessage where
-- msgTime (MsgEngineReady t) = t
msgTime (MsgWindowShow t _) = t
msgTime (MsgWindowHide t _) = t
msgTime (MsgWindowExpose t _) = t