sdl2-2.2.0: Both high- and low-level bindings to the SDL library (version 2.0.4+).

Safe HaskellNone
LanguageHaskell2010

SDL.Video

Contents

Synopsis

Documentation

Window Management

data Window #

Instances

Eq Window # 

Methods

(==) :: Window -> Window -> Bool #

(/=) :: Window -> Window -> Bool #

Data Window # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Window -> c Window #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Window #

toConstr :: Window -> Constr #

dataTypeOf :: Window -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Window) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Window) #

gmapT :: (forall b. Data b => b -> b) -> Window -> Window #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Window -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Window -> r #

gmapQ :: (forall d. Data d => d -> u) -> Window -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Window -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Window -> m Window #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Window -> m Window #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Window -> m Window #

Ord Window # 
Show Window # 
Generic Window # 

Associated Types

type Rep Window :: * -> * #

Methods

from :: Window -> Rep Window x #

to :: Rep Window x -> Window #

type Rep Window # 
type Rep Window = D1 (MetaData "Window" "SDL.Internal.Types" "sdl2-2.2.0-2P34LP7wP7h1axXaFF2L0F" True) (C1 (MetaCons "Window" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Window)))

createWindow :: MonadIO m => Text -> WindowConfig -> m Window #

Create a window with the given title and configuration.

Throws SDLException on failure.

defaultWindow :: WindowConfig #

Default configuration for windows. Use the record update syntax to override any of the defaults.

defaultWindow = WindowConfig
  { windowBorder       = True
  , windowHighDPI      = False
  , windowInputGrabbed = False
  , windowMode         = Windowed
  , windowOpenGL       = Nothing
  , windowPosition     = Wherever
  , windowResizable    = False
  , windowInitialSize  = V2 800 600
  }

data WindowConfig #

Constructors

WindowConfig 

Fields

Instances

Eq WindowConfig # 
Ord WindowConfig # 
Read WindowConfig # 
Show WindowConfig # 
Generic WindowConfig # 

Associated Types

type Rep WindowConfig :: * -> * #

type Rep WindowConfig # 

data WindowMode #

Constructors

Fullscreen

Real fullscreen with a video mode change

FullscreenDesktop

Fake fullscreen that takes the size of the desktop

Maximized 
Minimized 
Windowed 

Instances

Bounded WindowMode # 
Enum WindowMode # 
Eq WindowMode # 
Data WindowMode # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> WindowMode -> c WindowMode #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c WindowMode #

toConstr :: WindowMode -> Constr #

dataTypeOf :: WindowMode -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c WindowMode) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c WindowMode) #

gmapT :: (forall b. Data b => b -> b) -> WindowMode -> WindowMode #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> WindowMode -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> WindowMode -> r #

gmapQ :: (forall d. Data d => d -> u) -> WindowMode -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> WindowMode -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> WindowMode -> m WindowMode #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> WindowMode -> m WindowMode #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> WindowMode -> m WindowMode #

Ord WindowMode # 
Read WindowMode # 
Show WindowMode # 
Generic WindowMode # 

Associated Types

type Rep WindowMode :: * -> * #

ToNumber WindowMode Word32 # 
FromNumber WindowMode Word32 # 
type Rep WindowMode # 
type Rep WindowMode = D1 (MetaData "WindowMode" "SDL.Video" "sdl2-2.2.0-2P34LP7wP7h1axXaFF2L0F" False) ((:+:) ((:+:) (C1 (MetaCons "Fullscreen" PrefixI False) U1) (C1 (MetaCons "FullscreenDesktop" PrefixI False) U1)) ((:+:) (C1 (MetaCons "Maximized" PrefixI False) U1) ((:+:) (C1 (MetaCons "Minimized" PrefixI False) U1) (C1 (MetaCons "Windowed" PrefixI False) U1))))

data WindowPosition #

Constructors

Centered 
Wherever

Let the window mananger decide where it's best to place the window.

Absolute (Point V2 CInt) 

destroyWindow :: MonadIO m => Window -> m () #

Destroy the given window. The Window handler may not be used afterwards.

Window Actions

hideWindow :: MonadIO m => Window -> m () #

Hide a window.

See SDL_HideWindow for C documentation.

raiseWindow :: MonadIO m => Window -> m () #

Raise the window above other windows and set the input focus.

See SDL_RaiseWindow for C documentation.

showWindow :: MonadIO m => Window -> m () #

Show a window.

See SDL_ShowWindow for C documentation.

Window Attributes

windowMinimumSize :: Window -> StateVar (V2 CInt) #

Get or set the minimum size of a window's client area.

This StateVar can be modified using $= and the current value retrieved with get.

See SDL_SetWindowMinimumSize and SDL_GetWindowMinimumSize for C documentation.

windowMaximumSize :: Window -> StateVar (V2 CInt) #

Get or set the maximum size of a window's client area.

This StateVar can be modified using $= and the current value retrieved with get.

See SDL_SetWindowMaximumSize and SDL_GetWindowMaximumSize for C documentation.

windowSize :: Window -> StateVar (V2 CInt) #

Get or set the size of a window's client area. Values beyond the maximum supported size are clamped.

This StateVar can be modified using $= and the current value retrieved with get.

See SDL_SetWindowSize and SDL_GetWindowSize for C documentation.

windowBordered :: Window -> StateVar Bool #

Get or set if the window should have a border.

This StateVar can be modified using $= and the current value retrieved with get.

windowBrightness :: Window -> StateVar Float #

Get or set the window's brightness, where 0.0 is completely dark and 1.0 is normal brightness.

Throws SDLException if the hardware does not support gamma correction, or if the system has run out of memory.

This StateVar can be modified using $= and the current value retrieved with get.

windowGammaRamp :: Window -> StateVar (V3 (Vector Word16)) #

Gets or sets the gamma ramp for the display that owns a given window.

Note that the data for the gamma ramp - the V3 (Vector Word16) - must contain 256 element arrays. This triple is a set of translation vectors for each of the 16-bit red, green and blue channels.

This StateVar can be modified using $= and the current value retrieved with get.

Despite the name and signature, this method retrieves the gamma ramp of the entire display, not an individual window. A window is considered to be owned by the display that contains the window's center pixel.

windowGrab :: Window -> StateVar Bool #

Get or set whether the mouse shall be confined to the window.

This StateVar can be modified using $= and the current value retrieved with get.

setWindowMode :: MonadIO m => Window -> WindowMode -> m () #

Change between window modes.

Throws SDLException on failure.

getWindowAbsolutePosition :: MonadIO m => Window -> m (V2 CInt) #

Get the position of the window.

setWindowPosition :: MonadIO m => Window -> WindowPosition -> m () #

Set the position of the window.

windowTitle :: Window -> StateVar Text #

Get or set the title of the window. If the window has no title, then an empty string is returned.

This StateVar can be modified using $= and the current value retrieved with get.

See SDL_SetWindowTitle and SDL_GetWindowTitle for C documentation.

windowData :: Window -> CString -> StateVar (Ptr ()) #

Get or set the pointer to arbitrary user data associated with the given window and name.

This StateVar can be modified using $= and the current value retrieved with get.

getWindowConfig :: MonadIO m => Window -> m WindowConfig #

Retrieve the configuration of the given window.

Note that Nothing will be returned instead of potential OpenGL parameters used during the creation of the window.

getWindowPixelFormat :: MonadIO m => Window -> m PixelFormat #

Get the pixel format that is used for the given window.

data PixelFormat #

Instances

Bounded PixelFormat # 
Enum PixelFormat # 
Eq PixelFormat # 
Data PixelFormat # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PixelFormat -> c PixelFormat #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c PixelFormat #

toConstr :: PixelFormat -> Constr #

dataTypeOf :: PixelFormat -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c PixelFormat) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PixelFormat) #

gmapT :: (forall b. Data b => b -> b) -> PixelFormat -> PixelFormat #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PixelFormat -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PixelFormat -> r #

gmapQ :: (forall d. Data d => d -> u) -> PixelFormat -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> PixelFormat -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> PixelFormat -> m PixelFormat #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PixelFormat -> m PixelFormat #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PixelFormat -> m PixelFormat #

Ord PixelFormat # 
Read PixelFormat # 
Show PixelFormat # 
Generic PixelFormat # 

Associated Types

type Rep PixelFormat :: * -> * #

ToNumber PixelFormat Word32 # 
FromNumber PixelFormat Word32 # 
type Rep PixelFormat # 
type Rep PixelFormat = D1 (MetaData "PixelFormat" "SDL.Video.Renderer" "sdl2-2.2.0-2P34LP7wP7h1axXaFF2L0F" False) ((:+:) ((:+:) ((:+:) ((:+:) ((:+:) (C1 (MetaCons "Unknown" PrefixI False) U1) (C1 (MetaCons "Index1LSB" PrefixI False) U1)) ((:+:) (C1 (MetaCons "Index1MSB" PrefixI False) U1) (C1 (MetaCons "Index4LSB" PrefixI False) U1))) ((:+:) ((:+:) (C1 (MetaCons "Index4MSB" PrefixI False) U1) (C1 (MetaCons "Index8" PrefixI False) U1)) ((:+:) (C1 (MetaCons "RGB332" PrefixI False) U1) ((:+:) (C1 (MetaCons "RGB444" PrefixI False) U1) (C1 (MetaCons "RGB555" PrefixI False) U1))))) ((:+:) ((:+:) ((:+:) (C1 (MetaCons "BGR555" PrefixI False) U1) (C1 (MetaCons "ARGB4444" PrefixI False) U1)) ((:+:) (C1 (MetaCons "RGBA4444" PrefixI False) U1) (C1 (MetaCons "ABGR4444" PrefixI False) U1))) ((:+:) ((:+:) (C1 (MetaCons "BGRA4444" PrefixI False) U1) (C1 (MetaCons "ARGB1555" PrefixI False) U1)) ((:+:) (C1 (MetaCons "RGBA5551" PrefixI False) U1) ((:+:) (C1 (MetaCons "ABGR1555" PrefixI False) U1) (C1 (MetaCons "BGRA5551" PrefixI False) U1)))))) ((:+:) ((:+:) ((:+:) ((:+:) (C1 (MetaCons "RGB565" PrefixI False) U1) (C1 (MetaCons "BGR565" PrefixI False) U1)) ((:+:) (C1 (MetaCons "RGB24" PrefixI False) U1) (C1 (MetaCons "BGR24" PrefixI False) U1))) ((:+:) ((:+:) (C1 (MetaCons "RGB888" PrefixI False) U1) (C1 (MetaCons "RGBX8888" PrefixI False) U1)) ((:+:) (C1 (MetaCons "BGR888" PrefixI False) U1) ((:+:) (C1 (MetaCons "BGRX8888" PrefixI False) U1) (C1 (MetaCons "ARGB8888" PrefixI False) U1))))) ((:+:) ((:+:) ((:+:) (C1 (MetaCons "RGBA8888" PrefixI False) U1) (C1 (MetaCons "ABGR8888" PrefixI False) U1)) ((:+:) (C1 (MetaCons "BGRA8888" PrefixI False) U1) (C1 (MetaCons "ARGB2101010" PrefixI False) U1))) ((:+:) ((:+:) (C1 (MetaCons "YV12" PrefixI False) U1) (C1 (MetaCons "IYUV" PrefixI False) U1)) ((:+:) (C1 (MetaCons "YUY2" PrefixI False) U1) ((:+:) (C1 (MetaCons "UYVY" PrefixI False) U1) (C1 (MetaCons "YVYU" PrefixI False) U1)))))))

Renderer Management

createSoftwareRenderer :: MonadIO m => Surface -> m Renderer #

Create a 2D software rendering context for the given surface.

See https://wiki.libsdl.org/SDL_CreateSoftwareRenderer

Clipboard Handling

getClipboardText :: MonadIO m => m Text #

Get the text from the clipboard.

Throws SDLException on failure.

hasClipboardText :: MonadIO m => m Bool #

Checks if the clipboard exists, and has some text in it.

setClipboardText :: MonadIO m => Text -> m () #

Replace the contents of the clipboard with the given text.

Throws SDLException on failure.

Display

getDisplays :: MonadIO m => m [Display] #

Throws SDLException on failure.

data Display #

Constructors

Display 

Fields

data DisplayMode #

Constructors

DisplayMode 

Fields

data VideoDriver #

Constructors

VideoDriver 

Instances

Eq VideoDriver # 
Data VideoDriver # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> VideoDriver -> c VideoDriver #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c VideoDriver #

toConstr :: VideoDriver -> Constr #

dataTypeOf :: VideoDriver -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c VideoDriver) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c VideoDriver) #

gmapT :: (forall b. Data b => b -> b) -> VideoDriver -> VideoDriver #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> VideoDriver -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> VideoDriver -> r #

gmapQ :: (forall d. Data d => d -> u) -> VideoDriver -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> VideoDriver -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> VideoDriver -> m VideoDriver #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> VideoDriver -> m VideoDriver #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> VideoDriver -> m VideoDriver #

Ord VideoDriver # 
Read VideoDriver # 
Show VideoDriver # 
Generic VideoDriver # 

Associated Types

type Rep VideoDriver :: * -> * #

type Rep VideoDriver # 
type Rep VideoDriver = D1 (MetaData "VideoDriver" "SDL.Video" "sdl2-2.2.0-2P34LP7wP7h1axXaFF2L0F" False) (C1 (MetaCons "VideoDriver" PrefixI True) (S1 (MetaSel (Just Symbol "videoDriverName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String)))

Screen Savers

Screen savers should be disabled when the sudden enablement of the monitor's power saving features would be inconvenient for when the user hasn't provided any input for some period of time, such as during video playback.

Screen savers are disabled by default upon the initialization of the video subsystem.

screenSaverEnabled :: StateVar Bool #

Get or set whether to allow the screen to be blanked by a screen saver.

Screen savers are re-enabled, if needed, when SDL quits.

Message Box

showSimpleMessageBox :: MonadIO m => Maybe Window -> MessageKind -> Text -> Text -> m () #

Show a simple message box with the given title and a message. Consider writing your messages to stderr too.

Throws SDLException if there are no available video targets.

data MessageKind #

Constructors

Error 
Warning 
Information 

Instances

Bounded MessageKind # 
Enum MessageKind # 
Eq MessageKind # 
Data MessageKind # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> MessageKind -> c MessageKind #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c MessageKind #

toConstr :: MessageKind -> Constr #

dataTypeOf :: MessageKind -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c MessageKind) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c MessageKind) #

gmapT :: (forall b. Data b => b -> b) -> MessageKind -> MessageKind #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> MessageKind -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> MessageKind -> r #

gmapQ :: (forall d. Data d => d -> u) -> MessageKind -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> MessageKind -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> MessageKind -> m MessageKind #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> MessageKind -> m MessageKind #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> MessageKind -> m MessageKind #

Ord MessageKind # 
Read MessageKind # 
Show MessageKind # 
Generic MessageKind # 

Associated Types

type Rep MessageKind :: * -> * #

ToNumber MessageKind Word32 # 
type Rep MessageKind # 
type Rep MessageKind = D1 (MetaData "MessageKind" "SDL.Video" "sdl2-2.2.0-2P34LP7wP7h1axXaFF2L0F" False) ((:+:) (C1 (MetaCons "Error" PrefixI False) U1) ((:+:) (C1 (MetaCons "Warning" PrefixI False) U1) (C1 (MetaCons "Information" PrefixI False) U1)))