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
- sdlCreateWindowM :: Text -> Text -> WindowConfig -> RendererConfig -> m (Window, Renderer)
- sdlGetWindowM :: Text -> m (Maybe (Window, Renderer))
- sdlDestroyWindowM :: Text -> m ()
- sdlSetBackColor :: Text -> V4 Word8 -> m ()
- sdlWindowShownEventsM :: m (Seq WindowShownEventData)
- sdlWindowHiddenEventsM :: m (Seq WindowHiddenEventData)
- sdlWindowExposedEventsM :: m (Seq WindowExposedEventData)
- sdlWindowMovedEventsM :: m (Seq WindowMovedEventData)
- sdlWindowResizedEventsM :: m (Seq WindowResizedEventData)
- sdlWindowSizeChangedEventsM :: m (Seq WindowSizeChangedEventData)
- sdlWindowMinimizedEventsM :: m (Seq WindowMinimizedEventData)
- sdlWindowMaximizedEventsM :: m (Seq WindowMaximizedEventData)
- sdlWindowRestoredEventsM :: m (Seq WindowRestoredEventData)
- sdlWindowGainedMouseFocusEventsM :: m (Seq WindowGainedMouseFocusEventData)
- sdlWindowLostMouseFocusEventsM :: m (Seq WindowLostMouseFocusEventData)
- sdlWindowGainedKeyboardFocusEventsM :: m (Seq WindowGainedKeyboardFocusEventData)
- sdlWindowLostKeyboardFocusEventsM :: m (Seq WindowLostKeyboardFocusEventData)
- sdlWindowClosedEventsM :: m (Seq WindowClosedEventData)
- sdlKeyboardEventsM :: m (Seq KeyboardEventData)
- sdlTextEditingEventsM :: m (Seq TextEditingEventData)
- sdlTextInputEventsM :: m (Seq TextInputEventData)
- sdlMouseMotionEventsM :: m (Seq MouseMotionEventData)
- sdlMouseButtonEventsM :: m (Seq MouseButtonEventData)
- sdlMouseWheelEventsM :: m (Seq MouseWheelEventData)
- sdlJoyAxisEventsM :: m (Seq JoyAxisEventData)
- sdlJoyBallEventsM :: m (Seq JoyBallEventData)
- sdlJoyHatEventsM :: m (Seq JoyHatEventData)
- sdlJoyButtonEventsM :: m (Seq JoyButtonEventData)
- sdlJoyDeviceEventsM :: m (Seq JoyDeviceEventData)
- sdlControllerAxisEventsM :: m (Seq ControllerAxisEventData)
- sdlControllerButtonEventsM :: m (Seq ControllerButtonEventData)
- sdlControllerDeviceEventsM :: m (Seq ControllerDeviceEventData)
- sdlQuitEventM :: m Bool
- sdlUserEventsM :: m (Seq UserEventData)
- sdlSysWMEventsM :: m (Seq SysWMEventData)
- sdlTouchFingerEventsM :: m (Seq TouchFingerEventData)
- sdlMultiGestureEventsM :: m (Seq MultiGestureEventData)
- sdlDollarGestureEventsM :: m (Seq DollarGestureEventData)
- sdlDropEventsM :: m (Seq DropEventData)
- sdlClipboardUpdateEventsM :: m (Seq ClipboardUpdateEventData)
- data WindowConfig :: * = WindowConfig {}
- 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
:: Text | Window name that is used to get the window (and renderer) from the module later |
-> Text | Title of the window |
-> WindowConfig | Window configuration |
-> RendererConfig | Renderer configuration |
-> m (Window, Renderer) |
Creates window and stores in module context
Throws SDL'ConflictingWindows
on name conflict
Getting window and renderer by name
:: Text | Window name that was used at |
-> m () |
Destroying window and renderer by name
Setup background color for window
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
(MonadIO (mt m), MonadThrow (mt m), MonadSDL m, MonadTrans mt) => MonadSDL (mt m) Source | |
(MonadIO m, MonadThrow m) => MonadSDL (SDLT s m) Source |
data WindowConfig :: *
WindowConfig | |
|
Eq WindowConfig | |
Ord WindowConfig | |
Read WindowConfig | |
Show WindowConfig | |
Generic WindowConfig | |
type Rep WindowConfig = D1 D1WindowConfig (C1 C1_0WindowConfig ((:*:) ((:*:) ((:*:) (S1 S1_0_0WindowConfig (Rec0 Bool)) (S1 S1_0_1WindowConfig (Rec0 Bool))) ((:*:) (S1 S1_0_2WindowConfig (Rec0 Bool)) (S1 S1_0_3WindowConfig (Rec0 WindowMode)))) ((:*:) ((:*:) (S1 S1_0_4WindowConfig (Rec0 (Maybe OpenGLConfig))) (S1 S1_0_5WindowConfig (Rec0 WindowPosition))) ((:*:) (S1 S1_0_6WindowConfig (Rec0 Bool)) (S1 S1_0_7WindowConfig (Rec0 (V2 CInt))))))) |
data RendererConfig :: *
The configuration data used when creating windows.
RendererConfig | |
|
Eq RendererConfig | |
Data RendererConfig | |
Ord RendererConfig | |
Read RendererConfig | |
Show RendererConfig | |
Generic RendererConfig | |
FromNumber RendererConfig Word32 | |
ToNumber RendererConfig Word32 | |
type Rep RendererConfig = D1 D1RendererConfig (C1 C1_0RendererConfig ((:*:) (S1 S1_0_0RendererConfig (Rec0 RendererType)) (S1 S1_0_1RendererConfig (Rec0 Bool)))) |
data RendererType :: *
Renderer acceleration mode
UnacceleratedRenderer | The renderer does not use hardware acceleration |
AcceleratedRenderer | The renderer uses hardware acceleration and refresh rate is ignored |
AcceleratedVSyncRenderer | The renderer uses hardware acceleration and present is synchronized with the refresh rate |
SoftwareRenderer | The renderer is a software fallback |
Bounded RendererType | |
Enum RendererType | |
Eq RendererType | |
Data RendererType | |
Ord RendererType | |
Read RendererType | |
Show RendererType | |
Generic RendererType | |
type Rep RendererType = D1 D1RendererType ((:+:) ((:+:) (C1 C1_0RendererType U1) (C1 C1_1RendererType U1)) ((:+:) (C1 C1_2RendererType U1) (C1 C1_3RendererType U1))) |
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