v2026.6.4
All Bundles
Bundle SDL2 multimedia library for 2D graphics, input handling, audio playback, and window management. Core types: Window, Renderer, Texture, Surface, Event, and Mixer. Compile with -lib sdl2.

Display

Video display

Operations

GetClosestDisplayMode # function

Get the closest match to the requested display mode

function : GetClosestDisplayMode(displayIndex:Int, mode:DisplayMode, closest:DisplayMode) ~ Bool

Parameters

NameTypeDescription
displayIndexIntthe index of the display to query
modeDisplayModean SDL_DisplayMode structure containing the desired display mode
closestDisplayModean SDL_DisplayMode structure filled in with the closest match of the available display modes

Return

TypeDescription
Booltrue of success, false otherwise

GetCurrentDisplayMode # function

Get information about the current display mode

function : GetCurrentDisplayMode(displayIndex:Int, mode:DisplayMode) ~ Int

Parameters

NameTypeDescription
displayIndexIntthe index of the display to query
modeDisplayModean DisplayMode class filled in with the current display mode

Return

TypeDescription
IntReturns 0 on success or a negative error code on failure

GetCurrentVideoDriver # function

Name of the currently initialized video driver

function : GetCurrentVideoDriver() ~ String

Return

TypeDescription
Stringname of the current video driver

GetDPI # function

Get the dots/pixels-per-inch for a display

function : GetDPI(index:Int, ddpi:FloatRef, hdpi:FloatRef, vdpi:FloatRef) ~ Int

Parameters

NameTypeDescription
indexIntindex of the display from which DPI information should be queried
ddpiFloatRefpointer filled in with the diagonal DPI of the display; may be NULL
hdpiFloatRefpointer filled in with the horizontal DPI of the display; may be NULL
vdpiFloatRefpointer filled in with the vertical DPI of the display; may be NULL

Return

TypeDescription
Int0 on success or a negative error code on failure

GetDisplayBounds # function

Get the desktop area represented by a display, with the primary display located at 0,0

function : GetDisplayBounds(displayIndex:Int, rect:Rect) ~ Int

Parameters

NameTypeDescription
displayIndexIntthe index of the display to query
rectRectthe SDL_Rect structure filled in with the display bounds

Return

TypeDescription
Int0 on success or a negative error code on failure

GetDisplayMode # function

Get information about a specific display mode

function : GetDisplayMode(displayIndex:Int, modeIndex:Int, mode:DisplayMode) ~ Int

Parameters

NameTypeDescription
displayIndexIntthe index of the display to query
modeIndexIntthe index of the display mode to query
modeDisplayModean DisplayMode class filled in with the mode at modeIndex

Return

TypeDescription
IntReturns 0 on success or a negative error code on failure

GetDisplayName # function

Get the name of a display in UTF-8 encoding

function : GetDisplayName(displayIndex:Int) ~ String

Parameters

NameTypeDescription
displayIndexIntthe index of display from which the name should be queried

Return

TypeDescription
Stringthe name of a display

GetNumDisplayModes # function

Get the number of available display modes

function : GetNumDisplayModes(displayIndex:Int) ~ Int

Parameters

NameTypeDescription
displayIndexIntthe index of the display to query

Return

TypeDescription
Intnumber >= 1 on success or a negative error code on failure

GetNumVideoDisplays # function

Get the number of available video displays

function : GetNumVideoDisplays() ~ Int

Return

TypeDescription
Intnumber >= 1 or a negative error code on failure

GetNumVideoDrivers # function

Get the number of video drivers compiled into SDL

function : GetNumVideoDrivers() ~ Int

Return

TypeDescription
Intnumber >= 1 on success or a negative error code on failure

GetVideoDriver # function

Get the name of a built in video driver

function : GetVideoDriver(index:Int) ~ String

Parameters

NameTypeDescription
indexIntthe index of a video driver

Return

TypeDescription
Stringname of the video driver with the given index

VideoInit # function

Initialize the video subsystem, optionally specifying a video driver

function : VideoInit(driver_name:String) ~ Int

Parameters

NameTypeDescription
driver_nameStringname of a video driver to initialize, or Nil for the default driver

Return

TypeDescription
Int0 on success or a negative error code on failure

VideoQuit # function

Shut down the video subsystem

function : VideoQuit() ~ Nil