Window
SDL Window
Operations
- New
- Destroy
- DisableScreenSaver
- EnableScreenSaver
- GLGetDrawableSize
- GLSwap
- GetBrightness
- GetDisplayIndex
- GetFlags
- GetFromID
- GetGammaRamp
- GetGrab
- GetGrabbedWindow
- GetID
- GetMaximumSize
- GetMinimumSize
- GetPixelFormat
- GetPosition
- GetSize
- GetSurface
- Hide
- IsNull
- IsScreenSaverEnabled
- Maximize
- Minimize
- Raise
- Restore
- SetBordered
- SetBrightness
- SetDisplayMode
- SetFullscreen
- SetGammaRamp
- SetGrab
- SetIcon
- SetMaximumSize
- SetMinimumSize
- SetPosition
- SetSize
- SetTitle
- Show
- ShowSimpleMessageBox
- UpdateSurface
DisableScreenSaver # function
Prevent the screen from being blanked by a screen saver
function : DisableScreenSaver() ~ NilEnableScreenSaver # function
Allow the screen to be blanked by a screen saver
function : EnableScreenSaver() ~ NilGLGetDrawableSize #
Get the size of a window's underlying drawable in pixels (for use with glViewport).
method : public : GLGetDrawableSize(w:IntRef, h:IntRef) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| w | IntRef | a holder to variable for storing the width in pixels |
| h | IntRef | a holder to variable for storing the height in pixels |
GetBrightness #
Gets the brightness (gamma multiplier) for the display that owns a given window
method : public : GetBrightness() ~ FloatReturn
| Type | Description |
|---|---|
| Float | brightness for the display where 0.0 is completely dark and 1.0 is normal brightness |
GetDisplayIndex #
Get the index of the display associated with a window
method : public : GetDisplayIndex() ~ IntReturn
| Type | Description |
|---|---|
| Int | index of the display containing the center of the window on success or a negative error code on failure |
GetFlags #
Get the window flags
method : public : GetFlags() ~ IntReturn
| Type | Description |
|---|---|
| Int | OR'd mask of the SDL_WindowFlags associated with window |
GetFromID #
Get the numeric ID of a window, for logging purposes
method : public : GetFromID(id:Int) ~ WindowParameters
| Name | Type | Description |
|---|---|---|
| id | Int | window ID |
Return
| Type | Description |
|---|---|
| Window | the ID of the window on success or 0 on failure |
GetGammaRamp #
Gets the gamma ramp for the display that owns a given window
method : public : GetGammaRamp(red:IntRef, green:IntRef, blue:IntRef) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| red | IntRef | a 256 element array of 16-bit quantities representing the translation table for the red channel |
| green | IntRef | a 256 element array of 16-bit quantities representing the translation table for the green channel |
| blue | IntRef | a 256 element array of 16-bit quantities representing the translation table for the blue channel, |
Return
| Type | Description |
|---|---|
| Int | 0 on success or a negative error code on failure |
GetGrab #
Get a window's input grab mode
method : public : GetGrab() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | Returns true if input is grabbed, false otherwise |
GetGrabbedWindow # function
Get the window that currently has an input grab enabled
function : GetGrabbedWindow() ~ WindowReturn
| Type | Description |
|---|---|
| Window | window if input is grabbed or NULL otherwise |
GetID #
Get the numeric ID of a window, for logging purposes
method : public : GetID() ~ IntReturn
| Type | Description |
|---|---|
| Int | the ID of the window on success or 0 on failure |
GetMaximumSize #
Get the maximum size of a window's client area
method : public : GetMaximumSize(w:IntRef, h:IntRef) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| w | IntRef | pointer filled in with the maximum width of the window, |
| h | IntRef | pointer filled in with the maximum height of the window |
GetMinimumSize #
Get the minimum size of a window's client area
method : public : GetMinimumSize(w:IntRef, h:IntRef) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| w | IntRef | pointer filled in with the minimum width of the window |
| h | IntRef | pointer filled in with the minimum height of the window |
GetPixelFormat #
Get the pixel format associated with the window
method : public : GetPixelFormat() ~ IntReturn
| Type | Description |
|---|---|
| Int | pixel format of the window on success or SDL_PIXELFORMAT_UNKNOWN on failure |
GetPosition #
Get the position of a window
method : public : GetPosition(x:IntRef, y:IntRef) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| x | IntRef | pointer filled in with the x position of the window, in screen coordinates |
| y | IntRef | pointer filled in with the y position of the window, in screen coordinates |
GetSize #
Get the size of a window's client area
method : public : GetSize(w:IntRef, h:IntRef) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| w | IntRef | pointer filled in with the width of the window, in screen coordinates |
| h | IntRef | pointer filled in with the height of the window, in screen coordinates |
GetSurface #
Get the SDL surface associated with the window
method : public : GetSurface() ~ SurfaceReturn
| Type | Description |
|---|---|
| Surface | surface associated with the window, or NULL on failure |
IsNull #
Determines if the underlying SDL C-struct is NULL
method : public : IsNull() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if NULL, false otherwise |
IsScreenSaverEnabled # function
Check whether the screensaver is currently enabled
function : IsScreenSaverEnabled() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | Returns true if the screensaver is enabled, false if it is disabled |
New # constructor
Creates a window with the specified position, dimensions, and flags
New(title:String, x:Int, y:Int, w:Int, h:Int, flags:Int)Parameters
| Name | Type | Description |
|---|---|---|
| title | String | the title of the window, in UTF-8 encoding |
| x | Int | the x position of the window, WindowFlags->SDL_WINDOWPOS_CENTERED, or WindowFlags->SDL_WINDOWPOS_UNDEFINED |
| y | Int | the y position of the window, WindowFlags->SDL_WINDOWPOS_CENTERED, or WindowFlags->SDL_WINDOWPOS_UNDEFINED |
| w | Int | the width of the window, in screen coordinates |
| h | Int | the height of the window, in screen coordinates |
| flags | Int | 0, or one or more WindowFlags OR'd together |
Restore #
Restore the size and position of a minimized or maximized window
method : public : Restore() ~ NilSetBordered #
Set the border state of a window
method : public : SetBordered(bordered:Bool) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| bordered | Bool | false to remove border, true to add border |
SetBrightness #
Sets the brightness (gamma multiplier) for the display that owns a given window
method : public : SetBrightness(brightness:Float) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| brightness | Float | the brightness (gamma multiplier) value to set where 0.0 is completely dark and 1.0 is normal brightness |
Return
| Type | Description |
|---|---|
| Int | 0 on success or a negative error code on failure |
SetDisplayMode #
Set the display mode to use when a window is visible at full-screen
method : public : SetDisplayMode(mode:DisplayMode) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| mode | DisplayMode | the SDL_DisplayMode structure representing the mode to use, or NULL to use the window's dimensions and the desktop's format and refresh rate |
SetFullscreen #
Set a window's full-screen state
method : public : SetFullscreen(flags:Int) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| flags | Int | WindowFlags->SDL_WINDOW_FULLSCREEN, WindowFlags->SDL_WINDOW_FULLSCREEN_DESKTOP or 0 |
SetGammaRamp #
Sets the gamma ramp for the display that owns a given window
method : public : SetGammaRamp(red:IntRef, green:IntRef, blue:IntRef) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| red | IntRef | a 256 element array of 16-bit quantities representing the translation table for the red channel |
| green | IntRef | a 256 element array of 16-bit quantities representing the translation table for the green channel |
| blue | IntRef | a 256 element array of 16-bit quantities representing the translation table for the blue channel, |
Return
| Type | Description |
|---|---|
| Int | 0 on success or a negative error code on failure |
SetGrab #
Set a window's input grab mode
method : public : SetGrab(grabbed:Bool) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| grabbed | Bool | true to grab input or false to release input |
SetIcon #
Set the icon for a window
method : public : SetIcon(icon:Surface) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| icon | Surface | a Surface instance containing the icon for the window |
SetMaximumSize #
Set the maximum size of a window's client area
method : public : SetMaximumSize(max_w:Int, max_h:Int) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| max_w | Int | maximum width of the window in pixels |
| max_h | Int | maximum height of the window in pixels |
SetMinimumSize #
Set the minimum size of a window's client area
method : public : SetMinimumSize(min_w:Int, min_h:Int) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| min_w | Int | the minimum width of the window in pixels |
| min_h | Int | the minimum height of the window in pixels |
SetPosition #
Set the position of a window
method : public : SetPosition(x:Int, y:Int) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| x | Int | the x coordinate of the window in screen coordinates, or WindowFlags->SDL_WINDOWPOS_CENTERED or WindowFlags->SDL_WINDOWPOS_UNDEFINED |
| y | Int | the y coordinate of the window in screen coordinates, or WindowFlags->SDL_WINDOWPOS_CENTERED or WindowFlags->SDL_WINDOWPOS_UNDEFINED |
SetSize #
Set the size of a window's client area
method : public : SetSize(w:Int, h:Int) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| w | Int | width of the window in pixels, in screen coordinates, must be > 0 |
| h | Int | height of the window in pixels, in screen coordinates, must be > 0 |
SetTitle #
Set the title of a window
method : public : SetTitle(title:String) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| title | String | the desired window title in UTF-8 format |
ShowSimpleMessageBox # function
Display a simple modal message box
function : ShowSimpleMessageBox(flags:Int, title:String, message:String, window:Window) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| flags | Int | an SDL_MessageBoxFlags value |
| title | String | UTF-8 title text |
| message | String | UTF-8 message text |
| window | Window | the parent window, or NULL for no parent |
Return
| Type | Description |
|---|---|
| Int | 0 on success or a negative error code on failure |
UpdateSurface #
Use this function to copy the window surface to the screen
method : public : UpdateSurface() ~ Int