#include "SDL_stdinc.h"
#include "SDL_pixels.h"
#include "SDL_rect.h"
#include "SDL_surface.h"
#include "begin_code.h"
#include "close_code.h"
Go to the source code of this file.
Classes | |
struct | SDL_DisplayMode |
The structure that defines a display mode. More... | |
Macros | |
#define | SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000 |
Used to indicate that you don't care what the window position is. | |
#define | SDL_WINDOWPOS_UNDEFINED_DISPLAY(X) (SDL_WINDOWPOS_UNDEFINED_MASK|(X)) |
#define | SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0) |
#define | SDL_WINDOWPOS_ISUNDEFINED(X) (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK) |
#define | SDL_WINDOWPOS_CENTERED_MASK 0x2FFF0000 |
Used to indicate that the window position should be centered. | |
#define | SDL_WINDOWPOS_CENTERED_DISPLAY(X) (SDL_WINDOWPOS_CENTERED_MASK|(X)) |
#define | SDL_WINDOWPOS_CENTERED SDL_WINDOWPOS_CENTERED_DISPLAY(0) |
#define | SDL_WINDOWPOS_ISCENTERED(X) (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK) |
Typedefs | |
typedef struct SDL_Window | SDL_Window |
The type used to identify a window. More... | |
typedef void * | SDL_GLContext |
An opaque handle to an OpenGL context. | |
typedef SDL_HitTestResult(SDLCALL * | SDL_HitTest )(SDL_Window *win, const SDL_Point *area, void *data) |
Callback used for hit-testing. More... | |
Enumerations | |
enum | SDL_WindowFlags { SDL_WINDOW_FULLSCREEN = 0x00000001, SDL_WINDOW_OPENGL = 0x00000002, SDL_WINDOW_SHOWN = 0x00000004, SDL_WINDOW_HIDDEN = 0x00000008, SDL_WINDOW_BORDERLESS = 0x00000010, SDL_WINDOW_RESIZABLE = 0x00000020, SDL_WINDOW_MINIMIZED = 0x00000040, SDL_WINDOW_MAXIMIZED = 0x00000080, SDL_WINDOW_INPUT_GRABBED = 0x00000100, SDL_WINDOW_INPUT_FOCUS = 0x00000200, SDL_WINDOW_MOUSE_FOCUS = 0x00000400, SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ), SDL_WINDOW_FOREIGN = 0x00000800, SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, SDL_WINDOW_MOUSE_CAPTURE = 0x00004000 } |
The flags on a window. More... | |
enum | SDL_WindowEventID { SDL_WINDOWEVENT_NONE, SDL_WINDOWEVENT_SHOWN, SDL_WINDOWEVENT_HIDDEN, SDL_WINDOWEVENT_EXPOSED, SDL_WINDOWEVENT_MOVED, SDL_WINDOWEVENT_RESIZED, SDL_WINDOWEVENT_SIZE_CHANGED, SDL_WINDOWEVENT_MINIMIZED, SDL_WINDOWEVENT_MAXIMIZED, SDL_WINDOWEVENT_RESTORED, SDL_WINDOWEVENT_ENTER, SDL_WINDOWEVENT_LEAVE, SDL_WINDOWEVENT_FOCUS_GAINED, SDL_WINDOWEVENT_FOCUS_LOST, SDL_WINDOWEVENT_CLOSE } |
Event subtype for window events. More... | |
enum | SDL_GLattr { SDL_GL_RED_SIZE, SDL_GL_GREEN_SIZE, SDL_GL_BLUE_SIZE, SDL_GL_ALPHA_SIZE, SDL_GL_BUFFER_SIZE, SDL_GL_DOUBLEBUFFER, SDL_GL_DEPTH_SIZE, SDL_GL_STENCIL_SIZE, SDL_GL_ACCUM_RED_SIZE, SDL_GL_ACCUM_GREEN_SIZE, SDL_GL_ACCUM_BLUE_SIZE, SDL_GL_ACCUM_ALPHA_SIZE, SDL_GL_STEREO, SDL_GL_MULTISAMPLEBUFFERS, SDL_GL_MULTISAMPLESAMPLES, SDL_GL_ACCELERATED_VISUAL, SDL_GL_RETAINED_BACKING, SDL_GL_CONTEXT_MAJOR_VERSION, SDL_GL_CONTEXT_MINOR_VERSION, SDL_GL_CONTEXT_EGL, SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_SHARE_WITH_CURRENT_CONTEXT, SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, SDL_GL_CONTEXT_RELEASE_BEHAVIOR } |
OpenGL configuration attributes. | |
enum | SDL_GLprofile { SDL_GL_CONTEXT_PROFILE_CORE = 0x0001, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002, SDL_GL_CONTEXT_PROFILE_ES = 0x0004 } |
enum | SDL_GLcontextFlag { SDL_GL_CONTEXT_DEBUG_FLAG = 0x0001, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002, SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = 0x0004, SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008 } |
enum | SDL_GLcontextReleaseFlag { SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = 0x0000, SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x0001 } |
enum | SDL_HitTestResult { SDL_HITTEST_NORMAL, SDL_HITTEST_DRAGGABLE, SDL_HITTEST_RESIZE_TOPLEFT, SDL_HITTEST_RESIZE_TOP, SDL_HITTEST_RESIZE_TOPRIGHT, SDL_HITTEST_RESIZE_RIGHT, SDL_HITTEST_RESIZE_BOTTOMRIGHT, SDL_HITTEST_RESIZE_BOTTOM, SDL_HITTEST_RESIZE_BOTTOMLEFT, SDL_HITTEST_RESIZE_LEFT } |
Possible return values from the SDL_HitTest callback. More... | |
Functions | |
DECLSPEC int SDLCALL | SDL_GetNumVideoDrivers (void) |
Get the number of video drivers compiled into SDL. More... | |
DECLSPEC const char *SDLCALL | SDL_GetVideoDriver (int index) |
Get the name of a built in video driver. More... | |
DECLSPEC int SDLCALL | SDL_VideoInit (const char *driver_name) |
Initialize the video subsystem, optionally specifying a video driver. More... | |
DECLSPEC void SDLCALL | SDL_VideoQuit (void) |
Shuts down the video subsystem. More... | |
DECLSPEC const char *SDLCALL | SDL_GetCurrentVideoDriver (void) |
Returns the name of the currently initialized video driver. More... | |
DECLSPEC int SDLCALL | SDL_GetNumVideoDisplays (void) |
Returns the number of available video displays. More... | |
DECLSPEC const char *SDLCALL | SDL_GetDisplayName (int displayIndex) |
Get the name of a display in UTF-8 encoding. More... | |
DECLSPEC int SDLCALL | SDL_GetDisplayBounds (int displayIndex, SDL_Rect *rect) |
Get the desktop area represented by a display, with the primary display located at 0,0. More... | |
DECLSPEC int SDLCALL | SDL_GetDisplayDPI (int displayIndex, float *ddpi, float *hdpi, float *vdpi) |
Get the dots/pixels-per-inch for a display. More... | |
DECLSPEC int SDLCALL | SDL_GetNumDisplayModes (int displayIndex) |
Returns the number of available display modes. More... | |
DECLSPEC int SDLCALL | SDL_GetDisplayMode (int displayIndex, int modeIndex, SDL_DisplayMode *mode) |
Fill in information about a specific display mode. More... | |
DECLSPEC int SDLCALL | SDL_GetDesktopDisplayMode (int displayIndex, SDL_DisplayMode *mode) |
Fill in information about the desktop display mode. | |
DECLSPEC int SDLCALL | SDL_GetCurrentDisplayMode (int displayIndex, SDL_DisplayMode *mode) |
Fill in information about the current display mode. | |
DECLSPEC SDL_DisplayMode *SDLCALL | SDL_GetClosestDisplayMode (int displayIndex, const SDL_DisplayMode *mode, SDL_DisplayMode *closest) |
Get the closest match to the requested display mode. More... | |
DECLSPEC int SDLCALL | SDL_GetWindowDisplayIndex (SDL_Window *window) |
Get the display index associated with a window. More... | |
DECLSPEC int SDLCALL | SDL_SetWindowDisplayMode (SDL_Window *window, const SDL_DisplayMode *mode) |
Set the display mode used when a fullscreen window is visible. More... | |
DECLSPEC int SDLCALL | SDL_GetWindowDisplayMode (SDL_Window *window, SDL_DisplayMode *mode) |
Fill in information about the display mode used when a fullscreen window is visible. More... | |
DECLSPEC Uint32 SDLCALL | SDL_GetWindowPixelFormat (SDL_Window *window) |
Get the pixel format associated with the window. | |
DECLSPEC SDL_Window *SDLCALL | SDL_CreateWindow (const char *title, int x, int y, int w, int h, Uint32 flags) |
Create a window with the specified position, dimensions, and flags. More... | |
DECLSPEC SDL_Window *SDLCALL | SDL_CreateWindowFrom (const void *data) |
Create an SDL window from an existing native window. More... | |
DECLSPEC Uint32 SDLCALL | SDL_GetWindowID (SDL_Window *window) |
Get the numeric ID of a window, for logging purposes. | |
DECLSPEC SDL_Window *SDLCALL | SDL_GetWindowFromID (Uint32 id) |
Get a window from a stored ID, or NULL if it doesn't exist. | |
DECLSPEC Uint32 SDLCALL | SDL_GetWindowFlags (SDL_Window *window) |
Get the window flags. | |
DECLSPEC void SDLCALL | SDL_SetWindowTitle (SDL_Window *window, const char *title) |
Set the title of a window, in UTF-8 format. More... | |
DECLSPEC const char *SDLCALL | SDL_GetWindowTitle (SDL_Window *window) |
Get the title of a window, in UTF-8 format. More... | |
DECLSPEC void SDLCALL | SDL_SetWindowIcon (SDL_Window *window, SDL_Surface *icon) |
Set the icon for a window. More... | |
DECLSPEC void *SDLCALL | SDL_SetWindowData (SDL_Window *window, const char *name, void *userdata) |
Associate an arbitrary named pointer with a window. More... | |
DECLSPEC void *SDLCALL | SDL_GetWindowData (SDL_Window *window, const char *name) |
Retrieve the data pointer associated with a window. More... | |
DECLSPEC void SDLCALL | SDL_SetWindowPosition (SDL_Window *window, int x, int y) |
Set the position of a window. More... | |
DECLSPEC void SDLCALL | SDL_GetWindowPosition (SDL_Window *window, int *x, int *y) |
Get the position of a window. More... | |
DECLSPEC void SDLCALL | SDL_SetWindowSize (SDL_Window *window, int w, int h) |
Set the size of a window's client area. More... | |
DECLSPEC void SDLCALL | SDL_GetWindowSize (SDL_Window *window, int *w, int *h) |
Get the size of a window's client area. More... | |
DECLSPEC void SDLCALL | SDL_SetWindowMinimumSize (SDL_Window *window, int min_w, int min_h) |
Set the minimum size of a window's client area. More... | |
DECLSPEC void SDLCALL | SDL_GetWindowMinimumSize (SDL_Window *window, int *w, int *h) |
Get the minimum size of a window's client area. More... | |
DECLSPEC void SDLCALL | SDL_SetWindowMaximumSize (SDL_Window *window, int max_w, int max_h) |
Set the maximum size of a window's client area. More... | |
DECLSPEC void SDLCALL | SDL_GetWindowMaximumSize (SDL_Window *window, int *w, int *h) |
Get the maximum size of a window's client area. More... | |
DECLSPEC void SDLCALL | SDL_SetWindowBordered (SDL_Window *window, SDL_bool bordered) |
Set the border state of a window. More... | |
DECLSPEC void SDLCALL | SDL_ShowWindow (SDL_Window *window) |
Show a window. More... | |
DECLSPEC void SDLCALL | SDL_HideWindow (SDL_Window *window) |
Hide a window. More... | |
DECLSPEC void SDLCALL | SDL_RaiseWindow (SDL_Window *window) |
Raise a window above other windows and set the input focus. | |
DECLSPEC void SDLCALL | SDL_MaximizeWindow (SDL_Window *window) |
Make a window as large as possible. More... | |
DECLSPEC void SDLCALL | SDL_MinimizeWindow (SDL_Window *window) |
Minimize a window to an iconic representation. More... | |
DECLSPEC void SDLCALL | SDL_RestoreWindow (SDL_Window *window) |
Restore the size and position of a minimized or maximized window. More... | |
DECLSPEC int SDLCALL | SDL_SetWindowFullscreen (SDL_Window *window, Uint32 flags) |
Set a window's fullscreen state. More... | |
DECLSPEC SDL_Surface *SDLCALL | SDL_GetWindowSurface (SDL_Window *window) |
Get the SDL surface associated with the window. More... | |
DECLSPEC int SDLCALL | SDL_UpdateWindowSurface (SDL_Window *window) |
Copy the window surface to the screen. More... | |
DECLSPEC int SDLCALL | SDL_UpdateWindowSurfaceRects (SDL_Window *window, const SDL_Rect *rects, int numrects) |
Copy a number of rectangles on the window surface to the screen. More... | |
DECLSPEC void SDLCALL | SDL_SetWindowGrab (SDL_Window *window, SDL_bool grabbed) |
Set a window's input grab mode. More... | |
DECLSPEC SDL_bool SDLCALL | SDL_GetWindowGrab (SDL_Window *window) |
Get a window's input grab mode. More... | |
DECLSPEC SDL_Window *SDLCALL | SDL_GetGrabbedWindow (void) |
Get the window that currently has an input grab enabled. More... | |
DECLSPEC int SDLCALL | SDL_SetWindowBrightness (SDL_Window *window, float brightness) |
Set the brightness (gamma correction) for a window. More... | |
DECLSPEC float SDLCALL | SDL_GetWindowBrightness (SDL_Window *window) |
Get the brightness (gamma correction) for a window. More... | |
DECLSPEC int SDLCALL | SDL_SetWindowGammaRamp (SDL_Window *window, const Uint16 *red, const Uint16 *green, const Uint16 *blue) |
Set the gamma ramp for a window. More... | |
DECLSPEC int SDLCALL | SDL_GetWindowGammaRamp (SDL_Window *window, Uint16 *red, Uint16 *green, Uint16 *blue) |
Get the gamma ramp for a window. More... | |
DECLSPEC int SDLCALL | SDL_SetWindowHitTest (SDL_Window *window, SDL_HitTest callback, void *callback_data) |
Provide a callback that decides if a window region has special properties. More... | |
DECLSPEC void SDLCALL | SDL_DestroyWindow (SDL_Window *window) |
Destroy a window. | |
DECLSPEC SDL_bool SDLCALL | SDL_IsScreenSaverEnabled (void) |
Returns whether the screensaver is currently enabled (default on). More... | |
DECLSPEC void SDLCALL | SDL_EnableScreenSaver (void) |
Allow the screen to be blanked by a screensaver. More... | |
DECLSPEC void SDLCALL | SDL_DisableScreenSaver (void) |
Prevent the screen from being blanked by a screensaver. More... | |
OpenGL support functions | |
DECLSPEC int SDLCALL | SDL_GL_LoadLibrary (const char *path) |
Dynamically load an OpenGL library. More... | |
DECLSPEC void *SDLCALL | SDL_GL_GetProcAddress (const char *proc) |
Get the address of an OpenGL function. | |
DECLSPEC void SDLCALL | SDL_GL_UnloadLibrary (void) |
Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary(). More... | |
DECLSPEC SDL_bool SDLCALL | SDL_GL_ExtensionSupported (const char *extension) |
Return true if an OpenGL extension is supported for the current context. | |
DECLSPEC void SDLCALL | SDL_GL_ResetAttributes (void) |
Reset all previously set OpenGL context attributes to their default values. | |
DECLSPEC int SDLCALL | SDL_GL_SetAttribute (SDL_GLattr attr, int value) |
Set an OpenGL window attribute before window creation. | |
DECLSPEC int SDLCALL | SDL_GL_GetAttribute (SDL_GLattr attr, int *value) |
Get the actual value for an attribute from the current context. | |
DECLSPEC SDL_GLContext SDLCALL | SDL_GL_CreateContext (SDL_Window *window) |
Create an OpenGL context for use with an OpenGL window, and make it current. More... | |
DECLSPEC int SDLCALL | SDL_GL_MakeCurrent (SDL_Window *window, SDL_GLContext context) |
Set up an OpenGL context for rendering into an OpenGL window. More... | |
DECLSPEC SDL_Window *SDLCALL | SDL_GL_GetCurrentWindow (void) |
Get the currently active OpenGL window. | |
DECLSPEC SDL_GLContext SDLCALL | SDL_GL_GetCurrentContext (void) |
Get the currently active OpenGL context. | |
DECLSPEC void SDLCALL | SDL_GL_GetDrawableSize (SDL_Window *window, int *w, int *h) |
Get the size of a window's underlying drawable in pixels (for use with glViewport). More... | |
DECLSPEC int SDLCALL | SDL_GL_SetSwapInterval (int interval) |
Set the swap interval for the current OpenGL context. More... | |
DECLSPEC int SDLCALL | SDL_GL_GetSwapInterval (void) |
Get the swap interval for the current OpenGL context. More... | |
DECLSPEC void SDLCALL | SDL_GL_SwapWindow (SDL_Window *window) |
Swap the OpenGL buffers for a window, if double-buffering is supported. | |
DECLSPEC void SDLCALL | SDL_GL_DeleteContext (SDL_GLContext context) |
Delete an OpenGL context. More... | |
Header file for SDL video functions.
typedef SDL_HitTestResult(SDLCALL * SDL_HitTest)(SDL_Window *win, const SDL_Point *area, void *data) |
Callback used for hit-testing.
typedef struct SDL_Window SDL_Window |
The type used to identify a window.
enum SDL_HitTestResult |
Possible return values from the SDL_HitTest callback.
Enumerator | |
---|---|
SDL_HITTEST_NORMAL |
Region is normal. No special properties. |
SDL_HITTEST_DRAGGABLE |
Region can drag entire window. |
enum SDL_WindowEventID |
Event subtype for window events.
enum SDL_WindowFlags |
The flags on a window.
DECLSPEC SDL_Window* SDLCALL SDL_CreateWindow | ( | const char * | title, |
int | x, | ||
int | y, | ||
int | w, | ||
int | h, | ||
Uint32 | flags | ||
) |
Create a window with the specified position, dimensions, and flags.
title | The title of the window, in UTF-8 encoding. |
x | The x position of the window, ::SDL_WINDOWPOS_CENTERED, or ::SDL_WINDOWPOS_UNDEFINED. |
y | The y position of the window, ::SDL_WINDOWPOS_CENTERED, or ::SDL_WINDOWPOS_UNDEFINED. |
w | The width of the window, in screen coordinates. |
h | The height of the window, in screen coordinates. |
flags | The flags for the window, a mask of any of the following: SDL_WINDOW_FULLSCREEN, SDL_WINDOW_OPENGL, SDL_WINDOW_HIDDEN, SDL_WINDOW_BORDERLESS, SDL_WINDOW_RESIZABLE, SDL_WINDOW_MAXIMIZED, SDL_WINDOW_MINIMIZED, SDL_WINDOW_INPUT_GRABBED, SDL_WINDOW_ALLOW_HIGHDPI. |
If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size in pixels may differ from its size in screen coordinates on platforms with high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query the client area's size in screen coordinates, and SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() to query the drawable size in pixels.
DECLSPEC SDL_Window* SDLCALL SDL_CreateWindowFrom | ( | const void * | data | ) |
Create an SDL window from an existing native window.
data | A pointer to driver-dependent window creation data |
Prevent the screen from being blanked by a screensaver.
Allow the screen to be blanked by a screensaver.
DECLSPEC SDL_DisplayMode* SDLCALL SDL_GetClosestDisplayMode | ( | int | displayIndex, |
const SDL_DisplayMode * | mode, | ||
SDL_DisplayMode * | closest | ||
) |
Get the closest match to the requested display mode.
displayIndex | The index of display from which mode should be queried. |
mode | The desired display mode |
closest | A pointer to a display mode to be filled in with the closest match of the available display modes. |
closest
, or NULL if no matching video mode was available.The available display modes are scanned, and 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.
DECLSPEC const char* SDLCALL SDL_GetCurrentVideoDriver | ( | void | ) |
Returns the name of the currently initialized video driver.
Get the desktop area represented by a display, with the primary display located at 0,0.
DECLSPEC int SDLCALL SDL_GetDisplayDPI | ( | int | displayIndex, |
float * | ddpi, | ||
float * | hdpi, | ||
float * | vdpi | ||
) |
Get the dots/pixels-per-inch for a display.
DECLSPEC int SDLCALL SDL_GetDisplayMode | ( | int | displayIndex, |
int | modeIndex, | ||
SDL_DisplayMode * | mode | ||
) |
Fill in information about a specific display mode.
DECLSPEC const char* SDLCALL SDL_GetDisplayName | ( | int | displayIndex | ) |
Get the name of a display in UTF-8 encoding.
DECLSPEC SDL_Window* SDLCALL SDL_GetGrabbedWindow | ( | void | ) |
Get the window that currently has an input grab enabled.
Returns the number of available display modes.
Returns the number of available video displays.
Get the number of video drivers compiled into SDL.
DECLSPEC const char* SDLCALL SDL_GetVideoDriver | ( | int | index | ) |
Get the name of a built in video driver.
DECLSPEC float SDLCALL SDL_GetWindowBrightness | ( | SDL_Window * | window | ) |
Get the brightness (gamma correction) for a window.
DECLSPEC void* SDLCALL SDL_GetWindowData | ( | SDL_Window * | window, |
const char * | name | ||
) |
Retrieve the data pointer associated with a window.
window | The window to query. |
name | The name of the pointer. |
DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex | ( | SDL_Window * | window | ) |
Get the display index associated with a window.
DECLSPEC int SDLCALL SDL_GetWindowDisplayMode | ( | SDL_Window * | window, |
SDL_DisplayMode * | mode | ||
) |
Fill in information about the display mode used when a fullscreen window is visible.
DECLSPEC int SDLCALL SDL_GetWindowGammaRamp | ( | SDL_Window * | window, |
Uint16 * | red, | ||
Uint16 * | green, | ||
Uint16 * | blue | ||
) |
Get the gamma ramp for a window.
window | The window from which the gamma ramp should be queried. |
red | A pointer to a 256 element array of 16-bit quantities to hold the translation table for the red channel, or NULL. |
green | A pointer to a 256 element array of 16-bit quantities to hold the translation table for the green channel, or NULL. |
blue | A pointer to a 256 element array of 16-bit quantities to hold the translation table for the blue channel, or NULL. |
DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab | ( | SDL_Window * | window | ) |
Get a window's input grab mode.
DECLSPEC void SDLCALL SDL_GetWindowMaximumSize | ( | SDL_Window * | window, |
int * | w, | ||
int * | h | ||
) |
Get the maximum size of a window's client area.
window | The window to query. |
w | Pointer to variable for storing the maximum width, may be NULL |
h | Pointer to variable for storing the maximum height, may be NULL |
DECLSPEC void SDLCALL SDL_GetWindowMinimumSize | ( | SDL_Window * | window, |
int * | w, | ||
int * | h | ||
) |
Get the minimum size of a window's client area.
window | The window to query. |
w | Pointer to variable for storing the minimum width, may be NULL |
h | Pointer to variable for storing the minimum height, may be NULL |
DECLSPEC void SDLCALL SDL_GetWindowPosition | ( | SDL_Window * | window, |
int * | x, | ||
int * | y | ||
) |
Get the position of a window.
window | The window to query. |
x | Pointer to variable for storing the x position, in screen coordinates. May be NULL. |
y | Pointer to variable for storing the y position, in screen coordinates. May be NULL. |
DECLSPEC void SDLCALL SDL_GetWindowSize | ( | SDL_Window * | window, |
int * | w, | ||
int * | h | ||
) |
Get the size of a window's client area.
window | The window to query. |
w | Pointer to variable for storing the width, in screen coordinates. May be NULL. |
h | Pointer to variable for storing the height, in screen coordinates. May be NULL. |
The window size in screen coordinates may differ from the size in pixels, if the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() to get the real client area size in pixels.
DECLSPEC SDL_Surface* SDLCALL SDL_GetWindowSurface | ( | SDL_Window * | window | ) |
Get the SDL surface associated with the window.
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.
DECLSPEC const char* SDLCALL SDL_GetWindowTitle | ( | SDL_Window * | window | ) |
Get the title of a window, in UTF-8 format.
DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext | ( | SDL_Window * | window | ) |
Create an OpenGL context for use with an OpenGL window, and make it current.
DECLSPEC void SDLCALL SDL_GL_DeleteContext | ( | SDL_GLContext | context | ) |
Delete an OpenGL context.
DECLSPEC void SDLCALL SDL_GL_GetDrawableSize | ( | SDL_Window * | window, |
int * | w, | ||
int * | h | ||
) |
Get the size of a window's underlying drawable in pixels (for use with glViewport).
window | Window from which the drawable size should be queried |
w | Pointer to variable for storing the width in pixels, may be NULL |
h | Pointer to variable for storing the height in pixels, may be NULL |
This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with high-DPI support (Apple calls this "Retina"), and not disabled by the SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.
Get the swap interval for the current OpenGL context.
DECLSPEC int SDLCALL SDL_GL_LoadLibrary | ( | const char * | path | ) |
Dynamically load an OpenGL library.
path | The platform dependent OpenGL library name, or NULL to open the default OpenGL library. |
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.
DECLSPEC int SDLCALL SDL_GL_MakeCurrent | ( | SDL_Window * | window, |
SDL_GLContext | context | ||
) |
Set up an OpenGL context for rendering into an OpenGL window.
Set the swap interval for the current OpenGL context.
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. |
Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
DECLSPEC void SDLCALL SDL_HideWindow | ( | SDL_Window * | window | ) |
Hide a window.
DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled | ( | void | ) |
Returns whether the screensaver is currently enabled (default on).
DECLSPEC void SDLCALL SDL_MaximizeWindow | ( | SDL_Window * | window | ) |
Make a window as large as possible.
DECLSPEC void SDLCALL SDL_MinimizeWindow | ( | SDL_Window * | window | ) |
Minimize a window to an iconic representation.
DECLSPEC void SDLCALL SDL_RestoreWindow | ( | SDL_Window * | window | ) |
Restore the size and position of a minimized or maximized window.
DECLSPEC void SDLCALL SDL_SetWindowBordered | ( | SDL_Window * | window, |
SDL_bool | bordered | ||
) |
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.
window | The window of which to change the border state. |
bordered | SDL_FALSE to remove border, SDL_TRUE to add border. |
DECLSPEC int SDLCALL SDL_SetWindowBrightness | ( | SDL_Window * | window, |
float | brightness | ||
) |
Set the brightness (gamma correction) for a window.
DECLSPEC void* SDLCALL SDL_SetWindowData | ( | SDL_Window * | window, |
const char * | name, | ||
void * | userdata | ||
) |
Associate an arbitrary named pointer with a window.
window | The window to associate with the pointer. |
name | The name of the pointer. |
userdata | The associated pointer. |
DECLSPEC int SDLCALL SDL_SetWindowDisplayMode | ( | SDL_Window * | window, |
const SDL_DisplayMode * | mode | ||
) |
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.
window | The window for which the display mode should be set. |
mode | The mode to use, or NULL for the default mode. |
DECLSPEC int SDLCALL SDL_SetWindowFullscreen | ( | SDL_Window * | window, |
Uint32 | flags | ||
) |
Set a window's fullscreen state.
DECLSPEC int SDLCALL SDL_SetWindowGammaRamp | ( | SDL_Window * | window, |
const Uint16 * | red, | ||
const Uint16 * | green, | ||
const Uint16 * | blue | ||
) |
Set the gamma ramp for a window.
window | The window for which the gamma ramp should be set. |
red | The translation table for the red channel, or NULL. |
green | The translation table for the green channel, or NULL. |
blue | The translation table for the blue channel, or NULL. |
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.
DECLSPEC void SDLCALL SDL_SetWindowGrab | ( | SDL_Window * | window, |
SDL_bool | grabbed | ||
) |
Set a window's input grab mode.
window | The window for which the input grab mode should be set. |
grabbed | This is SDL_TRUE to grab input, and SDL_FALSE to release input. |
If the caller enables a grab while another window is currently grabbed, the other window loses its grab in favor of the caller's window.
DECLSPEC int SDLCALL SDL_SetWindowHitTest | ( | SDL_Window * | window, |
SDL_HitTest | callback, | ||
void * | callback_data | ||
) |
Provide a callback that decides if a window region has special properties.
Normally windows are dragged and resized by decorations provided by the system window manager (a title bar, borders, etc), but for some apps, it makes sense to drag them from somewhere else inside the window itself; for example, one might have a borderless window that wants to be draggable from any part, or simulate its own title bar, etc.
This function lets the app provide a callback that designates pieces of a given window as special. This callback is run during event processing if we need to tell the OS to treat a region of the window specially; the use of this callback is known as "hit testing."
Mouse input may not be delivered to your application if it is within a special area; the OS will often apply that input to moving the window or resizing the window and not deliver it to the application.
Specifying NULL for a callback disables hit-testing. Hit-testing is disabled by default.
Platforms that don't support this functionality will return -1 unconditionally, even if you're attempting to disable hit-testing.
Your callback may fire at any time, and its firing does not indicate any specific behavior (for example, on Windows, this certainly might fire when the OS is deciding whether to drag your window, but it fires for lots of other reasons, too, some unrelated to anything you probably care about and when the mouse isn't actually at the location it is testing). Since this can fire at any time, you should try to keep your callback efficient, devoid of allocations, etc.
window | The window to set hit-testing on. |
callback | The callback to call when doing a hit-test. |
callback_data | An app-defined void pointer passed to the callback. |
DECLSPEC void SDLCALL SDL_SetWindowIcon | ( | SDL_Window * | window, |
SDL_Surface * | icon | ||
) |
Set the icon for a window.
window | The window for which the icon should be set. |
icon | The icon for the window. |
DECLSPEC void SDLCALL SDL_SetWindowMaximumSize | ( | SDL_Window * | window, |
int | max_w, | ||
int | max_h | ||
) |
Set the maximum size of a window's client area.
window | The window to set a new maximum size. |
max_w | The maximum width of the window, must be >0 |
max_h | The maximum height of the window, must be >0 |
DECLSPEC void SDLCALL SDL_SetWindowMinimumSize | ( | SDL_Window * | window, |
int | min_w, | ||
int | min_h | ||
) |
Set the minimum size of a window's client area.
window | The window to set a new minimum size. |
min_w | The minimum width of the window, must be >0 |
min_h | The minimum height of the window, must be >0 |
DECLSPEC void SDLCALL SDL_SetWindowPosition | ( | SDL_Window * | window, |
int | x, | ||
int | y | ||
) |
Set the position of a window.
window | The window to reposition. |
x | The x coordinate of the window in screen coordinates, or ::SDL_WINDOWPOS_CENTERED or ::SDL_WINDOWPOS_UNDEFINED. |
y | The y coordinate of the window in screen coordinates, or ::SDL_WINDOWPOS_CENTERED or ::SDL_WINDOWPOS_UNDEFINED. |
DECLSPEC void SDLCALL SDL_SetWindowSize | ( | SDL_Window * | window, |
int | w, | ||
int | h | ||
) |
Set the size of a window's client area.
window | The window to resize. |
w | The width of the window, in screen coordinates. Must be >0. |
h | The height of the window, in screen coordinates. Must be >0. |
The window size in screen coordinates may differ from the size in pixels, if the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() to get the real client area size in pixels.
DECLSPEC void SDLCALL SDL_SetWindowTitle | ( | SDL_Window * | window, |
const char * | title | ||
) |
Set the title of a window, in UTF-8 format.
DECLSPEC void SDLCALL SDL_ShowWindow | ( | SDL_Window * | window | ) |
Show a window.
DECLSPEC int SDLCALL SDL_UpdateWindowSurface | ( | SDL_Window * | window | ) |
Copy the window surface to the screen.
DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects | ( | SDL_Window * | window, |
const SDL_Rect * | rects, | ||
int | numrects | ||
) |
Copy a number of rectangles on the window surface to the screen.
DECLSPEC int SDLCALL SDL_VideoInit | ( | const char * | driver_name | ) |
Initialize the video subsystem, optionally specifying a video driver.
driver_name | Initialize a specific driver by name, or NULL for the default video driver. |
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.
Shuts down the video subsystem.
This function closes all windows, and restores the original video mode.