Safe Haskell | None |
---|---|
Language | Haskell2010 |
SDL.Video
Contents
Synopsis
- module SDL.Video.OpenGL
- module SDL.Video.Renderer
- data Window
- createWindow :: MonadIO m => Text -> WindowConfig -> m Window
- defaultWindow :: WindowConfig
- data WindowConfig = WindowConfig {}
- data WindowMode
- data WindowPosition
- destroyWindow :: MonadIO m => Window -> m ()
- hideWindow :: MonadIO m => Window -> m ()
- raiseWindow :: MonadIO m => Window -> m ()
- showWindow :: MonadIO m => Window -> m ()
- windowMinimumSize :: Window -> StateVar (V2 CInt)
- windowMaximumSize :: Window -> StateVar (V2 CInt)
- windowSize :: Window -> StateVar (V2 CInt)
- windowBordered :: Window -> StateVar Bool
- windowBrightness :: Window -> StateVar Float
- windowGammaRamp :: Window -> StateVar (V3 (Vector Word16))
- windowGrab :: Window -> StateVar Bool
- setWindowMode :: MonadIO m => Window -> WindowMode -> m ()
- getWindowAbsolutePosition :: MonadIO m => Window -> m (V2 CInt)
- setWindowPosition :: MonadIO m => Window -> WindowPosition -> m ()
- windowTitle :: Window -> StateVar Text
- windowData :: Window -> CString -> StateVar (Ptr ())
- getWindowConfig :: MonadIO m => Window -> m WindowConfig
- getWindowPixelFormat :: MonadIO m => Window -> m PixelFormat
- data PixelFormat
- = Unknown
- | Index1LSB
- | Index1MSB
- | Index4LSB
- | Index4MSB
- | Index8
- | RGB332
- | RGB444
- | RGB555
- | BGR555
- | ARGB4444
- | RGBA4444
- | ABGR4444
- | BGRA4444
- | ARGB1555
- | RGBA5551
- | ABGR1555
- | BGRA5551
- | RGB565
- | BGR565
- | RGB24
- | BGR24
- | RGB888
- | RGBX8888
- | BGR888
- | BGRX8888
- | ARGB8888
- | RGBA8888
- | ABGR8888
- | BGRA8888
- | ARGB2101010
- | YV12
- | IYUV
- | YUY2
- | UYVY
- | YVYU
- createRenderer :: MonadIO m => Window -> CInt -> RendererConfig -> m Renderer
- createSoftwareRenderer :: MonadIO m => Surface -> m Renderer
- destroyRenderer :: MonadIO m => Renderer -> m ()
- getClipboardText :: MonadIO m => m Text
- hasClipboardText :: MonadIO m => m Bool
- setClipboardText :: MonadIO m => Text -> m ()
- getDisplays :: MonadIO m => m [Display]
- data Display = Display {}
- data DisplayMode = DisplayMode {}
- data VideoDriver = VideoDriver {}
- screenSaverEnabled :: StateVar Bool
- showSimpleMessageBox :: MonadIO m => Maybe Window -> MessageKind -> Text -> Text -> m ()
- data MessageKind
- = Error
- | Warning
- | Information
Documentation
module SDL.Video.OpenGL
module SDL.Video.Renderer
Window Management
Instances
Eq Window Source # | |
Data Window Source # | |
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 Source # | |
Show Window Source # | |
Generic Window Source # | |
type Rep Window Source # | |
createWindow :: MonadIO m => Text -> WindowConfig -> m Window Source #
Create a window with the given title and configuration.
Throws SDLException
on failure.
defaultWindow :: WindowConfig Source #
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 ,windowVisible
= True }
data WindowConfig Source #
Constructors
WindowConfig | |
Fields
|
Instances
data WindowMode Source #
Constructors
Fullscreen | Real fullscreen with a video mode change |
FullscreenDesktop | Fake fullscreen that takes the size of the desktop |
Maximized | |
Minimized | |
Windowed |
Instances
data WindowPosition Source #
Constructors
Centered | |
Wherever | Let the window mananger decide where it's best to place the window. |
Absolute (Point V2 CInt) |
Instances
destroyWindow :: MonadIO m => Window -> m () Source #
Destroy the given window. The Window
handler may not be used
afterwards.
Window Actions
hideWindow :: MonadIO m => Window -> m () Source #
Hide a window.
See SDL_HideWindow
for C documentation.
raiseWindow :: MonadIO m => Window -> m () Source #
Raise the window above other windows and set the input focus.
See SDL_RaiseWindow
for C documentation.
showWindow :: MonadIO m => Window -> m () Source #
Show a window.
See SDL_ShowWindow
for C documentation.
Window Attributes
windowMinimumSize :: Window -> StateVar (V2 CInt) Source #
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) Source #
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) Source #
Get or set the size of a window's client area. Values beyond the maximum supported size are clamped.
If window was created with windowHighDPI
flag, this size may differ from the size in pixels. Use glGetDrawableSize
to get size in pixels.
This StateVar
can be modified using $=
and the current value retrieved with get
.
See SDL_SetWindowSize
and SDL_GetWindowSize
for C documentation.
windowGammaRamp :: Window -> StateVar (V3 (Vector Word16)) Source #
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.
setWindowMode :: MonadIO m => Window -> WindowMode -> m () Source #
Change between window modes.
Throws SDLException
on failure.
getWindowAbsolutePosition :: MonadIO m => Window -> m (V2 CInt) Source #
Get the position of the window.
setWindowPosition :: MonadIO m => Window -> WindowPosition -> m () Source #
Set the position of the window.
windowTitle :: Window -> StateVar Text Source #
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.
getWindowConfig :: MonadIO m => Window -> m WindowConfig Source #
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 Source #
Get the pixel format that is used for the given window.
data PixelFormat Source #
Constructors
Instances
Renderer Management
createRenderer :: MonadIO m => Window -> CInt -> RendererConfig -> m Renderer Source #
createSoftwareRenderer :: MonadIO m => Surface -> m Renderer Source #
Create a 2D software rendering context for the given surface.
destroyRenderer :: MonadIO m => Renderer -> m () Source #
Clipboard Handling
getClipboardText :: MonadIO m => m Text Source #
Get the text from the clipboard.
Throws SDLException
on failure.
hasClipboardText :: MonadIO m => m Bool Source #
Checks if the clipboard exists, and has some text in it.
setClipboardText :: MonadIO m => Text -> m () Source #
Replace the contents of the clipboard with the given text.
Throws SDLException
on failure.
Display
getDisplays :: MonadIO m => m [Display] Source #
Throws SDLException
on failure.
Constructors
Display | |
Fields
|
Instances
Eq Display Source # | |
Ord Display Source # | |
Read Display Source # | |
Show Display Source # | |
Generic Display Source # | |
type Rep Display Source # | |
type Rep Display = D1 (MetaData "Display" "SDL.Video" "sdl2-2.4.0.1-JrcuLoapSXVLRmXtawChdv" False) (C1 (MetaCons "Display" PrefixI True) ((S1 (MetaSel (Just "displayName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String) :*: S1 (MetaSel (Just "displayBoundsPosition") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Point V2 CInt))) :*: (S1 (MetaSel (Just "displayBoundsSize") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (V2 CInt)) :*: S1 (MetaSel (Just "displayModes") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [DisplayMode])))) |
data DisplayMode Source #
Constructors
DisplayMode | |
Fields
|
Instances
data VideoDriver Source #
Constructors
VideoDriver | |
Fields |
Instances
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 Source #
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 () Source #
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 Source #
Constructors
Error | |
Warning | |
Information |