31 #include "../events/SDL_events_c.h"
32 #include "../timer/SDL_timer_c.h"
38 #if SDL_VIDEO_OPENGL_ES
43 #if SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL
56 #if SDL_VIDEO_DRIVER_COCOA
59 #if SDL_VIDEO_DRIVER_X11
62 #if SDL_VIDEO_DRIVER_DIRECTFB
65 #if SDL_VIDEO_DRIVER_WINDOWS
68 #if SDL_VIDEO_DRIVER_BWINDOW
71 #if SDL_VIDEO_DRIVER_PANDORA
74 #if SDL_VIDEO_DRIVER_UIKIT
77 #if SDL_VIDEO_DRIVER_ANDROID
80 #if SDL_VIDEO_DRIVER_PSP
83 #if SDL_VIDEO_DRIVER_RPI
86 #if SDL_VIDEO_DRIVER_DUMMY
94 #define CHECK_WINDOW_MAGIC(window, retval) \
96 SDL_UninitializedVideo(); \
99 if (!window || window->magic != &_this->window_magic) { \
100 SDL_SetError("Invalid window"); \
104 #define CHECK_DISPLAY_INDEX(displayIndex, retval) \
106 SDL_UninitializedVideo(); \
109 if (displayIndex < 0 || displayIndex >= _this->num_displays) { \
110 SDL_SetError("displayIndex must be in the range 0 - %d", \
111 _this->num_displays - 1); \
117 #define SDL_WINDOWTEXTUREDATA "_SDL_WindowTextureData"
125 } SDL_WindowTextureData;
156 #if defined(__WIN32__)
161 #elif defined(__MACOSX__)
165 #elif defined(__LINUX__)
179 const char *vendor =
NULL;
182 if (glGetStringFunc) {
183 vendor = (
const char *) glGetStringFunc(
GL_VENDOR);
195 return hasAcceleratedOpenGL;
197 #elif SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
215 SDL_WindowTextureData *
data;
227 if (hint && *hint !=
'0' && *hint !=
'1' &&
250 return SDL_SetError(
"No hardware accelerated renderers available");
254 data = (SDL_WindowTextureData *)
SDL_calloc(1,
sizeof(*data));
261 data->renderer = renderer;
267 data->texture =
NULL;
288 window->
w, window->
h);
289 if (!data->texture) {
295 data->pitch = (((window->
w * data->bytes_per_pixel) + 3) & ~3);
296 data->pixels =
SDL_malloc(window->
h * data->pitch);
301 *pixels = data->pixels;
302 *pitch = data->pitch;
313 SDL_WindowTextureData *
data;
318 if (!data || !data->texture) {
324 src = (
void *)((
Uint8 *)data->pixels +
325 rect.
y * data->pitch +
326 rect.
x * data->bytes_per_pixel);
343 SDL_WindowTextureData *
data;
352 if (data->renderer) {
367 }
else if (a->
w != b->
w) {
369 }
else if (a->
h != b->
h) {
384 return SDL_SetError(
"Video subsystem has not been initialized");
417 #if !SDL_TIMERS_DISABLED
432 if (driver_name ==
NULL) {
435 if (driver_name !=
NULL) {
436 for (i = 0; bootstrap[
i]; ++
i) {
438 video = bootstrap[
i]->
create(index);
443 for (i = 0; bootstrap[
i]; ++
i) {
444 if (bootstrap[i]->available()) {
445 video = bootstrap[
i]->
create(index);
487 #elif SDL_VIDEO_OPENGL_ES2
491 #elif SDL_VIDEO_OPENGL_ES
512 return SDL_SetError(
"The video driver did not add any displays");
611 for (displayIndex = 0; displayIndex < _this->
num_displays; ++displayIndex) {
612 if (display == &_this->
displays[displayIndex]) {
652 if (displayIndex == 0) {
674 for (i = 0; i < nmodes; ++
i) {
675 if (
cmpmodes(mode, &modes[i]) == 0) {
691 modes[nmodes] = *
mode;
727 display = &_this->
displays[displayIndex];
729 return SDL_SetError(
"index must be in the range of 0 - %d",
745 display = &_this->
displays[displayIndex];
759 display = &_this->
displays[displayIndex];
772 int target_refresh_rate;
776 if (!mode || !closest) {
777 SDL_SetError(
"Missing desired mode or closest mode parameter");
783 target_format = mode->
format;
799 if (current->
w && (current->
w < mode->
w)) {
803 if (current->
h && (current->
h < mode->
h)) {
804 if (current->
w && (current->
w == mode->
w)) {
813 if (!match || current->
w < match->
w || current->
h < match->
h) {
819 if (current->
format == target_format ||
841 if (match->
w && match->
h) {
842 closest->
w = match->
w;
843 closest->
h = match->
h;
845 closest->
w = mode->
w;
846 closest->
h = mode->
h;
882 display = &_this->
displays[displayIndex];
893 display_mode = *
mode;
896 if (!display_mode.
format) {
899 if (!display_mode.
w) {
902 if (!display_mode.
h) {
911 return SDL_SetError(
"No video mode large enough for %dx%d",
912 display_mode.
w, display_mode.
h);
920 if (
SDL_memcmp(&display_mode, ¤t_mode,
sizeof(display_mode)) == 0) {
926 return SDL_SetError(
"Video driver doesn't support changing display mode");
941 int closest_dist = 0x7FFFFFFF;
950 displayIndex = (window->
x & 0xFFFF);
958 displayIndex = (window->
y & 0xFFFF);
973 center.
x = window->
x + window->
w / 2;
974 center.
y = window->
y + window->
h / 2;
981 delta.
x = center.
x - (rect.
x + rect.
w / 2);
982 delta.
y = center.
y - (rect.
y + rect.
h / 2);
983 dist = (delta.
x*delta.
x + delta.
y*delta.
y);
984 if (dist < closest_dist) {
999 if (displayIndex >= 0) {
1000 return &_this->
displays[displayIndex];
1032 if (!fullscreen_mode.
w) {
1033 fullscreen_mode.
w = window->
w;
1035 if (!fullscreen_mode.
h) {
1036 fullscreen_mode.
h = window->
h;
1048 &fullscreen_mode)) {
1049 return SDL_SetError(
"Couldn't find display mode match");
1053 *mode = fullscreen_mode;
1100 for (other = _this->
windows; other; other = other->
next) {
1103 if (other == window) {
1104 setDisplayMode = fullscreen;
1110 if (setDisplayMode) {
1116 if (other->
w == fullscreen_mode.
w && other->
h == fullscreen_mode.
h) {
1135 fullscreen_mode.
w, fullscreen_mode.
h);
1161 #define CREATE_FLAGS \
1162 (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE)
1211 #if (SDL_VIDEO_OPENGL && __MACOSX__) || __IPHONEOS__ || __ANDROID__
1243 window->
x = bounds.
x + (bounds.
w -
w) / 2;
1246 window->
y = bounds.
y + (bounds.
h -
h) / 2;
1257 if (!hint || *hint !=
'1') {
1319 char *title = window->
title;
1323 return SDL_SetError(
"No OpenGL support in video driver");
1348 if ((window->
flags & SDL_WINDOW_OPENGL) != (flags & SDL_WINDOW_OPENGL)) {
1349 if (flags & SDL_WINDOW_OPENGL) {
1362 if (_this->
CreateWindow && !(flags & SDL_WINDOW_FOREIGN)) {
1364 if (flags & SDL_WINDOW_OPENGL) {
1400 for (window = _this->
windows; window; window = window->
next) {
1401 if (window->
id ==
id) {
1413 return window->
flags;
1421 if (title == window->
title) {
1425 if (title && *title) {
1457 if (!window->
icon) {
1474 if (name ==
NULL || name[0] ==
'\0') {
1481 for (data = window->
data; data; prev = data, data = data->
next) {
1483 void *last_value = data->
data;
1487 data->
data = userdata;
1506 data->
data = userdata;
1521 if (name ==
NULL || name[0] ==
'\0') {
1526 for (data = window->
data; data; data = data->
next) {
1547 x = bounds.
x + (bounds.
w - window->
w) / 2;
1550 y = bounds.
y + (bounds.
h - window->
h) / 2;
1597 const int want = (bordered !=
SDL_FALSE);
1630 if (window->
w == w && window->
h == h) {
1663 window->
min_w = min_w;
1664 window->
min_h = min_h;
1678 *min_w = window->
min_w;
1681 *min_h = window->
min_h;
1699 window->
max_w = max_w;
1700 window->
max_h = max_h;
1714 *max_w = window->
max_w;
1717 *max_h = window->
max_h;
1812 #define FULLSCREEN_MASK ( SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN )
1840 Uint32 Rmask, Gmask, Bmask, Amask;
1885 full_rect.
w = window->
w;
1886 full_rect.
h = window->
h;
1897 return SDL_SetError(
"Window surface is invalid, please call SDL_GetWindowSurface() to get a new surface");
1938 if (!window->
gamma) {
1967 if (!window->
gamma) {
1971 if (!window->
gamma) {
1982 for (i = 0; i < 256; ++
i) {
2145 for (window = _this->
windows; window; window = window->
next) {
2204 while (window->
data) {
2329 return SDL_SetError(
"No dynamic GL support in video driver");
2381 return ( verstr && (
SDL_atoi(verstr) >= 3) );
2387 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
2389 const char *extensions;
2391 const char *where, *terminator;
2395 if (where || *extension ==
'\0') {
2400 if (start && *start ==
'0') {
2407 if (!glGetStringFunc) {
2419 if ((!glGetStringiFunc) || (!glGetIntegervFunc)) {
2423 #ifndef GL_NUM_EXTENSIONS
2424 #define GL_NUM_EXTENSIONS 0x821D
2427 for (i = 0; i < num_exts; i++) {
2428 const char *thisext = (
const char *) glGetStringiFunc(
GL_EXTENSIONS, i);
2456 if (where == start || *(where - 1) ==
' ')
2457 if (*terminator ==
' ' || *terminator ==
'\0')
2471 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
2549 retval =
SDL_SetError(
"Unknown OpenGL context flag %d", value);
2559 retval =
SDL_SetError(
"Unknown OpenGL context profile %d", value);
2580 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
2587 if (!glGetIntegervFunc) {
2592 if (!glGetErrorFunc) {
2613 #if SDL_VIDEO_OPENGL
2629 #if SDL_VIDEO_OPENGL
2656 #if SDL_VIDEO_OPENGL
2663 #if SDL_VIDEO_OPENGL
2741 glGetIntegervFunc(attrib, (
GLint *) value);
2742 error = glGetErrorFunc();
2764 SDL_SetError(
"The specified window isn't an OpenGL window");
2797 return SDL_SetError(
"The specified window isn't an OpenGL window");
2848 return SDL_SetError(
"No OpenGL context has been made current");
2852 return SDL_SetError(
"Setting the swap interval is not supported");
2876 SDL_SetError(
"The specified window isn't an OpenGL window");
2881 SDL_SetError(
"The specified window has not been made current");
2891 if (!_this || !context) {
2912 #define SET_MASKBIT(icon, x, y, mask) \
2913 mask[(y*((icon->w+7)/8))+(x/8)] &= ~(0x01<<(7-(x%8)))
2915 colorkey = icon->
format->colorkey;
2920 for (y = 0; y < icon->
h; ++
y) {
2922 for (x = 0; x < icon->
w; ++
x) {
2923 if (*pixels++ == colorkey) {
2924 SET_MASKBIT(icon, x, y, mask);
2934 for (y = 0; y < icon->
h; ++
y) {
2936 for (x = 0; x < icon->
w; ++
x) {
2937 if ((flags & 1) && *pixels == colorkey) {
2938 SET_MASKBIT(icon, x, y, mask);
2939 }
else if ((flags & 2)
2941 SET_MASKBIT(icon, x, y, mask);
2952 for (y = 0; y < icon->
h; ++
y) {
2954 for (x = 0; x < icon->
w; ++
x) {
2955 if ((flags & 1) && *pixels == colorkey) {
2956 SET_MASKBIT(icon, x, y, mask);
2957 }
else if ((flags & 2)
2959 SET_MASKBIT(icon, x, y, mask);
2975 if (icon && _this->SetIcon) {
2978 int mask_len = icon->
h * (icon->
w + 7) / 8;
2985 if (icon->
flags & SDL_SRCCOLORKEY)
2987 if (icon->
flags & SDL_SRCALPHA)
2990 CreateMaskFromColorKeyOrAlpha(icon, mask, flags);
2992 _this->SetIcon(_this, icon, mask);
2995 _this->SetIcon(_this, icon, mask);
3091 #if SDL_VIDEO_DRIVER_WINDOWS
3094 #if SDL_VIDEO_DRIVER_COCOA
3097 #if SDL_VIDEO_DRIVER_UIKIT
3100 #if SDL_VIDEO_DRIVER_X11
3127 int show_cursor_prev;
3129 if (!messageboxdata) {
3138 buttonid = &dummybutton;
3146 #if SDL_VIDEO_DRIVER_WINDOWS
3149 WIN_ShowMessageBox(messageboxdata, buttonid) == 0) {
3153 #if SDL_VIDEO_DRIVER_COCOA
3156 Cocoa_ShowMessageBox(messageboxdata, buttonid) == 0) {
3160 #if SDL_VIDEO_DRIVER_UIKIT
3163 UIKit_ShowMessageBox(messageboxdata, buttonid) == 0) {
3167 #if SDL_VIDEO_DRIVER_X11
3170 X11_ShowMessageBox(messageboxdata, buttonid) == 0) {
void(* SetWindowMaximumSize)(_THIS, SDL_Window *window)
void(* GetDisplayModes)(_THIS, SDL_VideoDisplay *display)
#define SDL_WINDOWPOS_ISUNDEFINED(X)
static int SDL_GetNumDisplayModesForDisplay(SDL_VideoDisplay *display)
DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window *window, int max_w, int max_h)
Set the maximum size of a window's client area.
static __inline__ SDL_bool isAtLeastGL3(const char *verstr)
void(* MinimizeWindow)(_THIS, SDL_Window *window)
void SDL_UpdateWindowGrab(SDL_Window *window)
DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window)
Returns whether the screen keyboard is shown for given window.
DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window *window, SDL_SysWMinfo *info)
This function allows access to driver-dependent window information.
DECLSPEC int SDLCALL SDL_RenderSetViewport(SDL_Renderer *renderer, const SDL_Rect *rect)
Set the drawing area for rendering on the current target.
int(* UpdateWindowFramebuffer)(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix)
DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window *window)
Get the title of a window, in UTF-8 format.
DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window *window, int *w, int *h)
Get the maximum size of a window's client area.
DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window *window, int min_w, int min_h)
Set the minimum size of a window's client area.
SDL_bool(* GetWindowWMInfo)(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface *surface)
SDL_bool(* IsScreenKeyboardShown)(_THIS, SDL_Window *window)
void(* RaiseWindow)(_THIS, SDL_Window *window)
SDL_Mouse * SDL_GetMouse(void)
DECLSPEC void SDLCALL 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...
DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc)
Get the address of an OpenGL function.
GLfloat GLfloat GLfloat GLfloat h
DECLSPEC void SDLCALL SDL_VideoQuit(void)
Shuts down the video subsystem.
void SDL_SetKeyboardFocus(SDL_Window *window)
SDL_DisplayMode fullscreen_mode
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size)
DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window *window, int *w, int *h)
Get the minimum size of a window's client area.
GLsizei GLenum GLuint GLuint GLsizei GLchar * message
DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void)
Get the swap interval for the current OpenGL context.
DECLSPEC void SDLCALL SDL_StartTextInput(void)
Start accepting Unicode text input events. This function will show the on-screen keyboard if supporte...
#define SDL_PIXELLAYOUT(X)
DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window *window)
Get the brightness (gamma correction) for a window.
void(* HideWindow)(_THIS, SDL_Window *window)
int(* GL_MakeCurrent)(_THIS, SDL_Window *window, SDL_GLContext context)
#define FULLSCREEN_VISIBLE(W)
DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *window)
Create an OpenGL context for use with an OpenGL window, and make it current.
int(* GetWindowGammaRamp)(_THIS, SDL_Window *window, Uint16 *ramp)
DECLSPEC int SDLCALL SDL_ShowCursor(int toggle)
Toggle whether or not the cursor is shown.
SDL_TLSID current_glwin_tls
DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture *texture)
Destroy the specified texture.
DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name)
Initialize the video subsystem, optionally specifying a video driver.
void(* StopTextInput)(_THIS)
int(* GetDisplayBounds)(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
DECLSPEC SDL_Window *SDLCALL SDL_GetMouseFocus(void)
Get the window which currently has mouse focus.
#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS
Minimize your SDL_Window if it loses key focus when in Fullscreen mode. Defaults to true...
static void SDL_RestoreMousePosition(SDL_Window *window)
DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window *window)
Get a window's input grab mode.
#define SDL_HINT_VIDEO_HIGHDPI_DISABLED
If set to 1, then do not allow high-DPI windows. ("Retina" on Mac)
DECLSPEC SDL_Window *SDLCALL SDL_GL_GetCurrentWindow(void)
Get the currently active OpenGL window.
The structure that defines a point.
int SDL_AddBasicVideoDisplay(const SDL_DisplayMode *desktop_mode)
DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size)
A collection of pixels used in software blitting.
void SDL_OnWindowResized(SDL_Window *window)
DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
Get the actual value for an attribute from the current context.
#define GL_ACCUM_GREEN_BITS
DECLSPEC void SDLCALL SDL_free(void *mem)
void(* SetWindowGrab)(_THIS, SDL_Window *window, SDL_bool grabbed)
Uint32 texture_formats[16]
The structure that defines a display mode.
SDL_GLattr
OpenGL configuration attributes.
DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window *window, const SDL_DisplayMode *mode)
Set the display mode used when a fullscreen window is visible.
void(* SetWindowIcon)(_THIS, SDL_Window *window, SDL_Surface *icon)
DECLSPEC SDL_TLSID SDLCALL SDL_TLSCreate(void)
Create an identifier that is globally visible to all threads but refers to data that is thread-specif...
#define SDL_WINDOWPOS_ISCENTERED(X)
DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex)
Returns the number of available display modes.
GLboolean GLboolean GLboolean GLboolean a
void * SDL_GLContext
An opaque handle to an OpenGL context.
#define SDL_BYTESPERPIXEL(X)
EGLImageKHR EGLint * name
SDL_bool(* HasScreenKeyboardSupport)(_THIS)
DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state)
DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window *window, int *w, int *h)
Get the size of a window's client area.
DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len)
DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point *points, int count, const SDL_Rect *clip, SDL_Rect *result)
Calculate a minimal rectangle enclosing a set of points.
DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window *window, Uint16 *red, Uint16 *green, Uint16 *blue)
Get the gamma ramp for a window.
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
#define SDL_ISPIXELFORMAT_ALPHA(format)
void SDL_SetMouseFocus(SDL_Window *window)
int SDL_KeyboardInit(void)
DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window *window, int w, int h)
Set the size of a window's client area.
#define SDL_InvalidParamError(param)
DECLSPEC int SDLCALL SDL_SetWindowBrightness(SDL_Window *window, float brightness)
Set the brightness (gamma correction) for a window.
void SDL_OnWindowEnter(SDL_Window *window)
int(* CreateWindowFrom)(_THIS, SDL_Window *window, const void *data)
DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c)
DECLSPEC SDL_Renderer *SDLCALL SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags)
Create a 2D rendering context for 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.
GLsizei const GLchar *const * path
#define GL_SAMPLE_BUFFERS
DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode *mode)
Fill in information about the current display mode.
void(* HideScreenKeyboard)(_THIS, SDL_Window *window)
int SDL_AddVideoDisplay(const SDL_VideoDisplay *display)
DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window *window, SDL_bool grabbed)
Set a window's input grab mode.
DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window *window)
Hide a window.
void * SDL_GetDisplayDriverData(int displayIndex)
DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window *window, SDL_Surface *icon)
Set the icon for a window.
DECLSPEC SDL_Surface *SDLCALL SDL_GetWindowSurface(SDL_Window *window)
Get the SDL surface associated with the window.
void SDL_OnWindowHidden(SDL_Window *window)
DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_Rect *dstrect)
Copy a portion of the texture to the current rendering target.
int(* GL_SetSwapInterval)(_THIS, int interval)
#define SDL_VERSION(x)
Macro to determine SDL version program was compiled against.
static SDL_VideoDevice * _this
uint32_t Uint32
An unsigned 32-bit integer type.
DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window *window)
Get the pixel format associated with the window.
void(* DestroyWindowFramebuffer)(_THIS, SDL_Window *window)
int(* CreateWindow)(_THIS, SDL_Window *window)
DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y)
Retrieve the current state of the mouse.
DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window *window, SDL_GLContext context)
Set up an OpenGL context for rendering into an OpenGL window.
void(* GL_UnloadLibrary)(_THIS)
struct SDL_WindowUserData * next
DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value)
Set an OpenGL window attribute before window creation.
DECLSPEC SDL_DisplayMode *SDLCALL SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
Get the closest match to the requested display mode.
static int SDL_CreateWindowTexture(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
void SDL_OnWindowMinimized(SDL_Window *window)
DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window *window)
Minimize a window to an iconic representation.
void(* GL_GetDrawableSize)(_THIS, SDL_Window *window, int *w, int *h)
DECLSPEC const char *SDLCALL SDL_GetDisplayName(int displayIndex)
Get the name of a display in UTF-8 encoding.
DECLSPEC void SDLCALL SDL_StopTextInput(void)
Stop receiving any text input events. This function will hide the on-screen keyboard if supported...
DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval)
Set the swap interval for the current OpenGL context.
SDL_GLContext current_glctx
#define GL_ACCUM_ALPHA_BITS
#define SDL_GetEventState(type)
static int cmpmodes(const void *A, const void *B)
int(* ShowMessageBox)(_THIS, const SDL_MessageBoxData *messageboxdata, int *buttonid)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
int SDL_RecreateWindow(SDL_Window *window, Uint32 flags)
#define SDL_WINDOWTEXTUREDATA
DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window *window)
Show a window.
DECLSPEC char *SDLCALL SDL_strdup(const char *str)
DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode *mode)
Fill in information about the desktop display mode.
DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void)
Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window *window, int *x, int *y)
Get the position of a window.
SDL_Window * SDL_GetFocusWindow(void)
DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex, SDL_DisplayMode *mode)
Fill in information about a specific display mode.
DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context)
Delete an OpenGL context.
DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags)
DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle)
#define GL_ACCUM_BLUE_BITS
DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window *window)
Restore the size and position of a minimized or maximized window.
#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...
DECLSPEC SDL_Window *SDLCALL SDL_GetWindowFromID(Uint32 id)
Get a window from a stored ID, or NULL if it doesn't exist.
int(* SetWindowGammaRamp)(_THIS, SDL_Window *window, const Uint16 *ramp)
DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window *window, const char *title)
Set the title of a window, in UTF-8 format.
SDL_DisplayMode * display_modes
DECLSPEC void *SDLCALL SDL_SetWindowData(SDL_Window *window, const char *name, void *userdata)
Associate an arbitrary named pointer with a window.
DECLSPEC Uint32 SDLCALL SDL_GetWindowID(SDL_Window *window)
Get the numeric ID of a window, for logging purposes.
SDL_DisplayMode current_mode
DECLSPEC void *SDLCALL SDL_memset(void *dst, int c, size_t len)
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
#define GL_ACCUM_RED_BITS
DECLSPEC SDL_Window *SDLCALL SDL_CreateWindowFrom(const void *data)
Create an SDL window from an existing native window.
SDL_VideoDisplay * displays
DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(void)
Returns whether the screensaver is currently enabled (default on).
DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window *window, Uint32 flags)
Set a window's fullscreen state.
void SDL_OnWindowLeave(SDL_Window *window)
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum format
SDL_VideoDevice *(* create)(int devindex)
DECLSPEC int SDLCALL SDL_SetError(const char *fmt,...)
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...
DECLSPEC void *SDLCALL SDL_malloc(size_t size)
DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window *window, const char *name)
Retrieve the data pointer associated with a window.
DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex(SDL_Window *window)
Get the display index associated with a window.
#define GL_NUM_EXTENSIONS
DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2)
void(* SetWindowPosition)(_THIS, SDL_Window *window)
DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window *window)
Get the window flags.
DECLSPEC const char *SDLCALL SDL_GetHint(const char *name)
Get a hint.
static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype)
DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window *window, SDL_bool bordered)
Set the border state of a window.
const SDL_MessageBoxButtonData * buttons
DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
MessageBox structure containing title, text, window, etc.
static SDL_bool ShouldMinimizeOnFocusLoss()
DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index)
Get the name of a built in video driver.
DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window)
Create a simple modal message box.
DECLSPEC void SDLCALL SDL_EnableScreenSaver(void)
Allow the screen to be blanked by a screensaver.
void SDL_KeyboardQuit(void)
DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void)
Returns the name of the currently initialized video driver.
static int SDL_SetDisplayModeForDisplay(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
SDL_Window * fullscreen_window
DECLSPEC void SDLCALL SDL_GL_GetDrawableSize(SDL_Window *window, int *w, int *h)
Get the size of a window's underlying drawable (for use with glViewport).
DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled)
Set relative mouse mode.
void(* SetWindowMinimumSize)(_THIS, SDL_Window *window)
DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window *window)
Make a window as large as possible.
DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat(SDL_Surface *src, Uint32 pixel_format, Uint32 flags)
int share_with_current_context
void(* SuspendScreenSaver)(_THIS)
DECLSPEC size_t SDLCALL SDL_strlen(const char *str)
int(* GL_GetSwapInterval)(_THIS)
SDL_bool SDL_ShouldAllowTopmost(void)
EGLSurface EGLint EGLint y
#define SDL_OutOfMemory()
SDL_DisplayMode desktop_mode
DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void)
Query whether relative mouse mode is enabled.
GLenum GLenum GLuint texture
#define SDL_arraysize(array)
void(* GL_DeleteContext)(_THIS, SDL_GLContext context)
DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive(void)
Return whether or not Unicode text input events are enabled.
void(* MaximizeWindow)(_THIS, SDL_Window *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.
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
Information on the capabilities of a render driver or context.
EGLSurface EGLint void ** value
void(* DestroyWindow)(_THIS, SDL_Window *window)
DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 *ramp)
Calculate a 256 entry gamma ramp for a gamma value.
#define GL_SAMPLE_BUFFERS_ARB
DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window *window, int x, int y)
Moves the mouse to the given position within the window.
void(* SetTextInputRect)(_THIS, SDL_Rect *rect)
DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src, size_t len)
DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window *window, int x, int y)
Set the position of a window.
void(* SetWindowSize)(_THIS, SDL_Window *window)
DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer *renderer, SDL_RendererInfo *info)
Get information about a rendering context.
GLenum GLsizei GLsizei GLsizei GLsizei GLbitfield flags
int(* SetDisplayMode)(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
static SDL_bool ShouldUseTextureFramebuffer()
SDL_VideoDisplay * SDL_GetDisplayForWindow(SDL_Window *window)
DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window *window)
Copy the window surface to the screen.
uint8_t Uint8
An unsigned 8-bit integer type.
SDL_TLSID current_glctx_tls
DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window *window)
Raise a window above other windows and set the input focus.
DECLSPEC int SDLCALL SDL_atoi(const char *str)
#define SDL_HINT_FRAMEBUFFER_ACCELERATION
A variable controlling how 3D acceleration is used to accelerate the SDL screen surface.
static void SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags)
SDL_GLContext(* GL_CreateContext)(_THIS, SDL_Window *window)
DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void(*destructor)(void *))
Set the value associated with a thread local storage ID for the current thread.
DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport(void)
Returns whether the platform has some screen keyboard support.
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path)
Dynamically load an OpenGL library.
DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format, int *bpp, Uint32 *Rmask, Uint32 *Gmask, Uint32 *Bmask, Uint32 *Amask)
Convert one of the enumerated pixel formats to a bpp and RGBA masks.
static void SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
static void SDL_DestroyWindowTexture(_THIS, SDL_Window *window)
int(* GL_LoadLibrary)(_THIS, const char *path)
#define SDL_HINT_RENDER_DRIVER
A variable specifying which render driver to use.
void SDL_OnWindowFocusLost(SDL_Window *window)
static int SDL_UninitializedVideo()
DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void)
Get the number of video drivers compiled into SDL.
void(* GL_SwapWindow)(_THIS, SDL_Window *window)
DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window *window)
Destroy a window.
static VideoBootStrap * bootstrap[]
void(* ShowWindow)(_THIS, SDL_Window *window)
GLdouble GLdouble GLdouble b
DECLSPEC void SDLCALL SDL_DisableScreenSaver(void)
Prevent the screen from being blanked by a screensaver.
Uint32 num_texture_formats
SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
SDL_VideoDevice * SDL_GetVideoDevice(void)
int(* CreateWindowFramebuffer)(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
SDL_bool suspend_screensaver
GLint GLint GLint GLint GLint w
static SDL_DisplayMode * SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay *display, const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
uint16_t Uint16
An unsigned 16-bit integer type.
void SDL_OnWindowRestored(SDL_Window *window)
DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len)
DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void)
Get the number of 2D rendering drivers available for the current display.
void SDL_OnWindowShown(SDL_Window *window)
DECLSPEC SDL_Texture *SDLCALL SDL_CreateTexture(SDL_Renderer *renderer, Uint32 format, int access, int w, int h)
Create a texture for a rendering context.
DECLSPEC char *SDLCALL SDL_getenv(const char *name)
DECLSPEC SDL_Window *SDLCALL SDL_GetKeyboardFocus(void)
Get the window which currently has keyboard focus.
#define CHECK_DISPLAY_INDEX(displayIndex, retval)
DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int(*compare)(const void *, const void *))
DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void)
Returns the number of available video displays.
DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char *extension)
Return true if an OpenGL extension is supported for the current context.
void(* SetWindowTitle)(_THIS, SDL_Window *window)
#define SDL_ISPIXELFORMAT_FOURCC(format)
void(* SetWindowBordered)(_THIS, SDL_Window *window, SDL_bool bordered)
#define CHECK_WINDOW_MAGIC(window, retval)
void(* StartTextInput)(_THIS)
static int SDL_UpdateWindowTexture(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
void(* SetWindowFullscreen)(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
void(* OnWindowEnter)(_THIS, SDL_Window *window)
static int SDL_GetIndexOfDisplay(SDL_VideoDisplay *display)
DECLSPEC int SDLCALL SDL_SetWindowGammaRamp(SDL_Window *window, const Uint16 *red, const Uint16 *green, const Uint16 *blue)
Set the gamma ramp for a window.
struct SDL_VideoDevice::@87 gl_config
DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index, SDL_RendererInfo *info)
Get information about a specific 2D rendering driver for the current display.
SDL_Window * current_glwin
void *(* GL_GetProcAddress)(_THIS, const char *proc)
DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
Create a modal message box.
#define SDL_BITSPERPIXEL(X)
#define SDL_Unsupported()
DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2)
DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void)
Get the currently active OpenGL context.
DECLSPEC void *SDLCALL SDL_TLSGet(SDL_TLSID id)
Get the value associated with a thread local storage ID for the current thread.
SDL_WindowUserData * data
A rectangle, with the origin at the upper left.
SDL_bool SDL_GetSpanEnclosingRect(int width, int height, int numrects, const SDL_Rect *rects, SDL_Rect *span)
void(* ShowScreenKeyboard)(_THIS, SDL_Window *window)
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.
void(* RestoreWindow)(_THIS, SDL_Window *window)
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_DestroyRenderer(SDL_Renderer *renderer)
Destroy the rendering context for a window and free associated textures.
DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags)
DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer *renderer)
Update the screen with rendering performed.
static SDL_Surface * SDL_CreateWindowFramebuffer(SDL_Window *window)
void SDL_OnWindowFocusGained(SDL_Window *window)
DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
Update the given texture rectangle with new pixel data.