21 #include "../SDL_internal.h" 31 #include "../events/SDL_events_c.h" 32 #include "../timer/SDL_timer_c.h" 40 #if SDL_VIDEO_OPENGL_ES 45 #if SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL 49 #ifndef GL_CONTEXT_RELEASE_BEHAVIOR_KHR 50 #define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB 60 #if SDL_VIDEO_DRIVER_COCOA 63 #if SDL_VIDEO_DRIVER_X11 66 #if SDL_VIDEO_DRIVER_MIR 69 #if SDL_VIDEO_DRIVER_WAYLAND 72 #if SDL_VIDEO_DRIVER_VIVANTE 75 #if SDL_VIDEO_DRIVER_DIRECTFB 78 #if SDL_VIDEO_DRIVER_WINDOWS 81 #if SDL_VIDEO_DRIVER_WINRT 84 #if SDL_VIDEO_DRIVER_HAIKU 87 #if SDL_VIDEO_DRIVER_PANDORA 90 #if SDL_VIDEO_DRIVER_UIKIT 93 #if SDL_VIDEO_DRIVER_ANDROID 96 #if SDL_VIDEO_DRIVER_PSP 99 #if SDL_VIDEO_DRIVER_RPI 102 #if SDL_VIDEO_DRIVER_NACL 105 #if SDL_VIDEO_DRIVER_EMSCRIPTEN 106 &Emscripten_bootstrap,
108 #if SDL_VIDEO_DRIVER_DUMMY 116 #define CHECK_WINDOW_MAGIC(window, retval) \ 118 SDL_UninitializedVideo(); \ 121 if (!window || window->magic != &_this->window_magic) { \ 122 SDL_SetError("Invalid window"); \ 126 #define CHECK_DISPLAY_INDEX(displayIndex, retval) \ 128 SDL_UninitializedVideo(); \ 131 SDL_assert(_this->displays != NULL); \ 132 if (displayIndex < 0 || displayIndex >= _this->num_displays) { \ 133 SDL_SetError("displayIndex must be in the range 0 - %d", \ 134 _this->num_displays - 1); \ 138 #define FULLSCREEN_MASK (SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN) 149 #define SDL_WINDOWTEXTUREDATA "_SDL_WindowTextureData" 188 #if defined(__WIN32__) 193 #elif defined(__MACOSX__) 197 #elif defined(__LINUX__) 211 const char *vendor =
NULL;
214 if (glGetStringFunc) {
215 vendor = (
const char *) glGetStringFunc(
GL_VENDOR);
227 return hasAcceleratedOpenGL;
229 #elif SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 256 if (hint && *hint !=
'0' && *hint !=
'1' &&
281 return SDL_SetError(
"No hardware accelerated renderers available");
325 window->
w, window->
h);
339 *pitch = data->
pitch;
404 }
else if (a->
w != b->
w) {
406 }
else if (a->
h != b->
h) {
421 return SDL_SetError(
"Video subsystem has not been initialized");
456 #if !SDL_TIMERS_DISABLED 471 if (driver_name ==
NULL) {
474 if (driver_name !=
NULL) {
475 for (i = 0; bootstrap[
i]; ++
i) {
477 if (bootstrap[i]->available()) {
478 video = bootstrap[
i]->
create(index);
484 for (i = 0; bootstrap[
i]; ++
i) {
485 if (bootstrap[i]->available()) {
486 video = bootstrap[
i]->
create(index);
521 return SDL_SetError(
"The video driver did not add any displays");
543 if (!allow_screensaver) {
603 displays[
index] = *display;
636 for (displayIndex = 0; displayIndex < _this->
num_displays; ++displayIndex) {
637 if (display == &_this->
displays[displayIndex]) {
677 if (displayIndex == 0) {
697 display = &_this->
displays[displayIndex];
700 if (_this->
GetDisplayDPI(_this, display, ddpi, hdpi, vdpi) == 0) {
717 for (i = 0; i < nmodes; ++
i) {
718 if (
cmpmodes(mode, &modes[i]) == 0) {
734 modes[nmodes] = *
mode;
770 display = &_this->
displays[displayIndex];
772 return SDL_SetError(
"index must be in the range of 0 - %d",
788 display = &_this->
displays[displayIndex];
802 display = &_this->
displays[displayIndex];
815 int target_refresh_rate;
819 if (!mode || !closest) {
820 SDL_SetError(
"Missing desired mode or closest mode parameter");
826 target_format = mode->
format;
842 if (current->
w && (current->
w < mode->
w)) {
846 if (current->
h && (current->
h < mode->
h)) {
847 if (current->
w && (current->
w == mode->
w)) {
856 if (!match || current->
w < match->
w || current->
h < match->
h) {
862 if (current->
format == target_format ||
884 if (match->
w && match->
h) {
885 closest->
w = match->
w;
886 closest->
h = match->
h;
888 closest->
w = mode->
w;
889 closest->
h = mode->
h;
925 display = &_this->
displays[displayIndex];
936 display_mode = *
mode;
939 if (!display_mode.
format) {
942 if (!display_mode.
w) {
945 if (!display_mode.
h) {
954 return SDL_SetError(
"No video mode large enough for %dx%d",
955 display_mode.
w, display_mode.
h);
963 if (
SDL_memcmp(&display_mode, ¤t_mode,
sizeof(display_mode)) == 0) {
969 return SDL_SetError(
"Video driver doesn't support changing display mode");
984 int closest_dist = 0x7FFFFFFF;
993 displayIndex = (window->
x & 0xFFFF);
1001 displayIndex = (window->
y & 0xFFFF);
1005 return displayIndex;
1016 center.
x = window->
x + window->
w / 2;
1017 center.
y = window->
y + window->
h / 2;
1024 delta.
x = center.
x - (rect.
x + rect.
w / 2);
1025 delta.
y = center.
y - (rect.
y + rect.
h / 2);
1026 dist = (delta.
x*delta.
x + delta.
y*delta.
y);
1027 if (dist < closest_dist) {
1029 closest_dist = dist;
1042 if (displayIndex >= 0) {
1043 return &_this->
displays[displayIndex];
1082 if (!fullscreen_mode.
w) {
1085 if (!fullscreen_mode.
h) {
1096 &fullscreen_mode)) {
1097 return SDL_SetError(
"Couldn't find display mode match");
1101 *mode = fullscreen_mode;
1153 if (!Cocoa_SetWindowFullscreenSpace(window,
SDL_FALSE)) {
1164 if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) {
1165 if (Cocoa_IsWindowInFullscreenSpace(window) != fullscreen) {
1171 #elif __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10) 1215 for (other = _this->
windows; other; other = other->
next) {
1218 if (other == window) {
1219 setDisplayMode = fullscreen;
1225 if (setDisplayMode) {
1233 if (other->
w == fullscreen_mode.
w && other->
h == fullscreen_mode.
h) {
1256 fullscreen_mode.
w, fullscreen_mode.
h);
1287 #define CREATE_FLAGS \ 1288 (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI) 1337 if ((w > 16384) || (h > 16384)) {
1343 #if (SDL_VIDEO_OPENGL && __MACOSX__) || __IPHONEOS__ || __ANDROID__ || __NACL__ 1362 flags &= ~SDL_WINDOW_ALLOW_HIGHDPI;
1386 window->
x = bounds.
x + (bounds.
w -
w) / 2;
1389 window->
y = bounds.
y + (bounds.
h -
h) / 2;
1408 #if __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10) 1417 flags = window->
flags;
1474 return SDL_SetError(
"No OpenGL support in video driver");
1500 if ((window->
flags & SDL_WINDOW_OPENGL) != (flags & SDL_WINDOW_OPENGL)) {
1501 if (flags & SDL_WINDOW_OPENGL) {
1515 if (_this->
CreateWindow && !(flags & SDL_WINDOW_FOREIGN)) {
1517 if (loaded_opengl) {
1519 window->
flags &= ~SDL_WINDOW_OPENGL;
1525 if (flags & SDL_WINDOW_FOREIGN) {
1562 for (window = _this->
windows; window; window = window->
next) {
1563 if (window->
id ==
id) {
1575 return window->
flags;
1583 if (title == window->
title) {
1616 if (!window->
icon) {
1633 if (name ==
NULL || name[0] ==
'\0') {
1640 for (data = window->
data; data; prev = data, data = data->
next) {
1642 void *last_value = data->
data;
1646 data->
data = userdata;
1665 data->
data = userdata;
1680 if (name ==
NULL || name[0] ==
'\0') {
1685 for (data = window->
data; data; data = data->
next) {
1699 int displayIndex = (x & 0xFFFF);
1709 x = bounds.
x + (bounds.
w - window->
w) / 2;
1712 y = bounds.
y + (bounds.
h - window->
h) / 2;
1757 if (displayIndex >= 0) {
1785 const int want = (bordered !=
SDL_FALSE);
1843 if (window->
w == w && window->
h == h) {
1876 window->
min_w = min_w;
1877 window->
min_h = min_h;
1891 *min_w = window->
min_w;
1894 *min_h = window->
min_h;
1912 window->
max_w = max_w;
1913 window->
max_h = max_h;
1927 *max_w = window->
max_w;
1930 *max_h = window->
max_h;
2049 window->
flags |= oldflags;
2060 Uint32 Rmask, Gmask, Bmask, Amask;
2105 full_rect.
w = window->
w;
2106 full_rect.
h = window->
h;
2117 return SDL_SetError(
"Window surface is invalid, please call SDL_GetWindowSurface() to get a new surface");
2158 if (!window->
gamma) {
2188 if (!window->
gamma) {
2192 if (!window->
gamma) {
2203 for (i = 0; i < 256; ++
i) {
2240 if (grabbed_window && (grabbed_window != window)) {
2248 }
else if (grabbed_window == window) {
2369 if (Cocoa_IsWindowInFullscreenSpace(window)) {
2410 for (window = _this->
windows; window; window = window->
next) {
2471 while (window->
data) {
2596 return SDL_SetError(
"No dynamic GL support in video driver");
2652 return (verstr && (
SDL_atoi(verstr) >= 3));
2658 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 2660 const char *extensions;
2662 const char *where, *terminator;
2666 if (where || *extension ==
'\0') {
2671 if (start && *start ==
'0') {
2678 if (!glGetStringFunc) {
2690 if ((!glGetStringiFunc) || (!glGetIntegervFunc)) {
2694 #ifndef GL_NUM_EXTENSIONS 2695 #define GL_NUM_EXTENSIONS 0x821D 2698 for (i = 0; i < num_exts; i++) {
2699 const char *thisext = (
const char *) glGetStringiFunc(
GL_EXTENSIONS, i);
2727 if (where == start || *(where - 1) ==
' ')
2728 if (*terminator ==
' ' || *terminator ==
'\0')
2764 #if SDL_VIDEO_OPENGL 2767 #elif SDL_VIDEO_OPENGL_ES2 2771 #elif SDL_VIDEO_OPENGL_ES 2786 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 2864 retval =
SDL_SetError(
"Unknown OpenGL context flag %d", value);
2874 retval =
SDL_SetError(
"Unknown OpenGL context profile %d", value);
2901 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 2912 #if SDL_VIDEO_OPENGL 2916 GLenum attachmentattrib = 0;
2924 #if SDL_VIDEO_OPENGL 2930 #if SDL_VIDEO_OPENGL 2936 #if SDL_VIDEO_OPENGL 2942 #if SDL_VIDEO_OPENGL 2948 #if SDL_VIDEO_OPENGL 2959 #if SDL_VIDEO_OPENGL 2966 #if SDL_VIDEO_OPENGL 2972 #if SDL_VIDEO_OPENGL 3005 #if SDL_VIDEO_OPENGL 3013 int rsize = 0, gsize = 0, bsize = 0, asize = 0;
3029 *value = rsize + gsize + bsize + asize;
3088 #if SDL_VIDEO_OPENGL 3090 if (!glGetStringFunc) {
3091 return SDL_SetError(
"Failed getting OpenGL glGetString entry point");
3095 glGetFramebufferAttachmentParameterivFunc =
SDL_GL_GetProcAddress(
"glGetFramebufferAttachmentParameteriv");
3097 if (glGetFramebufferAttachmentParameterivFunc) {
3098 glGetFramebufferAttachmentParameterivFunc(
GL_FRAMEBUFFER, attachment, attachmentattrib, (
GLint *) value);
3100 return SDL_SetError(
"Failed getting OpenGL glGetFramebufferAttachmentParameteriv entry point");
3107 if (glGetIntegervFunc) {
3108 glGetIntegervFunc(attrib, (
GLint *) value);
3110 return SDL_SetError(
"Failed getting OpenGL glGetIntegerv entry point");
3115 if (!glGetErrorFunc) {
3116 return SDL_SetError(
"Failed getting OpenGL glGetError entry point");
3119 error = glGetErrorFunc();
3141 SDL_SetError(
"The specified window isn't an OpenGL window");
3174 return SDL_SetError(
"The specified window isn't an OpenGL window");
3225 return SDL_SetError(
"No OpenGL context has been made current");
3229 return SDL_SetError(
"Setting the swap interval is not supported");
3253 SDL_SetError(
"The specified window isn't an OpenGL window");
3258 SDL_SetError(
"The specified window has not been made current");
3268 if (!_this || !context) {
3289 #define SET_MASKBIT(icon, x, y, mask) \ 3290 mask[(y*((icon->w+7)/8))+(x/8)] &= ~(0x01<<(7-(x%8))) 3292 colorkey = icon->
format->colorkey;
3297 for (y = 0; y < icon->
h; ++
y) {
3299 for (x = 0; x < icon->
w; ++
x) {
3300 if (*pixels++ == colorkey) {
3301 SET_MASKBIT(icon, x, y,
mask);
3311 for (y = 0; y < icon->
h; ++
y) {
3313 for (x = 0; x < icon->
w; ++
x) {
3314 if ((flags & 1) && *pixels == colorkey) {
3315 SET_MASKBIT(icon, x, y,
mask);
3316 }
else if ((flags & 2)
3318 SET_MASKBIT(icon, x, y,
mask);
3329 for (y = 0; y < icon->
h; ++
y) {
3331 for (x = 0; x < icon->
w; ++
x) {
3332 if ((flags & 1) && *pixels == colorkey) {
3333 SET_MASKBIT(icon, x, y,
mask);
3334 }
else if ((flags & 2)
3336 SET_MASKBIT(icon, x, y,
mask);
3352 if (icon && _this->SetIcon) {
3355 int mask_len = icon->
h * (icon->
w + 7) / 8;
3362 if (icon->
flags & SDL_SRCCOLORKEY)
3364 if (icon->
flags & SDL_SRCALPHA)
3367 CreateMaskFromColorKeyOrAlpha(icon, mask, flags);
3369 _this->SetIcon(_this, icon, mask);
3372 _this->SetIcon(_this, icon, mask);
3470 #if SDL_VIDEO_DRIVER_ANDROID 3473 #if SDL_VIDEO_DRIVER_WINDOWS 3476 #if SDL_VIDEO_DRIVER_WINRT 3479 #if SDL_VIDEO_DRIVER_COCOA 3482 #if SDL_VIDEO_DRIVER_UIKIT 3485 #if SDL_VIDEO_DRIVER_X11 3513 int show_cursor_prev;
3517 if (!messageboxdata) {
3530 buttonid = &dummybutton;
3538 #if SDL_VIDEO_DRIVER_ANDROID 3540 Android_ShowMessageBox(messageboxdata, buttonid) == 0) {
3544 #if SDL_VIDEO_DRIVER_WINDOWS 3547 WIN_ShowMessageBox(messageboxdata, buttonid) == 0) {
3551 #if SDL_VIDEO_DRIVER_WINRT 3554 WINRT_ShowMessageBox(messageboxdata, buttonid) == 0) {
3558 #if SDL_VIDEO_DRIVER_COCOA 3561 Cocoa_ShowMessageBox(messageboxdata, buttonid) == 0) {
3565 #if SDL_VIDEO_DRIVER_UIKIT 3568 UIKit_ShowMessageBox(messageboxdata, buttonid) == 0) {
3572 #if SDL_VIDEO_DRIVER_X11 3575 X11_ShowMessageBox(messageboxdata, buttonid) == 0) {
3583 if (current_window) {
3585 if (mouse_captured) {
3651 float den2 = hinches * hinches + vinches * vinches;
3652 if ( den2 <= 0.0
f ) {
3656 return (
float)(
SDL_sqrt((
double)hpix * (
double)hpix + (
double)vpix * (
double)vpix) /
#define SDL_CreateTexture
#define SDL_WINDOWPOS_ISUNDEFINED(X)
static int SDL_GetNumDisplayModesForDisplay(SDL_VideoDisplay *display)
void SDL_GL_ResetAttributes()
Reset all previously set OpenGL context attributes to their default values.
SDL_Window * SDL_GetFocusWindow(void)
#define SDL_RenderSetViewport
void * SDL_GetWindowData(SDL_Window *window, const char *name)
Retrieve the data pointer associated with a window.
void SDL_OnWindowShown(SDL_Window *window)
int(* GetDisplayDPI)(_THIS, SDL_VideoDisplay *display, float *ddpi, float *hdpi, float *vdpi)
#define SDL_ConvertSurfaceFormat
void SDL_OnWindowLeave(SDL_Window *window)
#define GL_SAMPLE_BUFFERS
int SDL_GetNumVideoDrivers(void)
Get the number of video drivers compiled into SDL.
SDL_Mouse * SDL_GetMouse(void)
void SDL_OnWindowFocusGained(SDL_Window *window)
void(* RestoreWindow)(_THIS, SDL_Window *window)
#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR
const char * SDL_GetWindowTitle(SDL_Window *window)
Get the title of a window, in UTF-8 format.
void SDL_SetWindowSize(SDL_Window *window, int w, int h)
Set the size of a window's client area.
void SDL_SetKeyboardFocus(SDL_Window *window)
SDL_DisplayMode fullscreen_mode
void 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).
uint32_t Uint32
An unsigned 32-bit integer type.
int(* SetWindowHitTest)(SDL_Window *window, SDL_bool enabled)
#define SDL_PIXELLAYOUT(X)
GLuint GLsizei const GLchar * message
void SDL_VideoQuit(void)
Shuts down the video subsystem.
static SDL_UNUSED SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype)
#define FULLSCREEN_VISIBLE(W)
SDL_bool(* IsScreenKeyboardShown)(_THIS, SDL_Window *window)
SDL_bool SDL_IsScreenKeyboardShown(SDL_Window *window)
Returns whether the screen keyboard is shown for given window.
int SDL_GetDisplayMode(int displayIndex, int index, SDL_DisplayMode *mode)
Fill in information about a specific display mode.
int(* CreateWindowFrom)(_THIS, SDL_Window *window, const void *data)
void SDL_ShowWindow(SDL_Window *window)
Show a window.
SDL_TLSID current_glwin_tls
#define SDL_GetNumRenderDrivers
int SDL_GL_SetSwapInterval(int interval)
Set the swap interval for the current OpenGL context.
#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS
Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true...
#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER
A variable controlling whether the screensaver is enabled.
static void SDL_RestoreMousePosition(SDL_Window *window)
int SDL_UpdateWindowSurfaceRects(SDL_Window *window, const SDL_Rect *rects, int numrects)
Copy a number of rectangles on the window surface to the screen.
#define SDL_QuitSubSystem
#define SDL_HINT_VIDEO_HIGHDPI_DISABLED
If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and iOS)
int SDL_GL_LoadLibrary(const char *path)
Dynamically load an OpenGL library.
The structure that defines a point.
A collection of pixels used in software blitting.
int(* GL_SetSwapInterval)(_THIS, int interval)
#define GL_CONTEXT_RELEASE_BEHAVIOR
SDL_bool SDL_IsScreenSaverEnabled()
Returns whether the screensaver is currently enabled (default on).
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
void SDL_GetWindowPosition(SDL_Window *window, int *x, int *y)
Get the position of a window.
void SDL_SetWindowTitle(SDL_Window *window, const char *title)
Set the title of a window, in UTF-8 format.
void SDL_GL_DeleteContext(SDL_GLContext context)
Delete an OpenGL context.
#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE
void(* ShowWindow)(_THIS, SDL_Window *window)
Uint32 texture_formats[16]
The structure that defines a display mode.
void SDL_SetWindowGrab(SDL_Window *window, SDL_bool grabbed)
Set a window's input grab mode.
#define SDL_WINDOWPOS_ISCENTERED(X)
SDL_HitTestResult(* SDL_HitTest)(SDL_Window *win, const SDL_Point *area, void *data)
Callback used for hit-testing.
void(* StartTextInput)(_THIS)
void SDL_OnWindowMinimized(SDL_Window *window)
void(* SetWindowSize)(_THIS, SDL_Window *window)
#define SDL_BYTESPERPIXEL(X)
#define SDL_InitSubSystem
SDL_Window * SDL_GetWindowFromID(Uint32 id)
Get a window from a stored ID, or NULL if it doesn't exist.
#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
void SDL_SetWindowMinimumSize(SDL_Window *window, int min_w, int min_h)
Set the minimum size of a window's client area.
GLuint const GLchar * name
int SDL_SetWindowBrightness(SDL_Window *window, float brightness)
Set the brightness (gamma correction) for a window.
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
#define SDL_SetRelativeMouseMode
float SDL_GetWindowBrightness(SDL_Window *window)
Get the brightness (gamma correction) for a window.
#define SDL_ISPIXELFORMAT_ALPHA(format)
void SDL_SetMouseFocus(SDL_Window *window)
void(* GL_SwapWindow)(_THIS, SDL_Window *window)
int SDL_SetWindowHitTest(SDL_Window *window, SDL_HitTest callback, void *userdata)
Provide a callback that decides if a window region has special properties.
int SDL_KeyboardInit(void)
void SDL_HideWindow(SDL_Window *window)
Hide a window.
#define SDL_GetKeyboardFocus
#define SDL_InvalidParamError(param)
#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE
#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE
GLint GLint GLint GLint GLint x
#define SDL_GetRenderDriverInfo
SDL_Surface * SDL_GetWindowSurface(SDL_Window *window)
Get the SDL surface associated with the window.
SDL_Window * SDL_CreateWindowFrom(const void *data)
Create an SDL window from an existing native window.
void SDL_MinimizeWindow(SDL_Window *window)
Minimize a window to an iconic representation.
SDL_GLContext SDL_GL_CreateContext(SDL_Window *window)
Create an OpenGL context for use with an OpenGL window, and make it current.
#define SDL_CreateRGBSurfaceFrom
#define SDL_UpdateTexture
#define GL_ACCUM_ALPHA_BITS
int(* GL_LoadLibrary)(_THIS, const char *path)
SDL_DisplayMode * SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
Get the closest match to the requested display mode.
int SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode *mode)
Fill in information about the desktop display mode.
int SDL_GL_GetSwapInterval(void)
Get the swap interval for the current OpenGL context.
int(* SetDisplayMode)(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
void SDL_RaiseWindow(SDL_Window *window)
Raise a window above other windows and set the input focus.
void(* SetWindowBordered)(_THIS, SDL_Window *window, SDL_bool bordered)
void(* GL_GetDrawableSize)(_THIS, SDL_Window *window, int *w, int *h)
#define SDL_VERSION(x)
Macro to determine SDL version program was compiled against.
Uint32 SDL_GetWindowFlags(SDL_Window *window)
Get the window flags.
static SDL_VideoDevice * _this
SDL_GLattr
OpenGL configuration attributes.
void(* HideWindow)(_THIS, SDL_Window *window)
void SDL_OnWindowRestored(SDL_Window *window)
#define GL_NUM_EXTENSIONS
const char * SDL_GetCurrentVideoDriver()
Returns the name of the currently initialized video driver.
const char * SDL_GetVideoDriver(int index)
Get the name of a built in video driver.
void(* RaiseWindow)(_THIS, SDL_Window *window)
struct SDL_WindowUserData * next
static SDL_INLINE SDL_bool isAtLeastGL3(const char *verstr)
#define SDL_GetRelativeMouseMode
int SDL_GetWindowDisplayMode(SDL_Window *window, SDL_DisplayMode *mode)
Fill in information about the display mode used when a fullscreen window is visible.
void(* SetTextInputRect)(_THIS, SDL_Rect *rect)
void * SDL_calloc(size_t nmemb, size_t size)
const char * SDL_GetDisplayName(int displayIndex)
Get the name of a display in UTF-8 encoding.
SDL_bool SDL_ShouldAllowTopmost(void)
void * SDL_GLContext
An opaque handle to an OpenGL context.
void * SDL_SetWindowData(SDL_Window *window, const char *name, void *userdata)
Associate an arbitrary named pointer with a window.
SDL_VideoDisplay * SDL_GetDisplayForWindow(SDL_Window *window)
SDL_bool(* GetWindowWMInfo)(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
static int SDL_UpdateWindowTexture(SDL_VideoDevice *unused, SDL_Window *window, const SDL_Rect *rects, int numrects)
SDL_GLContext current_glctx
SDL_GLContext(* GL_CreateContext)(_THIS, SDL_Window *window)
int SDL_SetWindowDisplayMode(SDL_Window *window, const SDL_DisplayMode *mode)
Set the display mode used when a fullscreen window is visible.
#define SDL_GetEventState(type)
static int cmpmodes(const void *A, const void *B)
GLsizei const GLfloat * value
#define SDL_WINDOWTEXTUREDATA
int(* GL_MakeCurrent)(_THIS, SDL_Window *window, SDL_GLContext context)
uint8_t Uint8
An unsigned 8-bit integer type.
void SDL_SetWindowMaximumSize(SDL_Window *window, int max_w, int max_h)
Set the maximum size of a window's client area.
void SDL_OnWindowEnter(SDL_Window *window)
SDL_Window * 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.
void SDL_DestroyWindow(SDL_Window *window)
Destroy a window.
int SDL_GL_MakeCurrent(SDL_Window *window, SDL_GLContext ctx)
Set up an OpenGL context for rendering into an OpenGL window.
void SDL_GL_UnloadLibrary(void)
Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
#define SDL_HINT_ALLOW_TOPMOST
If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it...
SDL_DisplayMode * display_modes
SDL_bool SDL_GetWindowGrab(SDL_Window *window)
Get a window's input grab mode.
void SDL_UpdateWindowGrab(SDL_Window *window)
void(* SetWindowMinimumSize)(_THIS, SDL_Window *window)
Uint32 SDL_GetWindowPixelFormat(SDL_Window *window)
Get the pixel format associated with the window.
SDL_DisplayMode current_mode
SDL_VideoDisplay * displays
int(* GetDisplayBounds)(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
void(* DestroyWindow)(_THIS, SDL_Window *window)
void(* StopTextInput)(_THIS)
void SDL_GetWindowSize(SDL_Window *window, int *w, int *h)
Get the size of a window's client area.
static Uint32 callback(Uint32 interval, void *param)
void(* SetWindowIcon)(_THIS, SDL_Window *window, SDL_Surface *icon)
Uint32 WINRT_DetectWindowFlags(SDL_Window *window)
int SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode *mode)
Fill in information about the current display mode.
int SDL_SetWindowGammaRamp(SDL_Window *window, const Uint16 *red, const Uint16 *green, const Uint16 *blue)
Set the gamma ramp for a window.
#define GL_ACCUM_RED_BITS
#define SDL_PixelFormatEnumToMasks
void SDL_StopTextInput(void)
Stop receiving any text input events. This function will hide the on-screen keyboard if supported...
static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
int SDL_GetDisplayBounds(int displayIndex, SDL_Rect *rect)
Get the desktop area represented by a display, with the primary display located at 0...
static int SDL_CreateWindowTexture(SDL_VideoDevice *unused, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
int SDL_AddBasicVideoDisplay(const SDL_DisplayMode *desktop_mode)
int framebuffer_srgb_capable
const SDL_MessageBoxButtonData * buttons
MessageBox structure containing title, text, window, etc.
SDL_bool(* HasScreenKeyboardSupport)(_THIS)
void SDL_MaximizeWindow(SDL_Window *window)
Make a window as large as possible.
static void SDL_DestroyWindowTexture(SDL_VideoDevice *unused, SDL_Window *window)
void SDL_KeyboardQuit(void)
#define GL_ACCUM_GREEN_BITS
void SDL_RestoreWindow(SDL_Window *window)
Restore the size and position of a minimized or maximized window.
void SDL_StartTextInput(void)
Start accepting Unicode text input events. This function will show the on-screen keyboard if supporte...
static int SDL_SetDisplayModeForDisplay(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
SDL_Window * fullscreen_window
void(* DestroyWindowFramebuffer)(_THIS, SDL_Window *window)
int SDL_GetNumVideoDisplays(void)
Returns the number of available video displays.
SDL_VideoDevice * SDL_GetVideoDevice(void)
void(* GL_UnloadLibrary)(_THIS)
struct SDL_VideoDevice::@27 gl_config
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
int share_with_current_context
int SDL_GetDisplayDPI(int displayIndex, float *ddpi, float *hdpi, float *vdpi)
Get the dots/pixels-per-inch for a display.
#define SDL_assert(condition)
void(* GetDisplayModes)(_THIS, SDL_VideoDisplay *display)
int(* ShowMessageBox)(_THIS, const SDL_MessageBoxData *messageboxdata, int *buttonid)
int SDL_AddVideoDisplay(const SDL_VideoDisplay *display)
void(* SetWindowMaximumSize)(_THIS, SDL_Window *window)
#define SDL_OutOfMemory()
SDL_DisplayMode desktop_mode
#define SDL_GetMouseFocus
SDL_bool SDL_GetWindowWMInfo(SDL_Window *window, struct SDL_SysWMinfo *info)
This function allows access to driver-dependent window information.
SDL_bool SDL_IsTextInputActive(void)
Return whether or not Unicode text input events are enabled.
void * SDL_GetDisplayDriverData(int displayIndex)
void SDL_SetWindowBordered(SDL_Window *window, SDL_bool bordered)
Set the border state of a window.
Uint32 last_fullscreen_flags
Information on the capabilities of a render driver or context.
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 void
void SDL_SetWindowIcon(SDL_Window *window, SDL_Surface *icon)
Set the icon for a window.
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
SDL_Window * SDL_GetGrabbedWindow(void)
Get the window that currently has an input grab enabled.
GLint GLint GLint GLint GLint GLint y
float SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches)
static SDL_bool ShouldUseTextureFramebuffer()
#define SDL_DestroyTexture
void(* SetWindowPosition)(_THIS, SDL_Window *window)
void SDL_GetWindowMaximumSize(SDL_Window *window, int *max_w, int *max_h)
Get the maximum size of a window's client area.
#define GL_ACCUM_BLUE_BITS
int SDL_VideoInit(const char *driver_name)
Initialize the video subsystem, optionally specifying a video driver.
void(* ShowScreenKeyboard)(_THIS, SDL_Window *window)
SDL_TLSID current_glctx_tls
int(* CreateWindow)(_THIS, SDL_Window *window)
The type used to identify a window.
int(* GetWindowGammaRamp)(_THIS, SDL_Window *window, Uint16 *ramp)
void SDL_ResetKeyboard(void)
SDL_Rect rects[MAX_RECTS]
#define SDL_HINT_FRAMEBUFFER_ACCELERATION
A variable controlling how 3D acceleration is used to accelerate the SDL screen surface.
int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
Create a modal message box.
static void SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags)
void(* MinimizeWindow)(_THIS, SDL_Window *window)
SDL_VideoDevice *(* create)(int devindex)
int SDL_GL_SetAttribute(SDL_GLattr attr, int value)
Set an OpenGL window attribute before window creation.
SDL_GLContext SDL_GL_GetCurrentContext(void)
Get the currently active OpenGL context.
#define SDL_HINT_RENDER_DRIVER
A variable specifying which render driver to use.
static int SDL_UninitializedVideo()
SDL_bool SDL_GL_ExtensionSupported(const char *extension)
Return true if an OpenGL extension is supported for the current context.
static VideoBootStrap * bootstrap[]
void * SDL_GL_GetProcAddress(const char *proc)
Get the address of an OpenGL function.
uint16_t Uint16
An unsigned 16-bit integer type.
Uint32 num_texture_formats
SDL_Window * grabbed_window
#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE
int SDL_UpdateWindowSurface(SDL_Window *window)
Copy the window surface to the screen.
SDL_bool suspend_screensaver
#define SDL_arraysize(array)
static SDL_DisplayMode * SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay *display, const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
void(* SetWindowFullscreen)(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
int SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
Get the actual value for an attribute from the current context.
void SDL_OnWindowHidden(SDL_Window *window)
#define SDL_CalculateGammaRamp
int SDL_GetWindowGammaRamp(SDL_Window *window, Uint16 *red, Uint16 *green, Uint16 *blue)
Get the gamma ramp for a window.
GLsizei const GLchar *const * path
GLubyte GLubyte GLubyte GLubyte w
#define SDL_WarpMouseInWindow
int(* UpdateWindowFramebuffer)(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
#define CHECK_DISPLAY_INDEX(displayIndex, retval)
void SDL_GL_SwapWindow(SDL_Window *window)
Swap the OpenGL buffers for a window, if double-buffering is supported.
#define SDL_DestroyRenderer
#define SDL_EnclosePoints
int SDL_RecreateWindow(SDL_Window *window, Uint32 flags)
void(* GL_DeleteContext)(_THIS, SDL_GLContext context)
#define SDL_ISPIXELFORMAT_FOURCC(format)
#define CHECK_WINDOW_MAGIC(window, retval)
int SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window)
Create a simple modal message box.
void(* SetWindowTitle)(_THIS, SDL_Window *window)
int(* GL_GetSwapInterval)(_THIS)
void(* MaximizeWindow)(_THIS, SDL_Window *window)
void SDL_OnWindowFocusLost(SDL_Window *window)
int SDL_GetWindowDisplayIndex(SDL_Window *window)
Get the display index associated with a window.
static int SDL_GetIndexOfDisplay(SDL_VideoDisplay *display)
GLboolean GLboolean GLboolean GLboolean a
int(* SetWindowGammaRamp)(_THIS, SDL_Window *window, const Uint16 *ramp)
SDL_Window * SDL_GL_GetCurrentWindow(void)
Get the currently active OpenGL window.
void SDL_EnableScreenSaver()
Allow the screen to be blanked by a screensaver.
static SDL_bool ShouldMinimizeOnFocusLoss(SDL_Window *window)
Uint32 SDL_GetWindowID(SDL_Window *window)
Get the numeric ID of a window, for logging purposes.
void(* OnWindowEnter)(_THIS, SDL_Window *window)
void(* SuspendScreenSaver)(_THIS)
GLboolean GLboolean GLboolean b
SDL_bool SDL_HasScreenKeyboardSupport(void)
Returns whether the platform has some screen keyboard support.
SDL_Window * current_glwin
void(* SetWindowGrab)(_THIS, SDL_Window *window, SDL_bool grabbed)
#define SDL_BITSPERPIXEL(X)
#define SDL_Unsupported()
#define SDL_GetMouseState
int(* CreateWindowFramebuffer)(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
GLfloat GLfloat GLfloat GLfloat h
void *(* GL_GetProcAddress)(_THIS, const char *proc)
SDL_WindowUserData * data
void SDL_SetWindowPosition(SDL_Window *window, int x, int y)
Set the position of a window.
#define SDL_CreateRenderer
void SDL_OnWindowResized(SDL_Window *window)
A rectangle, with the origin at the upper left.
#define SDL_GetRendererInfo
SDL_bool SDL_GetSpanEnclosingRect(int width, int height, int numrects, const SDL_Rect *rects, SDL_Rect *span)
#define SDL_RenderPresent
void SDL_DisableScreenSaver()
Prevent the screen from being blanked by a screensaver.
int SDL_SetWindowFullscreen(SDL_Window *window, Uint32 flags)
Set a window's fullscreen state.
void SDL_SetTextInputRect(SDL_Rect *rect)
Set the rectangle used to type Unicode text inputs. This is used as a hint for IME and on-screen keyb...
int SDL_GetNumDisplayModes(int displayIndex)
Returns the number of available display modes.
static SDL_Surface * SDL_CreateWindowFramebuffer(SDL_Window *window)
void(* HideScreenKeyboard)(_THIS, SDL_Window *window)
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int in j)
void SDL_GetWindowMinimumSize(SDL_Window *window, int *min_w, int *min_h)
Get the minimum size of a window's client area.
#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE