module lib.sdl2.video

Code Map

module lib.sdl2.video;


enum SDL_WINDOW_FULLSCREEN;
enum SDL_WINDOW_OPENGL;
enum SDL_WINDOW_SHOWN;
enum SDL_WINDOW_HIDDEN;
enum SDL_WINDOW_BORDERLESS;
enum SDL_WINDOW_RESIZABLE;
enum SDL_WINDOW_MINIMIZED;
enum SDL_WINDOW_MAXIMIZED;
enum SDL_WINDOW_INPUT_GRABBED;
enum SDL_WINDOW_INPUT_FOCUS;
enum SDL_WINDOW_MOUSE_FOCUS;
enum SDL_WINDOW_FULLSCREEN_DESKTOP;
enum SDL_WINDOW_FOREIGN;
enum SDL_WINDOW_ALLOW_HIGHDPI;
enum SDL_WINDOW_MOUSE_CAPTURE;
enum SDL_WINDOW_ALWAYS_ON_TOP;
enum SDL_WINDOW_SKIP_TASKBAR;
enum SDL_WINDOW_UTILITY;
enum SDL_WINDOW_POPUP_MENU;
//! \brief Used to indicate that you don't care what the window position
//! is.
enum SDL_WINDOWPOS_UNDEFINED_MASK;
//! \brief Used to indicate that the window position should be centered.
enum SDL_WINDOWPOS_CENTERED_MASK;
enum SDL_WINDOWPOS_CENTERED;
enum SDL_WINDOWEVENT_NONE;
enum SDL_WINDOWEVENT_SHOWN;
enum SDL_WINDOWEVENT_HIDDEN;
enum SDL_WINDOWEVENT_EXPOSED;
enum SDL_WINDOWEVENT_MOVED;
enum SDL_WINDOWEVENT_RESIZED;
enum SDL_WINDOWEVENT_SIZE_CHANGED;
enum SDL_WINDOWEVENT_MINIMIZED;
enum SDL_WINDOWEVENT_MAXIMIZED;
enum SDL_WINDOWEVENT_RESTORED;
enum SDL_WINDOWEVENT_ENTER;
enum SDL_WINDOWEVENT_LEAVE;
enum SDL_WINDOWEVENT_FOCUS_GAINED;
enum SDL_WINDOWEVENT_FOCUS_LOST;
enum SDL_WINDOWEVENT_CLOSE;
enum SDL_WINDOWEVENT_TAKE_FOCUS;
enum SDL_WINDOWEVENT_HIT_TEST;
enum SDL_GL_RED_SIZE;
enum SDL_GL_GREEN_SIZE;
enum SDL_GL_BLUE_SIZE;
enum SDL_GL_ALPHA_SIZE;
enum SDL_GL_BUFFER_SIZE;
enum SDL_GL_DOUBLEBUFFER;
enum SDL_GL_DEPTH_SIZE;
enum SDL_GL_STENCIL_SIZE;
enum SDL_GL_ACCUM_RED_SIZE;
enum SDL_GL_ACCUM_GREEN_SIZE;
enum SDL_GL_ACCUM_BLUE_SIZE;
enum SDL_GL_ACCUM_ALPHA_SIZE;
enum SDL_GL_STEREO;
enum SDL_GL_MULTISAMPLEBUFFERS;
enum SDL_GL_MULTISAMPLESAMPLES;
enum SDL_GL_ACCELERATED_VISUAL;
enum SDL_GL_RETAINED_BACKING;
enum SDL_GL_CONTEXT_MAJOR_VERSION;
enum SDL_GL_CONTEXT_MINOR_VERSION;
enum SDL_GL_CONTEXT_EGL;
enum SDL_GL_CONTEXT_FLAGS;
enum SDL_GL_CONTEXT_PROFILE_MASK;
enum SDL_GL_SHARE_WITH_CURRENT_CONTEXT;
enum SDL_GL_CONTEXT_PROFILE_CORE;
enum SDL_GL_CONTEXT_PROFILE_COMPATIBILITY;
enum SDL_GL_CONTEXT_PROFILE_ES;
enum SDL_GL_CONTEXT_DEBUG_FLAG;
enum SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG;
enum SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG;
enum SDL_GL_CONTEXT_RESET_ISOLATION_FLAG;

//! \brief The flags on a window
alias SDL_WindowFlags = i32;
//! \brief Event subtype for window events
alias SDL_WindowEventID = i32;
//! \brief An opaque handle to an OpenGL context.
alias SDL_GLContext = void*;
//! \brief OpenGL configuration attributes
alias SDL_GLattr = i32;
alias SDL_GLprofile = i32;
alias SDL_GLcontextFlag = i32;

//! \brief The structure that defines a display mode
struct SDL_DisplayMode
{
public:
	format: Uint32;
	w: i32;
	h: i32;
	refresh_rate: i32;
	driverdata: void*;
}

struct SDL_Window
{
}

fn SDL_WINDOWPOS_UNDEFINED_DISPLAY(X: i32) i32 { }
fn SDL_WINDOWPOS_UNDEFINED() i32 { }
fn SDL_WINDOWPOS_ISUNDEFINED(X: i32) bool { }
fn SDL_WINDOWPOS_CENTERED_DISPLAY(X: i32) i32 { }
fn SDL_WINDOWPOS_ISCENTERED(X: i32) bool { }
//! \brief Get the number of video drivers compiled into SDL
fn SDL_GetNumVideoDrivers() i32;
//! \brief Get the name of a built in video driver.
fn SDL_GetVideoDriver(index: i32) char*;
//! \brief Initialize the video subsystem, optionally specifying a video
//! driver.
fn SDL_VideoInit(driver_name: const(const(char)*)) i32;
//! \brief Shuts down the video subsystem.
fn SDL_VideoQuit();
//! \brief Returns the name of the currently initialized video driver.
fn SDL_GetCurrentVideoDriver() char*;
//! \brief Returns the number of available video displays.
fn SDL_GetNumVideoDisplays() i32;
//! \brief Get the name of a display in UTF-8 encoding
fn SDL_GetDisplayName(displayIndex: i32) char*;
//! \brief Get the desktop area represented by a display, with the primary
//! display located at 0,0
fn SDL_GetDisplayBounds(displayIndex: i32, rect: SDL_Rect*) i32;
//! \brief Get the usable desktop area represented by a display, with the
//! primary display located at 0,0
fn SDL_GetDisplayUsableBounds(displayIndex: i32, rect: SDL_Rect*) i32;
//! \brief Returns the number of available display modes.
fn SDL_GetNumDisplayModes(displayIndex: i32) i32;
//! \brief Fill in information about a specific display mode.
fn SDL_GetDisplayMode(displayIndex: i32, modeIndex: i32, mode: SDL_DisplayMode*) i32;
//! \brief Fill in information about the desktop display mode.
fn SDL_GetDesktopDisplayMode(displayIndex: i32, mode: SDL_DisplayMode*) i32;
//! \brief Fill in information about the current display mode.
fn SDL_GetCurrentDisplayMode(displayIndex: i32, mode: SDL_DisplayMode*) i32;
//! \brief Get the closest match to the requested display mode.
fn SDL_GetClosestDisplayMode(displayIndex: i32, mode: const(const(SDL_DisplayMode)*), closest: SDL_DisplayMode*) SDL_DisplayMode*;
//! \brief Get the display index associated with a window.
fn SDL_GetWindowDisplayIndex(window: SDL_Window*) i32;
//! \brief Set the display mode used when a fullscreen window is visible.
fn SDL_SetWindowDisplayMode(window: SDL_Window*, mode: const(const(SDL_DisplayMode)*)) i32;
//! \brief Fill in information about the display mode used when a
//! fullscreen window is visible.
fn SDL_GetWindowDisplayMode(window: SDL_Window*, mode: SDL_DisplayMode*) i32;
//! \brief Get the pixel format associated with the window.
fn SDL_GetWindowPixelFormat(window: SDL_Window*) Uint32;
//! \brief Create a window with the specified position, dimensions, and
//! flags.
fn SDL_CreateWindow(title: const(const(char)*), x: i32, y: i32, w: i32, h: i32, flags: Uint32) SDL_Window*;
//! \brief Create an SDL window from an existing native window.
fn SDL_CreateWindowFrom(data: const(const(void)*)) SDL_Window*;
//! \brief Get the numeric ID of a window, for logging purposes.
fn SDL_GetWindowID(window: SDL_Window*) Uint32;
//! \brief Get a window from a stored ID, or NULL if it doesn't exist.
fn SDL_GetWindowFromID(id: Uint32) SDL_Window*;
//! \brief Get the window flags.
fn SDL_GetWindowFlags(window: SDL_Window*) Uint32;
//! \brief Set the title of a window, in UTF-8 format.
fn SDL_SetWindowTitle(window: SDL_Window*, title: const(const(char)*));
//! \brief Get the title of a window, in UTF-8 format.
fn SDL_GetWindowTitle(window: SDL_Window*) char*;
//! \brief Set the icon for a window.
fn SDL_SetWindowIcon(window: SDL_Window*, icon: SDL_Surface*);
//! \brief Associate an arbitrary named pointer with a window.
fn SDL_SetWindowData(window: SDL_Window*, name: const(const(char)*), userdata: void*) void*;
//! \brief Retrieve the data pointer associated with a window.
fn SDL_GetWindowData(window: SDL_Window*, name: const(const(char)*)) void*;
//! \brief Set the position of a window.
fn SDL_SetWindowPosition(window: SDL_Window*, x: i32, y: i32);
//! \brief Get the position of a window.
fn SDL_GetWindowPosition(window: SDL_Window*, x: i32*, y: i32*);
//! \brief Set the size of a window's client area.
fn SDL_SetWindowSize(window: SDL_Window*, w: i32, h: i32);
//! \brief Get the size of a window's client area.
fn SDL_GetWindowSize(window: SDL_Window*, w: i32*, h: i32*);
//! \brief Get the size of a window's borders (decorations) around the
//! client area.
fn SDL_GetWindowBordersSize(window: SDL_Window*, top: i32*, left: i32*, bottom: i32*, right: i32*) i32;
//! \brief Set the minimum size of a window's client area.
fn SDL_SetWindowMinimumSize(window: SDL_Window*, min_w: i32, min_h: i32);
//! \brief Get the minimum size of a window's client area.
fn SDL_GetWindowMinimumSize(window: SDL_Window*, w: i32*, h: i32*);
//! \brief Set the maximum size of a window's client area.
fn SDL_SetWindowMaximumSize(window: SDL_Window*, max_w: i32, max_h: i32);
//! \brief Get the maximum size of a window's client area.
fn SDL_GetWindowMaximumSize(window: SDL_Window*, w: i32*, h: i32*);
//! \brief Set the border state of a window.
fn SDL_SetWindowBordered(window: SDL_Window*, bordered: SDL_bool);
//! \brief Set the user-resizable state of a window.
fn SDL_SetWindowResizable(window: SDL_Window*, resizable: SDL_bool);
//! \brief Show a window.
fn SDL_ShowWindow(window: SDL_Window*);
//! \brief Hide a window.
fn SDL_HideWindow(window: SDL_Window*);
//! \brief Raise a window above other windows and set the input focus.
fn SDL_RaiseWindow(window: SDL_Window*);
//! \brief Make a window as large as possible.
fn SDL_MaximizeWindow(window: SDL_Window*);
//! \brief Minimize a window to an iconic representation.
fn SDL_MinimizeWindow(window: SDL_Window*);
//! \brief Restore the size and position of a minimized or maximized
//! window.
fn SDL_RestoreWindow(window: SDL_Window*);
//! \brief Set a window's fullscreen state.
fn SDL_SetWindowFullscreen(window: SDL_Window*, flags: Uint32) i32;
//! \brief Get the SDL surface associated with the window.
fn SDL_GetWindowSurface(window: SDL_Window*) SDL_Surface*;
//! \brief Copy the window surface to the screen.
fn SDL_UpdateWindowSurface(window: SDL_Window*) i32;
//! \brief Copy a number of rectangles on the window surface to the
//! screen.
fn SDL_UpdateWindowSurfaceRects(window: SDL_Window*, rects: const(const(SDL_Rect)*), numrects: i32) i32;
//! \brief Set a window's input grab mode.
fn SDL_SetWindowGrab(window: SDL_Window*, grabbed: SDL_bool);
//! \brief Get a window's input grab mode.
fn SDL_GetWindowGrab(window: SDL_Window*) SDL_bool;
//! \brief Set the brightness (gamma correction) for a window.
fn SDL_SetWindowBrightness(window: SDL_Window*, brightness: f32) i32;
//! \brief Get the brightness (gamma correction) for a window.
fn SDL_GetWindowBrightness(window: SDL_Window*) f32;
//! \brief Set the opacity for a window
fn SDL_SetWindowOpacity(window: SDL_Window*, opacity: f32) i32;
//! \brief Get the opacity of a window.
fn SDL_GetWindowOpacity(window: SDL_Window*, out_opacity: f32*) i32;
//! \brief Sets the window as a modal for another window (TODO: reconsider
//! this function and/or its name)
fn SDL_SetWindowModalFor(modal_window: SDL_Window*, parent_window: SDL_Window*) i32;
//! \brief Explicitly sets input focus to the window.
fn SDL_SetWindowInputFocus(window: SDL_Window*) i32;
//! \brief Set the gamma ramp for a window.
fn SDL_SetWindowGammaRamp(window: SDL_Window*, red: const(const(Uint16)*), green: const(const(Uint16)*), blue: const(const(Uint16)*)) i32;
//! \brief Get the gamma ramp for a window.
fn SDL_GetWindowGammaRamp(window: SDL_Window*, red: Uint16*, green: Uint16*, blue: Uint16*) i32;
//! \brief Destroy a window.
fn SDL_DestroyWindow(window: SDL_Window*);
//! \brief Returns whether the screensaver is currently enabled (default
//! on).
fn SDL_IsScreenSaverEnabled() SDL_bool;
//! \brief Allow the screen to be blanked by a screensaver
fn SDL_EnableScreenSaver();
//! \brief Prevent the screen from being blanked by a screensaver
fn SDL_DisableScreenSaver();
//! \name OpenGL support functions
fn SDL_GL_LoadLibrary(path: const(const(char)*)) i32;
//! \brief Get the address of an OpenGL function.
fn SDL_GL_GetProcAddress(proc: const(const(char)*)) void*;
//! \brief Unload the OpenGL library previously loaded by
//! SDL_GL_LoadLibrary().
fn SDL_GL_UnloadLibrary();
//! \brief Return true if an OpenGL extension is supported for the current
//! context.
fn SDL_GL_ExtensionSupported(extension: const(const(char)*)) SDL_bool;
//! \brief Set an OpenGL window attribute before window creation.
fn SDL_GL_SetAttribute(attr: SDL_GLattr, value: i32) i32;
//! \brief Get the actual value for an attribute from the current context.
fn SDL_GL_GetAttribute(attr: SDL_GLattr, value: i32*) i32;
//! \brief Create an OpenGL context for use with an OpenGL window, and
//! make it current.
fn SDL_GL_CreateContext(window: SDL_Window*) SDL_GLContext;
//! \brief Set up an OpenGL context for rendering into an OpenGL window.
fn SDL_GL_MakeCurrent(window: SDL_Window*, context: SDL_GLContext) i32;
//! \brief Get the currently active OpenGL window.
fn SDL_GL_GetCurrentWindow() SDL_Window*;
//! \brief Get the currently active OpenGL context.
fn SDL_GL_GetCurrentContext() SDL_GLContext;
//! \brief Set the swap interval for the current OpenGL context.
fn SDL_GL_SetSwapInterval(interval: i32) i32;
//! \brief Get the swap interval for the current OpenGL context.
fn SDL_GL_GetSwapInterval() i32;
//! \brief Swap the OpenGL buffers for a window, if double-buffering is
//! supported.
fn SDL_GL_SwapWindow(window: SDL_Window*);
//! \brief Delete an OpenGL context.
fn SDL_GL_DeleteContext(context: SDL_GLContext);
struct SDL_DisplayMode

\brief The structure that defines a display mode

\sa SDL_GetNumDisplayModes() \sa SDL_GetDisplayMode() \sa SDL_GetDesktopDisplayMode() \sa SDL_GetCurrentDisplayMode() \sa SDL_GetClosestDisplayMode() \sa SDL_SetWindowDisplayMode() \sa SDL_GetWindowDisplayMode()

alias SDL_WindowFlags

\brief The flags on a window

\sa SDL_GetWindowFlags()

enum SDL_WINDOWPOS_UNDEFINED_MASK

\brief Used to indicate that you don't care what the window position is.

enum SDL_WINDOWPOS_CENTERED_MASK

\brief Used to indicate that the window position should be centered.

alias SDL_WindowEventID

\brief Event subtype for window events

alias SDL_GLContext

\brief An opaque handle to an OpenGL context.

alias SDL_GLattr

\brief OpenGL configuration attributes

fn SDL_GetNumVideoDrivers() i32

\brief Get the number of video drivers compiled into SDL

\sa SDL_GetVideoDriver()

fn SDL_GetVideoDriver(index: i32) char*

\brief Get the name of a built in video driver.

\note The video drivers are presented in the order in which they are normally checked during initialization.

\sa SDL_GetNumVideoDrivers()

fn SDL_VideoInit(driver_name: const(const(char)*)) i32

\brief Initialize the video subsystem, optionally specifying a video driver.

\param driver_name Initialize a specific driver by name, or NULL for the default video driver.

\return 0 on success, -1 on error

This function initializes the video subsystem; setting up a connection to the window manager, etc, and determines the available display modes and pixel formats, but does not initialize a window or graphics mode.

\sa SDL_VideoQuit()

fn SDL_VideoQuit()

\brief Shuts down the video subsystem.

This function closes all windows, and restores the original video mode.

\sa SDL_VideoInit()

fn SDL_GetCurrentVideoDriver() char*

\brief Returns the name of the currently initialized video driver.

\return The name of the current video driver or NULL if no driver has been initialized

\sa SDL_GetNumVideoDrivers() \sa SDL_GetVideoDriver()

fn SDL_GetNumVideoDisplays() i32

\brief Returns the number of available video displays.

\sa SDL_GetDisplayBounds()

fn SDL_GetDisplayName(displayIndex: i32) char*

\brief Get the name of a display in UTF-8 encoding

\return The name of a display, or NULL for an invalid display index.

\sa SDL_GetNumVideoDisplays()

fn SDL_GetDisplayBounds(displayIndex: i32, rect: SDL_Rect*) i32

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

\return 0 on success, or -1 if the index is out of range.

\sa SDL_GetNumVideoDisplays()

fn SDL_GetDisplayUsableBounds(displayIndex: i32, rect: SDL_Rect*) i32

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

This is the same area as SDL_GetDisplayBounds() reports, but with portions reserved by the system removed. For example, on Mac OS X, this subtracts the area occupied by the menu bar and dock.

Setting a window to be fullscreen generally bypasses these unusable areas, so these are good guidelines for the maximum space available to a non-fullscreen window.

\return 0 on success, or -1 if the index is out of range.

\sa SDL_GetDisplayBounds() \sa SDL_GetNumVideoDisplays()

fn SDL_GetNumDisplayModes(displayIndex: i32) i32

\brief Returns the number of available display modes.

\sa SDL_GetDisplayMode()

fn SDL_GetDisplayMode(displayIndex: i32, modeIndex: i32, mode: SDL_DisplayMode*) i32

\brief Fill in information about a specific display mode.

\note The display modes are sorted in this priority: \li bits per pixel -> more colors to fewer colors \li width -> largest to smallest \li height -> largest to smallest \li refresh rate -> highest to lowest

\sa SDL_GetNumDisplayModes()

fn SDL_GetDesktopDisplayMode(displayIndex: i32, mode: SDL_DisplayMode*) i32

\brief Fill in information about the desktop display mode.

fn SDL_GetCurrentDisplayMode(displayIndex: i32, mode: SDL_DisplayMode*) i32

\brief Fill in information about the current display mode.

fn SDL_GetClosestDisplayMode(displayIndex: i32, mode: const(const(SDL_DisplayMode)*), closest: SDL_DisplayMode*) SDL_DisplayMode*

\brief Get the closest match to the requested display mode.

\param displayIndex The index of display from which mode should be queried. \param mode The desired display mode \param closest A pointer to a display mode to be filled in with the closest match of the available display modes.

\return The passed in value \c closest, or NULL if no matching video mode was available.

The available display modes are scanned, and \c closest is filled in with the closest mode matching the requested mode and returned. The mode format and refresh_rate default to the desktop mode if they are 0. The modes are scanned with size being first priority, format being second priority, and finally checking the refresh_rate. If all the available modes are too small, then NULL is returned.

\sa SDL_GetNumDisplayModes() \sa SDL_GetDisplayMode()

fn SDL_GetWindowDisplayIndex(window: SDL_Window*) i32

\brief Get the display index associated with a window.

\return the display index of the display containing the center of the window, or -1 on error.

fn SDL_SetWindowDisplayMode(window: SDL_Window*, mode: const(const(SDL_DisplayMode)*)) i32

\brief Set the display mode used when a fullscreen window is visible.

By default the window's dimensions and the desktop format and refresh rate are used.

\param window The window for which the display mode should be set. \param mode The mode to use, or NULL for the default mode.

\return 0 on success, or -1 if setting the display mode failed.

\sa SDL_GetWindowDisplayMode() \sa SDL_SetWindowFullscreen()

fn SDL_GetWindowDisplayMode(window: SDL_Window*, mode: SDL_DisplayMode*) i32

\brief Fill in information about the display mode used when a fullscreen window is visible.

\sa SDL_SetWindowDisplayMode() \sa SDL_SetWindowFullscreen()

fn SDL_GetWindowPixelFormat(window: SDL_Window*) Uint32

\brief Get the pixel format associated with the window.

fn SDL_CreateWindow(title: const(const(char)*), x: i32, y: i32, w: i32, h: i32, flags: Uint32) SDL_Window*

\brief Create a window with the specified position, dimensions, and flags.

\param title The title of the window, in UTF-8 encoding. \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or ::SDL_WINDOWPOS_UNDEFINED. \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or ::SDL_WINDOWPOS_UNDEFINED. \param w The width of the window. \param h The height of the window. \param flags The flags for the window, a mask of any of the following: ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL, ::SDL_WINDOW_SHOWN, ::SDL_WINDOW_BORDERLESS, ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED, ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED.

\return The id of the window created, or zero if window creation failed.

\sa SDL_DestroyWindow()

fn SDL_CreateWindowFrom(data: const(const(void)*)) SDL_Window*

\brief Create an SDL window from an existing native window.

\param data A pointer to driver-dependent window creation data

\return The id of the window created, or zero if window creation failed.

\sa SDL_DestroyWindow()

fn SDL_GetWindowID(window: SDL_Window*) Uint32

\brief Get the numeric ID of a window, for logging purposes.

fn SDL_GetWindowFromID(id: Uint32) SDL_Window*

\brief Get a window from a stored ID, or NULL if it doesn't exist.

fn SDL_GetWindowFlags(window: SDL_Window*) Uint32

\brief Get the window flags.

fn SDL_SetWindowTitle(window: SDL_Window*, title: const(const(char)*))

\brief Set the title of a window, in UTF-8 format.

\sa SDL_GetWindowTitle()

fn SDL_GetWindowTitle(window: SDL_Window*) char*

\brief Get the title of a window, in UTF-8 format.

\sa SDL_SetWindowTitle()

fn SDL_SetWindowIcon(window: SDL_Window*, icon: SDL_Surface*)

\brief Set the icon for a window.

\param window The window for which the icon should be set. \param icon The icon for the window.

fn SDL_SetWindowData(window: SDL_Window*, name: const(const(char)*), userdata: void*) void*

\brief Associate an arbitrary named pointer with a window.

\param window The window to associate with the pointer. \param name The name of the pointer. \param userdata The associated pointer.

\return The previous value associated with 'name'

\note The name is case-sensitive.

\sa SDL_GetWindowData()

fn SDL_GetWindowData(window: SDL_Window*, name: const(const(char)*)) void*

\brief Retrieve the data pointer associated with a window.

\param window The window to query. \param name The name of the pointer.

\return The value associated with 'name'

\sa SDL_SetWindowData()

fn SDL_SetWindowPosition(window: SDL_Window*, x: i32, y: i32)

\brief Set the position of a window.

\param window The window to reposition. \param x The x coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or ::SDL_WINDOWPOS_UNDEFINED. \param y The y coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or ::SDL_WINDOWPOS_UNDEFINED.

\note The window coordinate origin is the upper left of the display.

\sa SDL_GetWindowPosition()

fn SDL_GetWindowPosition(window: SDL_Window*, x: i32*, y: i32*)

\brief Get the position of a window.

\param window The window to query. \param x Pointer to variable for storing the x position, may be NULL \param y Pointer to variable for storing the y position, may be NULL

\sa SDL_SetWindowPosition()

fn SDL_SetWindowSize(window: SDL_Window*, w: i32, h: i32)

\brief Set the size of a window's client area.

\param window The window to resize. \param w The width of the window, must be >0 \param h The height of the window, must be >0

\note You can't change the size of a fullscreen window, it automatically matches the size of the display mode.

\sa SDL_GetWindowSize()

fn SDL_GetWindowSize(window: SDL_Window*, w: i32*, h: i32*)

\brief Get the size of a window's client area.

\param window The window to query. \param w Pointer to variable for storing the width, may be NULL \param h Pointer to variable for storing the height, may be NULL

\sa SDL_SetWindowSize()

fn SDL_GetWindowBordersSize(window: SDL_Window*, top: i32*, left: i32*, bottom: i32*, right: i32*) i32

\brief Get the size of a window's borders (decorations) around the client area.

\param window The window to query. \param top Pointer to variable for storing the size of the top border. NULL is permitted. \param left Pointer to variable for storing the size of the left border. NULL is permitted. \param bottom Pointer to variable for storing the size of the bottom border. NULL is permitted. \param right Pointer to variable for storing the size of the right border. NULL is permitted.

\return 0 on success, or -1 if getting this information is not supported.

\note if this function fails (returns -1), the size values will be initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as if the window in question was borderless.

fn SDL_SetWindowMinimumSize(window: SDL_Window*, min_w: i32, min_h: i32)

\brief Set the minimum size of a window's client area.

\param window The window to set a new minimum size. \param min_w The minimum width of the window, must be >0 \param min_h The minimum height of the window, must be >0

\note You can't change the minimum size of a fullscreen window, it automatically matches the size of the display mode.

\sa SDL_GetWindowMinimumSize() \sa SDL_SetWindowMaximumSize()

fn SDL_GetWindowMinimumSize(window: SDL_Window*, w: i32*, h: i32*)

\brief Get the minimum size of a window's client area.

\param window The window to query. \param w Pointer to variable for storing the minimum width, may be NULL \param h Pointer to variable for storing the minimum height, may be NULL

\sa SDL_GetWindowMaximumSize() \sa SDL_SetWindowMinimumSize()

fn SDL_SetWindowMaximumSize(window: SDL_Window*, max_w: i32, max_h: i32)

\brief Set the maximum size of a window's client area.

\param window The window to set a new maximum size. \param max_w The maximum width of the window, must be >0 \param max_h The maximum height of the window, must be >0

\note You can't change the maximum size of a fullscreen window, it automatically matches the size of the display mode.

\sa SDL_GetWindowMaximumSize() \sa SDL_SetWindowMinimumSize()

fn SDL_GetWindowMaximumSize(window: SDL_Window*, w: i32*, h: i32*)

\brief Get the maximum size of a window's client area.

\param window The window to query. \param w Pointer to variable for storing the maximum width, may be NULL \param h Pointer to variable for storing the maximum height, may be NULL

\sa SDL_GetWindowMinimumSize() \sa SDL_SetWindowMaximumSize()

fn SDL_SetWindowBordered(window: SDL_Window*, bordered: SDL_bool)

\brief Set the border state of a window.

This will add or remove the window's SDL_WINDOW_BORDERLESS flag and add or remove the border from the actual window. This is a no-op if the window's border already matches the requested state.

\param window The window of which to change the border state. \param bordered SDL_FALSE to remove border, SDL_TRUE to add border.

\note You can't change the border state of a fullscreen window.

\sa SDL_GetWindowFlags()

fn SDL_SetWindowResizable(window: SDL_Window*, resizable: SDL_bool)

\brief Set the user-resizable state of a window.

This will add or remove the window's SDL_WINDOW_RESIZABLE flag and allow/disallow user resizing of the window. This is a no-op if the window's resizable state already matches the requested state.

\param window The window of which to change the resizable state. \param resizable SDL_TRUE to allow resizing, SDL_FALSE to disallow.

\note You can't change the resizable state of a fullscreen window.

\sa SDL_GetWindowFlags()

fn SDL_ShowWindow(window: SDL_Window*)

\brief Show a window.

\sa SDL_HideWindow()

fn SDL_HideWindow(window: SDL_Window*)

\brief Hide a window.

\sa SDL_ShowWindow()

fn SDL_RaiseWindow(window: SDL_Window*)

\brief Raise a window above other windows and set the input focus.

fn SDL_MaximizeWindow(window: SDL_Window*)

\brief Make a window as large as possible.

\sa SDL_RestoreWindow()

fn SDL_MinimizeWindow(window: SDL_Window*)

\brief Minimize a window to an iconic representation.

\sa SDL_RestoreWindow()

fn SDL_RestoreWindow(window: SDL_Window*)

\brief Restore the size and position of a minimized or maximized window.

\sa SDL_MaximizeWindow() \sa SDL_MinimizeWindow()

fn SDL_SetWindowFullscreen(window: SDL_Window*, flags: Uint32) i32

\brief Set a window's fullscreen state.

\return 0 on success, or -1 if setting the display mode failed.

\sa SDL_SetWindowDisplayMode() \sa SDL_GetWindowDisplayMode()

fn SDL_GetWindowSurface(window: SDL_Window*) SDL_Surface*

\brief Get the SDL surface associated with the window.

\return The window's framebuffer surface, or NULL on error.

A new surface will be created with the optimal format for the window, if necessary. This surface will be freed when the window is destroyed.

\note You may not combine this with 3D or the rendering API on this window.

\sa SDL_UpdateWindowSurface() \sa SDL_UpdateWindowSurfaceRects()

fn SDL_UpdateWindowSurface(window: SDL_Window*) i32

\brief Copy the window surface to the screen.

\return 0 on success, or -1 on error.

\sa SDL_GetWindowSurface() \sa SDL_UpdateWindowSurfaceRects()

fn SDL_UpdateWindowSurfaceRects(window: SDL_Window*, rects: const(const(SDL_Rect)*), numrects: i32) i32

\brief Copy a number of rectangles on the window surface to the screen.

\return 0 on success, or -1 on error.

\sa SDL_GetWindowSurface() \sa SDL_UpdateWindowSurfaceRect()

fn SDL_SetWindowGrab(window: SDL_Window*, grabbed: SDL_bool)

\brief Set a window's input grab mode.

\param window The window for which the input grab mode should be set. \param grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input.

\sa SDL_GetWindowGrab()

fn SDL_GetWindowGrab(window: SDL_Window*) SDL_bool

\brief Get a window's input grab mode.

\return This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise.

\sa SDL_SetWindowGrab()

fn SDL_SetWindowBrightness(window: SDL_Window*, brightness: f32) i32

\brief Set the brightness (gamma correction) for a window.

\return 0 on success, or -1 if setting the brightness isn't supported.

\sa SDL_GetWindowBrightness() \sa SDL_SetWindowGammaRamp()

fn SDL_GetWindowBrightness(window: SDL_Window*) f32

\brief Get the brightness (gamma correction) for a window.

\return The last brightness value passed to SDL_SetWindowBrightness()

\sa SDL_SetWindowBrightness()

fn SDL_SetWindowOpacity(window: SDL_Window*, opacity: f32) i32

\brief Set the opacity for a window

\param window The window which will be made transparent or opaque \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be clamped internally between 0.0f and 1.0f.

\return 0 on success, or -1 if setting the opacity isn't supported.

\sa SDL_GetWindowOpacity()

fn SDL_GetWindowOpacity(window: SDL_Window*, out_opacity: f32*) i32

\brief Get the opacity of a window.

If transparency isn't supported on this platform, opacity will be reported as 1.0f without error.

\param window The window in question. \param out_opacity Opacity (0.0f - transparent, 1.0f - opaque)

\return 0 on success, or -1 on error (invalid window, etc).

\sa SDL_SetWindowOpacity()

fn SDL_SetWindowModalFor(modal_window: SDL_Window*, parent_window: SDL_Window*) i32

\brief Sets the window as a modal for another window (TODO: reconsider this function and/or its name)

\param modal_window The window that should be modal \param parent_window The parent window

\return 0 on success, or -1 otherwise.

fn SDL_SetWindowInputFocus(window: SDL_Window*) i32

\brief Explicitly sets input focus to the window.

You almost certainly want SDL_RaiseWindow() instead of this function. Use this with caution, as you might give focus to a window that's completely obscured by other windows.

\param window The window that should get the input focus

\return 0 on success, or -1 otherwise. \sa SDL_RaiseWindow()

fn SDL_SetWindowGammaRamp(window: SDL_Window*, red: const(const(Uint16)*), green: const(const(Uint16)*), blue: const(const(Uint16)*)) i32

\brief Set the gamma ramp for a window.

\param window The window for which the gamma ramp should be set. \param red The translation table for the red channel, or NULL. \param green The translation table for the green channel, or NULL. \param blue The translation table for the blue channel, or NULL.

\return 0 on success, or -1 if gamma ramps are unsupported.

Set the gamma translation table for the red, green, and blue channels of the video hardware. Each table is an array of 256 16-bit quantities, representing a mapping between the input and output for that channel. The input is the index into the array, and the output is the 16-bit gamma value at that index, scaled to the output color precision.

\sa SDL_GetWindowGammaRamp()

fn SDL_GetWindowGammaRamp(window: SDL_Window*, red: Uint16*, green: Uint16*, blue: Uint16*) i32

\brief Get the gamma ramp for a window.

\param window The window from which the gamma ramp should be queried. \param red A pointer to a 256 element array of 16-bit quantities to hold the translation table for the red channel, or NULL. \param green A pointer to a 256 element array of 16-bit quantities to hold the translation table for the green channel, or NULL. \param blue A pointer to a 256 element array of 16-bit quantities to hold the translation table for the blue channel, or NULL.

\return 0 on success, or -1 if gamma ramps are unsupported.

\sa SDL_SetWindowGammaRamp()

fn SDL_DestroyWindow(window: SDL_Window*)

\brief Destroy a window.

fn SDL_IsScreenSaverEnabled() SDL_bool

\brief Returns whether the screensaver is currently enabled (default on).

\sa SDL_EnableScreenSaver() \sa SDL_DisableScreenSaver()

fn SDL_EnableScreenSaver()

\brief Allow the screen to be blanked by a screensaver

\sa SDL_IsScreenSaverEnabled() \sa SDL_DisableScreenSaver()

fn SDL_DisableScreenSaver()

\brief Prevent the screen from being blanked by a screensaver

\sa SDL_IsScreenSaverEnabled() \sa SDL_EnableScreenSaver()

fn SDL_GL_LoadLibrary(path: const(const(char)*)) i32

\name OpenGL support functions

\brief Dynamically load an OpenGL library.

\param path The platform dependent OpenGL library name, or NULL to open the default OpenGL library.

\return 0 on success, or -1 if the library couldn't be loaded.

This should be done after initializing the video driver, but before creating any OpenGL windows. If no OpenGL library is loaded, the default library will be loaded upon creation of the first OpenGL window.

\note If you do this, you need to retrieve all of the GL functions used in your program from the dynamic library using SDL_GL_GetProcAddress().

\sa SDL_GL_GetProcAddress() \sa SDL_GL_UnloadLibrary()

fn SDL_GL_GetProcAddress(proc: const(const(char)*)) void*

\brief Get the address of an OpenGL function.

fn SDL_GL_UnloadLibrary()

\brief Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().

\sa SDL_GL_LoadLibrary()

fn SDL_GL_ExtensionSupported(extension: const(const(char)*)) SDL_bool

\brief Return true if an OpenGL extension is supported for the current context.

fn SDL_GL_SetAttribute(attr: SDL_GLattr, value: i32) i32

\brief Set an OpenGL window attribute before window creation.

fn SDL_GL_GetAttribute(attr: SDL_GLattr, value: i32*) i32

\brief Get the actual value for an attribute from the current context.

fn SDL_GL_CreateContext(window: SDL_Window*) SDL_GLContext

\brief Create an OpenGL context for use with an OpenGL window, and make it current.

\sa SDL_GL_DeleteContext()

fn SDL_GL_MakeCurrent(window: SDL_Window*, context: SDL_GLContext) i32

\brief Set up an OpenGL context for rendering into an OpenGL window.

\note The context must have been created with a compatible window.

fn SDL_GL_GetCurrentWindow() SDL_Window*

\brief Get the currently active OpenGL window.

fn SDL_GL_GetCurrentContext() SDL_GLContext

\brief Get the currently active OpenGL context.

fn SDL_GL_SetSwapInterval(interval: i32) i32

\brief Set the swap interval for the current OpenGL context.

\param interval 0 for immediate updates, 1 for updates synchronized with the vertical retrace. If the system supports it, you may specify -1 to allow late swaps to happen immediately instead of waiting for the next retrace.

\return 0 on success, or -1 if setting the swap interval is not supported.

\sa SDL_GL_GetSwapInterval()

fn SDL_GL_GetSwapInterval() i32

\brief Get the swap interval for the current OpenGL context.

\return 0 if there is no vertical retrace synchronization, 1 if the buffer swap is synchronized with the vertical retrace, and -1 if late swaps happen immediately instead of waiting for the next retrace. If the system can't determine the swap interval, or there isn't a valid current context, this will return 0 as a safe default.

\sa SDL_GL_SetSwapInterval()

fn SDL_GL_SwapWindow(window: SDL_Window*)

\brief Swap the OpenGL buffers for a window, if double-buffering is supported.

fn SDL_GL_DeleteContext(context: SDL_GLContext)

\brief Delete an OpenGL context.

\sa SDL_GL_CreateContext()