Copyright | (c) Anton Gushcha, 2015-2016 |
---|---|
License | BSD3 |
Maintainer | ncrashed@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
The module contains monadic and arrow API of the core module.
- class (MonadIO m, MonadThrow m) => MonadSDL m where
- data WindowConfig :: * = WindowConfig {
- windowBorder :: Bool
- windowHighDPI :: Bool
- windowInputGrabbed :: Bool
- windowMode :: WindowMode
- windowOpenGL :: Maybe OpenGLConfig
- windowPosition :: WindowPosition
- windowResizable :: Bool
- windowInitialSize :: V2 CInt
- data RendererConfig :: * = RendererConfig {}
- data RendererType :: *
- keyScancode :: MonadSDL m => Scancode -> InputMotion -> GameWire m a (Event (Seq KeyboardEventData))
- keyPress :: MonadSDL m => Scancode -> GameWire m a (Event (Seq KeyboardEventData))
- keyRelease :: MonadSDL m => Scancode -> GameWire m a (Event (Seq KeyboardEventData))
- keyPressing :: MonadSDL m => Scancode -> GameWire m a (Event KeyboardEventData)
- mouseScroll :: MonadSDL m => GameWire m a (Event (V2 Int32))
- mouseScrollX :: MonadSDL m => GameWire m a (Event Int32)
- mouseScrollY :: MonadSDL m => GameWire m a (Event Int32)
- mouseClick :: MonadSDL m => MouseButton -> GameWire m a (Event (V2 Double))
- windowClosed :: MonadSDL m => Text -> GameWire m a (Event ())
Documentation
class (MonadIO m, MonadThrow m) => MonadSDL m where Source #
Low level API for module
sdlCreateWindowM, sdlGetWindowM, sdlDestroyWindowM, sdlSetBackColor, sdlCreateContext, sdlMakeCurrent, sdlWindowShownEventsM, sdlWindowHiddenEventsM, sdlWindowExposedEventsM, sdlWindowMovedEventsM, sdlWindowResizedEventsM, sdlWindowSizeChangedEventsM, sdlWindowMinimizedEventsM, sdlWindowMaximizedEventsM, sdlWindowRestoredEventsM, sdlWindowGainedMouseFocusEventsM, sdlWindowLostMouseFocusEventsM, sdlWindowGainedKeyboardFocusEventsM, sdlWindowLostKeyboardFocusEventsM, sdlWindowClosedEventsM, sdlKeyboardEventsM, sdlTextEditingEventsM, sdlTextInputEventsM, sdlMouseMotionEventsM, sdlMouseButtonEventsM, sdlMouseWheelEventsM, sdlJoyAxisEventsM, sdlJoyBallEventsM, sdlJoyHatEventsM, sdlJoyButtonEventsM, sdlJoyDeviceEventsM, sdlControllerAxisEventsM, sdlControllerButtonEventsM, sdlControllerDeviceEventsM, sdlQuitEventM, sdlUserEventsM, sdlSysWMEventsM, sdlTouchFingerEventsM, sdlMultiGestureEventsM, sdlDollarGestureEventsM, sdlDropEventsM, sdlClipboardUpdateEventsM
sdlCreateWindowM :: WindowName -> Text -> WindowConfig -> RendererConfig -> m (Window, Renderer) Source #
Creates window and stores in module context
Throws SDL'ConflictingWindows
on name conflict
sdlGetWindowM :: WindowName -> m (Maybe (Window, Renderer)) Source #
Getting window and renderer by name
sdlDestroyWindowM :: WindowName -> m () Source #
Destroying window and renderer by name
sdlSetBackColor :: WindowName -> Maybe (V4 Word8) -> m () Source #
Setup background color for window
sdlCreateContext :: WindowName -> m () Source #
Creates context for given window
Note: destroys previous context if existed
sdlMakeCurrent :: WindowName -> m () Source #
Makes GL context of given window current
Does nothing if sdlCreateContext
wasn't called.
sdlWindowShownEventsM :: m (Seq WindowShownEventData) Source #
Getting window shown events that occurs scince last frame
sdlWindowHiddenEventsM :: m (Seq WindowHiddenEventData) Source #
Getting window hidden events that occurs scince last frame
sdlWindowExposedEventsM :: m (Seq WindowExposedEventData) Source #
Getting window exposed events that occurs scince last frame
sdlWindowMovedEventsM :: m (Seq WindowMovedEventData) Source #
Getting window move events that occurs scince last frame
sdlWindowResizedEventsM :: m (Seq WindowResizedEventData) Source #
Getting window resize events that occurs scince last frame
This is event is always preceded by WindowSizeChangedEvent.
sdlWindowSizeChangedEventsM :: m (Seq WindowSizeChangedEventData) Source #
Getting window resize events that occurs scince last frame
The window size has changed, either as a result of an API call or through the system or user changing the window size; this event is followed by WindowResizedEvent if the size was changed by an external event, i.e. the user or the window manager.
sdlWindowMinimizedEventsM :: m (Seq WindowMinimizedEventData) Source #
Getting window minimization events that occurs scince last frame
sdlWindowMaximizedEventsM :: m (Seq WindowMaximizedEventData) Source #
Getting window maximization events that occurs scince last frame
sdlWindowRestoredEventsM :: m (Seq WindowRestoredEventData) Source #
Getting window restore events that occurs scince last frame
sdlWindowGainedMouseFocusEventsM :: m (Seq WindowGainedMouseFocusEventData) Source #
Getting window focus events that occurs scince last frame
sdlWindowLostMouseFocusEventsM :: m (Seq WindowLostMouseFocusEventData) Source #
Getting window focus events that occurs scince last frame
sdlWindowGainedKeyboardFocusEventsM :: m (Seq WindowGainedKeyboardFocusEventData) Source #
Getting window focus events that occurs scince last frame
sdlWindowLostKeyboardFocusEventsM :: m (Seq WindowLostKeyboardFocusEventData) Source #
Getting window focus events that occurs scince last frame
sdlWindowClosedEventsM :: m (Seq WindowClosedEventData) Source #
Getting window close events that occurs scince last frame
sdlKeyboardEventsM :: m (Seq KeyboardEventData) Source #
Getting keyboard events that occurs scince last frame
sdlTextEditingEventsM :: m (Seq TextEditingEventData) Source #
Getting input API events that occurs scince last frame
sdlTextInputEventsM :: m (Seq TextInputEventData) Source #
Getting input API events that occurs scince last frame
sdlMouseMotionEventsM :: m (Seq MouseMotionEventData) Source #
Getting mouse events that occurs scince last frame
sdlMouseButtonEventsM :: m (Seq MouseButtonEventData) Source #
Getting mouse events that occurs scince last frame
sdlMouseWheelEventsM :: m (Seq MouseWheelEventData) Source #
Getting mouse events that occurs scince last frame
sdlJoyAxisEventsM :: m (Seq JoyAxisEventData) Source #
Getting joystick events that occurs scince last frame
sdlJoyBallEventsM :: m (Seq JoyBallEventData) Source #
Getting joystick events that occurs scince last frame
sdlJoyHatEventsM :: m (Seq JoyHatEventData) Source #
Getting joystick events that occurs scince last frame
sdlJoyButtonEventsM :: m (Seq JoyButtonEventData) Source #
Getting joystick events that occurs scince last frame
sdlJoyDeviceEventsM :: m (Seq JoyDeviceEventData) Source #
Getting joystick events that occurs scince last frame
sdlControllerAxisEventsM :: m (Seq ControllerAxisEventData) Source #
Getting controller events that occurs scince last frame
sdlControllerButtonEventsM :: m (Seq ControllerButtonEventData) Source #
Getting controller events that occurs scince last frame
sdlControllerDeviceEventsM :: m (Seq ControllerDeviceEventData) Source #
Getting controller events that occurs scince last frame
sdlQuitEventM :: m Bool Source #
Getting quit request event
sdlUserEventsM :: m (Seq UserEventData) Source #
Getting user events that occurs scince last frame
sdlSysWMEventsM :: m (Seq SysWMEventData) Source #
Getting video driver specific events that occurs scince last frame
sdlTouchFingerEventsM :: m (Seq TouchFingerEventData) Source #
Getting touch events that occurs scince last frame
sdlMultiGestureEventsM :: m (Seq MultiGestureEventData) Source #
Getting touch events that occurs scince last frame
sdlDollarGestureEventsM :: m (Seq DollarGestureEventData) Source #
Getting touch events that occurs scince last frame
sdlDropEventsM :: m (Seq DropEventData) Source #
Getting file opened events that occurs scince last frame
sdlClipboardUpdateEventsM :: m (Seq ClipboardUpdateEventData) Source #
Getting clipboard changed events that occurs scince last frame
data WindowConfig :: * #
WindowConfig | |
|
data RendererConfig :: * #
Eq RendererConfig | |
Data RendererConfig | |
Ord RendererConfig | |
Read RendererConfig | |
Show RendererConfig | |
Generic RendererConfig | |
ToNumber RendererConfig Word32 | |
FromNumber RendererConfig Word32 | |
type Rep RendererConfig | |
data RendererType :: * #
Keyboard arrow API
keyScancode :: MonadSDL m => Scancode -> InputMotion -> GameWire m a (Event (Seq KeyboardEventData)) Source #
Fires when specific scancode key is pressed/unpressed
keyPress :: MonadSDL m => Scancode -> GameWire m a (Event (Seq KeyboardEventData)) Source #
Fires when specific scancode key is pressed
keyRelease :: MonadSDL m => Scancode -> GameWire m a (Event (Seq KeyboardEventData)) Source #
Fires when specific scancode key is released
keyPressing :: MonadSDL m => Scancode -> GameWire m a (Event KeyboardEventData) Source #
Fires event from moment of press until release of given key
Mouse arrow API
mouseScroll :: MonadSDL m => GameWire m a (Event (V2 Int32)) Source #
Returns accumulated mouse scroll scince last frame
mouseScrollX :: MonadSDL m => GameWire m a (Event Int32) Source #
Returns accumulated mouse scroll scince last frame
mouseScrollY :: MonadSDL m => GameWire m a (Event Int32) Source #
Returns accumulated mouse scroll scince last frame
mouseClick :: MonadSDL m => MouseButton -> GameWire m a (Event (V2 Double)) Source #
Fires when user clicks within window. Click coordinates are in [-1 .. 1] range
Window arrow API
windowClosed :: MonadSDL m => Text -> GameWire m a (Event ()) Source #
Fires when window with specific name is closed