gore-and-ash-sdl-1.1.0.1: Gore&Ash core module for integration with SDL library

Copyright(c) Anton Gushcha, 2015-2016
LicenseBSD3
Maintainerncrashed@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Game.GoreAndAsh.SDL.API

Description

The module contains monadic and arrow API of the core module.

Synopsis

Documentation

class (MonadIO m, MonadThrow m) => MonadSDL m where Source

Low level API for module

Methods

sdlCreateWindowM Source

Arguments

:: 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

sdlGetWindowM Source

Arguments

:: Text

Window name that was used at sdlCreateWindowM call

-> m (Maybe (Window, Renderer)) 

Getting window and renderer by name

sdlDestroyWindowM Source

Arguments

:: Text

Window name that was used at sdlCreateWindowM call

-> m () 

Destroying window and renderer by name

sdlSetBackColor Source

Arguments

:: Text

Window name that was used at sdlCreateWindowM call

-> V4 Word8

Color to set

-> m () 

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

Instances

(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 :: *

Constructors

WindowConfig 

Fields

windowBorder :: Bool

Defaults to True.

windowHighDPI :: Bool

Defaults to False. Can not be changed after window creation.

windowInputGrabbed :: Bool

Defaults to False. Whether the mouse shall be confined to the window.

windowMode :: WindowMode

Defaults to Windowed.

windowOpenGL :: Maybe OpenGLConfig

Defaults to Nothing. Can not be changed after window creation.

windowPosition :: WindowPosition

Defaults to Wherever.

windowResizable :: Bool

Defaults to False. Whether the window can be resized by the user. It is still possible to programatically change the size with setWindowSize.

windowInitialSize :: V2 CInt

Defaults to (800, 600).

Instances

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.

Constructors

RendererConfig 

Fields

rendererType :: RendererType

The renderer's acceleration mode

rendererTargetTexture :: Bool

The renderer supports rendering to texture

Instances

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

Constructors

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

Instances

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

windowClosed :: MonadSDL m => Text -> GameWire m a (Event ()) Source

Fires when window with specific name is closed