parent
1230a8fde8
commit
5a2d0b69c8
|
@ -170,7 +170,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
/* create main window and renderer */
|
/* create main window and renderer */
|
||||||
window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_FULLSCREEN | SDL_WINDOW_ALLOW_HIGHDPI);
|
window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_FULLSCREEN | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||||
renderer = SDL_CreateRenderer(window, 0, 0);
|
renderer = SDL_CreateRenderer(window, NULL, 0);
|
||||||
|
|
||||||
SDL_GetWindowSize(window, &w, &h);
|
SDL_GetWindowSize(window, &w, &h);
|
||||||
SDL_RenderSetLogicalSize(renderer, w, h);
|
SDL_RenderSetLogicalSize(renderer, w, h);
|
||||||
|
|
|
@ -145,7 +145,7 @@ main(int argc, char *argv[])
|
||||||
* (if SDL_WINDOW_RESIZABLE isn't specified). */
|
* (if SDL_WINDOW_RESIZABLE isn't specified). */
|
||||||
window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_FULLSCREEN | SDL_WINDOW_ALLOW_HIGHDPI);
|
window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_FULLSCREEN | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||||
|
|
||||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
renderer = SDL_CreateRenderer(window, NULL, 0);
|
||||||
|
|
||||||
SDL_GetWindowSize(window, &width, &height);
|
SDL_GetWindowSize(window, &width, &height);
|
||||||
SDL_RenderSetLogicalSize(renderer, width, height);
|
SDL_RenderSetLogicalSize(renderer, width, height);
|
||||||
|
|
|
@ -223,7 +223,7 @@ main(int argc, char *argv[])
|
||||||
/* create window */
|
/* create window */
|
||||||
window = SDL_CreateWindow("iOS keyboard test", 0, 0, 0, 0, SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
|
window = SDL_CreateWindow("iOS keyboard test", 0, 0, 0, 0, SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||||
/* create renderer */
|
/* create renderer */
|
||||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_PRESENTVSYNC);
|
renderer = SDL_CreateRenderer(window, NULL, SDL_RENDERER_PRESENTVSYNC);
|
||||||
|
|
||||||
SDL_GetWindowSize(window, &width, &height);
|
SDL_GetWindowSize(window, &width, &height);
|
||||||
SDL_RenderSetLogicalSize(renderer, width, height);
|
SDL_RenderSetLogicalSize(renderer, width, height);
|
||||||
|
|
|
@ -283,7 +283,7 @@ main(int argc, char *argv[])
|
||||||
fatalError("could not initialize SDL");
|
fatalError("could not initialize SDL");
|
||||||
}
|
}
|
||||||
window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALLOW_HIGHDPI);
|
window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||||
renderer = SDL_CreateRenderer(window, 0, 0);
|
renderer = SDL_CreateRenderer(window, NULL, 0);
|
||||||
|
|
||||||
SDL_GetWindowSize(window, &width, &height);
|
SDL_GetWindowSize(window, &width, &height);
|
||||||
SDL_RenderSetLogicalSize(renderer, width, height);
|
SDL_RenderSetLogicalSize(renderer, width, height);
|
||||||
|
|
|
@ -61,7 +61,7 @@ main(int argc, char *argv[])
|
||||||
if (window == NULL) {
|
if (window == NULL) {
|
||||||
fatalError("Could not initialize Window");
|
fatalError("Could not initialize Window");
|
||||||
}
|
}
|
||||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
renderer = SDL_CreateRenderer(window, NULL, 0);
|
||||||
if (renderer == NULL) {
|
if (renderer == NULL) {
|
||||||
fatalError("Could not create renderer");
|
fatalError("Could not create renderer");
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
/* create main window and renderer */
|
/* create main window and renderer */
|
||||||
window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALLOW_HIGHDPI);
|
window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||||
renderer = SDL_CreateRenderer(window, 0, 0);
|
renderer = SDL_CreateRenderer(window, NULL, 0);
|
||||||
|
|
||||||
SDL_GetWindowSize(window, &w, &h);
|
SDL_GetWindowSize(window, &w, &h);
|
||||||
SDL_RenderSetLogicalSize(renderer, w, h);
|
SDL_RenderSetLogicalSize(renderer, w, h);
|
||||||
|
|
|
@ -317,3 +317,18 @@ The following hints have been removed:
|
||||||
|
|
||||||
The gesture API has been removed. There is no replacement planned.
|
The gesture API has been removed. There is no replacement planned.
|
||||||
|
|
||||||
|
|
||||||
|
## SDL_render.h
|
||||||
|
|
||||||
|
SDL_GetRenderDriverInfo() has been removed, since most of the information it reported were
|
||||||
|
estimates and could not be accurate before creating a renderer. Often times this function
|
||||||
|
was used to figure out the index of a driver, so one would call it in a for-loop, looking
|
||||||
|
for the driver named "opengl" or whatnot. SDL_GetRenderDriver() has been added for this
|
||||||
|
functionality, which returns only the name of the driver.
|
||||||
|
|
||||||
|
Additionally, SDL_CreateRenderer()'s second argument is no longer an integer index, but a
|
||||||
|
`const char *` representing a renderer's name; if you were just using a for-loop to find
|
||||||
|
which index is the "opengl" or whatnot driver, you can just pass that string directly
|
||||||
|
here, now. Passing NULL is the same as passing -1 here in SDL2, to signify you want SDL
|
||||||
|
to decide for you.
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ Here's a sample SDL snippet to verify everything is setup in your IDE:
|
||||||
|
|
||||||
SDL_Init(SDL_INIT_VIDEO);
|
SDL_Init(SDL_INIT_VIDEO);
|
||||||
window = SDL_CreateWindow("Hello SDL", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_SHOWN);
|
window = SDL_CreateWindow("Hello SDL", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_SHOWN);
|
||||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
renderer = SDL_CreateRenderer(window, NULL, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
||||||
|
|
||||||
SDL_DestroyRenderer(renderer);
|
SDL_DestroyRenderer(renderer);
|
||||||
SDL_DestroyWindow(window);
|
SDL_DestroyWindow(window);
|
||||||
|
|
|
@ -164,26 +164,35 @@ typedef struct SDL_Texture SDL_Texture;
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \since This function is available since SDL 3.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_CreateRenderer
|
* \sa SDL_CreateRenderer
|
||||||
* \sa SDL_GetRenderDriverInfo
|
* \sa SDL_GetRenderDriver
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
|
extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get info about a specific 2D rendering driver for the current display.
|
* Use this function to get the name of a built in 2D rendering driver.
|
||||||
*
|
*
|
||||||
* \param index the index of the driver to query information about
|
* The list of rendering drivers is given in the order that they are normally
|
||||||
* \param info an SDL_RendererInfo structure to be filled with information on
|
* initialized by default; the drivers that seem more reasonable to choose
|
||||||
* the rendering driver
|
* first (as far as the SDL developers believe) are earlier in the list.
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
*
|
||||||
* SDL_GetError() for more information.
|
* The names of drivers are all simple, low-ASCII identifiers, like "opengl",
|
||||||
|
* "direct3d12" or "metal". These never have Unicode characters, and are not
|
||||||
|
* meant to be proper names.
|
||||||
|
*
|
||||||
|
* The returned value points to a static, read-only string; do not modify or
|
||||||
|
* free it!
|
||||||
|
*
|
||||||
|
* \param index the index of the rendering driver; the value ranges from 0 to
|
||||||
|
* SDL_GetNumRenderDrivers() - 1
|
||||||
|
* \returns the name of the rendering driver at the requested index, or NULL
|
||||||
|
* if an invalid index was specified.
|
||||||
*
|
*
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \since This function is available since SDL 3.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_CreateRenderer
|
|
||||||
* \sa SDL_GetNumRenderDrivers
|
* \sa SDL_GetNumRenderDrivers
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index,
|
extern DECLSPEC const char *SDLCALL SDL_GetRenderDriver(int index);
|
||||||
SDL_RendererInfo * info);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a window and default renderer.
|
* Create a window and default renderer.
|
||||||
|
@ -210,9 +219,16 @@ extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(
|
||||||
/**
|
/**
|
||||||
* Create a 2D rendering context for a window.
|
* Create a 2D rendering context for a window.
|
||||||
*
|
*
|
||||||
|
* If you want a specific renderer, you can specify its name here. A list
|
||||||
|
* of available renderers can be obtained by calling SDL_GetRenderDriver
|
||||||
|
* multiple times, with indices from 0 to SDL_GetNumRenderDrivers()-1. If
|
||||||
|
* you don't need a specific renderer, specify NULL and SDL will attempt
|
||||||
|
* to chooes the best option for you, based on what is available on the
|
||||||
|
* user's system.
|
||||||
|
*
|
||||||
* \param window the window where rendering is displayed
|
* \param window the window where rendering is displayed
|
||||||
* \param index the index of the rendering driver to initialize, or -1 to
|
* \param name the name of the rendering driver to initialize, or NULL to
|
||||||
* initialize the first one supporting the requested flags
|
* initialize the first one supporting the requested flags
|
||||||
* \param flags 0, or one or more SDL_RendererFlags OR'd together
|
* \param flags 0, or one or more SDL_RendererFlags OR'd together
|
||||||
* \returns a valid rendering context or NULL if there was an error; call
|
* \returns a valid rendering context or NULL if there was an error; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
|
@ -222,10 +238,11 @@ extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(
|
||||||
* \sa SDL_CreateSoftwareRenderer
|
* \sa SDL_CreateSoftwareRenderer
|
||||||
* \sa SDL_DestroyRenderer
|
* \sa SDL_DestroyRenderer
|
||||||
* \sa SDL_GetNumRenderDrivers
|
* \sa SDL_GetNumRenderDrivers
|
||||||
|
* \sa SDL_GetRenderDriver
|
||||||
* \sa SDL_GetRendererInfo
|
* \sa SDL_GetRendererInfo
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window,
|
extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window,
|
||||||
int index, Uint32 flags);
|
const char *name, Uint32 flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a 2D software rendering context for a surface.
|
* Create a 2D software rendering context for a surface.
|
||||||
|
|
|
@ -432,7 +432,6 @@ SDL3_0.0.0 {
|
||||||
SDL_hid_ble_scan;
|
SDL_hid_ble_scan;
|
||||||
SDL_GetWindowWMInfo;
|
SDL_GetWindowWMInfo;
|
||||||
SDL_GetNumRenderDrivers;
|
SDL_GetNumRenderDrivers;
|
||||||
SDL_GetRenderDriverInfo;
|
|
||||||
SDL_CreateWindowAndRenderer;
|
SDL_CreateWindowAndRenderer;
|
||||||
SDL_CreateRenderer;
|
SDL_CreateRenderer;
|
||||||
SDL_CreateSoftwareRenderer;
|
SDL_CreateSoftwareRenderer;
|
||||||
|
@ -861,6 +860,7 @@ SDL3_0.0.0 {
|
||||||
SDL_GetTicksNS;
|
SDL_GetTicksNS;
|
||||||
SDL_DelayNS;
|
SDL_DelayNS;
|
||||||
SDL_GetEventState;
|
SDL_GetEventState;
|
||||||
|
SDL_GetRenderDriver;
|
||||||
# extra symbols go here (don't modify this line)
|
# extra symbols go here (don't modify this line)
|
||||||
local: *;
|
local: *;
|
||||||
};
|
};
|
||||||
|
|
|
@ -288,7 +288,6 @@
|
||||||
#define SDL_EnclosePoints SDL_EnclosePoints_REAL
|
#define SDL_EnclosePoints SDL_EnclosePoints_REAL
|
||||||
#define SDL_IntersectRectAndLine SDL_IntersectRectAndLine_REAL
|
#define SDL_IntersectRectAndLine SDL_IntersectRectAndLine_REAL
|
||||||
#define SDL_GetNumRenderDrivers SDL_GetNumRenderDrivers_REAL
|
#define SDL_GetNumRenderDrivers SDL_GetNumRenderDrivers_REAL
|
||||||
#define SDL_GetRenderDriverInfo SDL_GetRenderDriverInfo_REAL
|
|
||||||
#define SDL_CreateWindowAndRenderer SDL_CreateWindowAndRenderer_REAL
|
#define SDL_CreateWindowAndRenderer SDL_CreateWindowAndRenderer_REAL
|
||||||
#define SDL_CreateRenderer SDL_CreateRenderer_REAL
|
#define SDL_CreateRenderer SDL_CreateRenderer_REAL
|
||||||
#define SDL_CreateSoftwareRenderer SDL_CreateSoftwareRenderer_REAL
|
#define SDL_CreateSoftwareRenderer SDL_CreateSoftwareRenderer_REAL
|
||||||
|
@ -885,3 +884,4 @@
|
||||||
#define SDL_GetTicksNS SDL_GetTicksNS_REAL
|
#define SDL_GetTicksNS SDL_GetTicksNS_REAL
|
||||||
#define SDL_DelayNS SDL_DelayNS_REAL
|
#define SDL_DelayNS SDL_DelayNS_REAL
|
||||||
#define SDL_GetEventState SDL_GetEventState_REAL
|
#define SDL_GetEventState SDL_GetEventState_REAL
|
||||||
|
#define SDL_GetRenderDriver SDL_GetRenderDriver_REAL
|
||||||
|
|
|
@ -315,9 +315,8 @@ SDL_DYNAPI_PROC(void,SDL_UnionRect,(const SDL_Rect *a, const SDL_Rect *b, SDL_Re
|
||||||
SDL_DYNAPI_PROC(SDL_bool,SDL_EnclosePoints,(const SDL_Point *a, int b, const SDL_Rect *c, SDL_Rect *d),(a,b,c,d),return)
|
SDL_DYNAPI_PROC(SDL_bool,SDL_EnclosePoints,(const SDL_Point *a, int b, const SDL_Rect *c, SDL_Rect *d),(a,b,c,d),return)
|
||||||
SDL_DYNAPI_PROC(SDL_bool,SDL_IntersectRectAndLine,(const SDL_Rect *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return)
|
SDL_DYNAPI_PROC(SDL_bool,SDL_IntersectRectAndLine,(const SDL_Rect *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetNumRenderDrivers,(void),(),return)
|
SDL_DYNAPI_PROC(int,SDL_GetNumRenderDrivers,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetRenderDriverInfo,(int a, SDL_RendererInfo *b),(a,b),return)
|
|
||||||
SDL_DYNAPI_PROC(int,SDL_CreateWindowAndRenderer,(int a, int b, Uint32 c, SDL_Window **d, SDL_Renderer **e),(a,b,c,d,e),return)
|
SDL_DYNAPI_PROC(int,SDL_CreateWindowAndRenderer,(int a, int b, Uint32 c, SDL_Window **d, SDL_Renderer **e),(a,b,c,d,e),return)
|
||||||
SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateRenderer,(SDL_Window *a, int b, Uint32 c),(a,b,c),return)
|
SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateRenderer,(SDL_Window *a, const char *b, Uint32 c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateSoftwareRenderer,(SDL_Surface *a),(a),return)
|
SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateSoftwareRenderer,(SDL_Surface *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(SDL_Renderer*,SDL_GetRenderer,(SDL_Window *a),(a),return)
|
SDL_DYNAPI_PROC(SDL_Renderer*,SDL_GetRenderer,(SDL_Window *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetRendererInfo,(SDL_Renderer *a, SDL_RendererInfo *b),(a,b),return)
|
SDL_DYNAPI_PROC(int,SDL_GetRendererInfo,(SDL_Renderer *a, SDL_RendererInfo *b),(a,b),return)
|
||||||
|
@ -961,3 +960,4 @@ SDL_DYNAPI_PROC(void*,SDL_memset4,(void *a, Uint32 b, size_t c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(Uint64,SDL_GetTicksNS,(void),(),return)
|
SDL_DYNAPI_PROC(Uint64,SDL_GetTicksNS,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(void,SDL_DelayNS,(Uint64 a),(a),)
|
SDL_DYNAPI_PROC(void,SDL_DelayNS,(Uint64 a),(a),)
|
||||||
SDL_DYNAPI_PROC(Uint8,SDL_GetEventState,(Uint32 a),(a),return)
|
SDL_DYNAPI_PROC(Uint8,SDL_GetEventState,(Uint32 a),(a),return)
|
||||||
|
SDL_DYNAPI_PROC(const char*,SDL_GetRenderDriver,(int a),(a),return)
|
||||||
|
|
|
@ -642,17 +642,18 @@ int SDL_GetNumRenderDrivers(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_GetRenderDriverInfo(int index, SDL_RendererInfo *info)
|
const char *SDL_GetRenderDriver(int index)
|
||||||
{
|
{
|
||||||
#if !SDL_RENDER_DISABLED
|
#if !SDL_RENDER_DISABLED
|
||||||
if (index < 0 || index >= SDL_GetNumRenderDrivers()) {
|
if (index < 0 || index >= SDL_GetNumRenderDrivers()) {
|
||||||
return SDL_SetError("index must be in the range of 0 - %d",
|
SDL_SetError("index must be in the range of 0 - %d",
|
||||||
SDL_GetNumRenderDrivers() - 1);
|
SDL_GetNumRenderDrivers() - 1);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
*info = render_drivers[index]->info;
|
return render_drivers[index]->info.name;
|
||||||
return 0;
|
|
||||||
#else
|
#else
|
||||||
return SDL_SetError("SDL not built with rendering support");
|
SDL_SetError("SDL not built with rendering support");
|
||||||
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -862,7 +863,7 @@ int SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
*renderer = SDL_CreateRenderer(*window, -1, 0);
|
*renderer = SDL_CreateRenderer(*window, NULL, 0);
|
||||||
if (!*renderer) {
|
if (!*renderer) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -926,13 +927,14 @@ static void SDL_CalculateSimulatedVSyncInterval(SDL_Renderer *renderer, SDL_Wind
|
||||||
#endif /* !SDL_RENDER_DISABLED */
|
#endif /* !SDL_RENDER_DISABLED */
|
||||||
|
|
||||||
SDL_Renderer *
|
SDL_Renderer *
|
||||||
SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags)
|
SDL_CreateRenderer(SDL_Window *window, const char *name, Uint32 flags)
|
||||||
{
|
{
|
||||||
#if !SDL_RENDER_DISABLED
|
#if !SDL_RENDER_DISABLED
|
||||||
SDL_Renderer *renderer = NULL;
|
SDL_Renderer *renderer = NULL;
|
||||||
int n = SDL_GetNumRenderDrivers();
|
const int n = SDL_GetNumRenderDrivers();
|
||||||
SDL_bool batching = SDL_TRUE;
|
SDL_bool batching = SDL_TRUE;
|
||||||
const char *hint;
|
const char *hint;
|
||||||
|
int i;
|
||||||
|
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
Android_ActivityMutex_Lock_Running();
|
Android_ActivityMutex_Lock_Running();
|
||||||
|
@ -957,53 +959,39 @@ SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index < 0) {
|
if (!name) {
|
||||||
hint = SDL_GetHint(SDL_HINT_RENDER_DRIVER);
|
name = SDL_GetHint(SDL_HINT_RENDER_DRIVER);
|
||||||
if (hint) {
|
}
|
||||||
for (index = 0; index < n; ++index) {
|
|
||||||
const SDL_RenderDriver *driver = render_drivers[index];
|
|
||||||
|
|
||||||
if (SDL_strcasecmp(hint, driver->info.name) == 0) {
|
if (name) {
|
||||||
/* Create a new renderer instance */
|
for (i = 0; i < n; i++) {
|
||||||
renderer = driver->CreateRenderer(window, flags);
|
const SDL_RenderDriver *driver = render_drivers[i];
|
||||||
if (renderer) {
|
if (SDL_strcasecmp(name, driver->info.name) == 0) {
|
||||||
batching = SDL_FALSE;
|
/* Create a new renderer instance */
|
||||||
}
|
renderer = driver->CreateRenderer(window, flags);
|
||||||
|
if (renderer) {
|
||||||
|
batching = SDL_FALSE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
|
const SDL_RenderDriver *driver = render_drivers[i];
|
||||||
|
if ((driver->info.flags & flags) == flags) {
|
||||||
|
/* Create a new renderer instance */
|
||||||
|
renderer = driver->CreateRenderer(window, flags);
|
||||||
|
if (renderer) {
|
||||||
|
/* Yay, we got one! */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (renderer == NULL) {
|
if (renderer == NULL) {
|
||||||
for (index = 0; index < n; ++index) {
|
SDL_SetError("Couldn't find matching render driver");
|
||||||
const SDL_RenderDriver *driver = render_drivers[index];
|
goto error;
|
||||||
|
|
||||||
if ((driver->info.flags & flags) == flags) {
|
|
||||||
/* Create a new renderer instance */
|
|
||||||
renderer = driver->CreateRenderer(window, flags);
|
|
||||||
if (renderer) {
|
|
||||||
/* Yay, we got one! */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (renderer == NULL) {
|
|
||||||
SDL_SetError("Couldn't find matching render driver");
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (index >= n) {
|
|
||||||
SDL_SetError("index must be -1 or in the range of 0 - %d",
|
|
||||||
n - 1);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
/* Create a new renderer instance */
|
|
||||||
renderer = render_drivers[index]->CreateRenderer(window, flags);
|
|
||||||
batching = SDL_FALSE;
|
|
||||||
if (renderer == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((flags & SDL_RENDERER_PRESENTVSYNC) != 0) {
|
if ((flags & SDL_RENDERER_PRESENTVSYNC) != 0) {
|
||||||
|
|
|
@ -1196,16 +1196,13 @@ SDLTest_CommonInit(SDLTest_CommonState *state)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state->verbose & VERBOSE_RENDER) {
|
if (state->verbose & VERBOSE_RENDER) {
|
||||||
SDL_RendererInfo info;
|
|
||||||
|
|
||||||
n = SDL_GetNumRenderDrivers();
|
n = SDL_GetNumRenderDrivers();
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
SDL_Log("No built-in render drivers\n");
|
SDL_Log("No built-in render drivers\n");
|
||||||
} else {
|
} else {
|
||||||
SDL_Log("Built-in render drivers:\n");
|
SDL_Log("Built-in render drivers:\n");
|
||||||
for (i = 0; i < n; ++i) {
|
for (i = 0; i < n; ++i) {
|
||||||
SDL_GetRenderDriverInfo(i, &info);
|
SDL_Log(" %s\n", SDL_GetRenderDriver(i));
|
||||||
SDLTest_PrintRenderer(&info);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1310,25 +1307,8 @@ SDLTest_CommonInit(SDLTest_CommonState *state)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!state->skip_renderer && (state->renderdriver || !(state->window_flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_VULKAN | SDL_WINDOW_METAL)))) {
|
if (!state->skip_renderer && (state->renderdriver || !(state->window_flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_VULKAN | SDL_WINDOW_METAL)))) {
|
||||||
m = -1;
|
|
||||||
if (state->renderdriver) {
|
|
||||||
SDL_RendererInfo info;
|
|
||||||
n = SDL_GetNumRenderDrivers();
|
|
||||||
for (j = 0; j < n; ++j) {
|
|
||||||
SDL_GetRenderDriverInfo(j, &info);
|
|
||||||
if (SDL_strcasecmp(info.name, state->renderdriver) == 0) {
|
|
||||||
m = j;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (m == -1) {
|
|
||||||
SDL_Log("Couldn't find render driver named %s",
|
|
||||||
state->renderdriver);
|
|
||||||
return SDL_FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
state->renderers[i] = SDL_CreateRenderer(state->windows[i],
|
state->renderers[i] = SDL_CreateRenderer(state->windows[i],
|
||||||
m, state->render_flags);
|
state->renderdriver, state->render_flags);
|
||||||
if (!state->renderers[i]) {
|
if (!state->renderers[i]) {
|
||||||
SDL_Log("Couldn't create renderer: %s\n",
|
SDL_Log("Couldn't create renderer: %s\n",
|
||||||
SDL_GetError());
|
SDL_GetError());
|
||||||
|
|
|
@ -213,13 +213,7 @@ static int SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window, U
|
||||||
|
|
||||||
/* Check to see if there's a specific driver requested */
|
/* Check to see if there's a specific driver requested */
|
||||||
if (specific_accelerated_renderer) {
|
if (specific_accelerated_renderer) {
|
||||||
for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) {
|
renderer = SDL_CreateRenderer(window, hint, 0);
|
||||||
SDL_GetRenderDriverInfo(i, &info);
|
|
||||||
if (SDL_strcasecmp(info.name, hint) == 0) {
|
|
||||||
renderer = SDL_CreateRenderer(window, i, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (renderer == NULL || (SDL_GetRendererInfo(renderer, &info) == -1)) {
|
if (renderer == NULL || (SDL_GetRendererInfo(renderer, &info) == -1)) {
|
||||||
if (renderer) {
|
if (renderer) {
|
||||||
SDL_DestroyRenderer(renderer);
|
SDL_DestroyRenderer(renderer);
|
||||||
|
@ -228,10 +222,11 @@ static int SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window, U
|
||||||
}
|
}
|
||||||
/* if it was specifically requested, even if SDL_RENDERER_ACCELERATED isn't set, we'll accept this renderer. */
|
/* if it was specifically requested, even if SDL_RENDERER_ACCELERATED isn't set, we'll accept this renderer. */
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) {
|
const int total = SDL_GetNumRenderDrivers();
|
||||||
SDL_GetRenderDriverInfo(i, &info);
|
for (i = 0; i < total; ++i) {
|
||||||
if (SDL_strcmp(info.name, "software") != 0) {
|
const char *name = SDL_GetRenderDriver(i);
|
||||||
renderer = SDL_CreateRenderer(window, i, 0);
|
if (name && (SDL_strcmp(info.name, "software") != 0)) {
|
||||||
|
renderer = SDL_CreateRenderer(window, name, 0);
|
||||||
if (renderer && (SDL_GetRendererInfo(renderer, &info) == 0) && (info.flags & SDL_RENDERER_ACCELERATED)) {
|
if (renderer && (SDL_GetRendererInfo(renderer, &info) == 0) && (info.flags & SDL_RENDERER_ACCELERATED)) {
|
||||||
break; /* this will work. */
|
break; /* this will work. */
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,7 +273,7 @@ int main(int argc, char *argv[])
|
||||||
quit(2);
|
quit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
renderer = SDL_CreateRenderer(window, NULL, 0);
|
||||||
if (renderer == NULL) {
|
if (renderer == NULL) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n",
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n",
|
||||||
SDL_GetError());
|
SDL_GetError());
|
||||||
|
|
|
@ -262,7 +262,7 @@ int main(int argc, char *argv[])
|
||||||
/* On wayland, no window will actually show until something has
|
/* On wayland, no window will actually show until something has
|
||||||
actually been displayed.
|
actually been displayed.
|
||||||
*/
|
*/
|
||||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
renderer = SDL_CreateRenderer(window, NULL, 0);
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
|
|
||||||
#if __IOS__
|
#if __IOS__
|
||||||
|
|
|
@ -730,7 +730,7 @@ int main(int argc, char *argv[])
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
screen = SDL_CreateRenderer(window, -1, 0);
|
screen = SDL_CreateRenderer(window, NULL, 0);
|
||||||
if (screen == NULL) {
|
if (screen == NULL) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
|
||||||
return 2;
|
return 2;
|
||||||
|
|
|
@ -105,7 +105,7 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
window = SDL_CreateWindow("testaudiocapture", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 320, 240, 0);
|
window = SDL_CreateWindow("testaudiocapture", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 320, 240, 0);
|
||||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
renderer = SDL_CreateRenderer(window, NULL, 0);
|
||||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
|
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
|
||||||
SDL_RenderClear(renderer);
|
SDL_RenderClear(renderer);
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
|
|
|
@ -45,7 +45,7 @@ void InitCreateRenderer(void *arg)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
|
renderer = SDL_CreateRenderer(window, NULL, SDL_RENDERER_ACCELERATED);
|
||||||
SDLTest_AssertPass("SDL_CreateRenderer()");
|
SDLTest_AssertPass("SDL_CreateRenderer()");
|
||||||
SDLTest_AssertCheck(renderer != NULL, "Check SDL_CreateRenderer result");
|
SDLTest_AssertCheck(renderer != NULL, "Check SDL_CreateRenderer result");
|
||||||
if (renderer == NULL) {
|
if (renderer == NULL) {
|
||||||
|
|
|
@ -892,7 +892,7 @@ int main(int argc, char *argv[])
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
screen = SDL_CreateRenderer(window, -1, 0);
|
screen = SDL_CreateRenderer(window, NULL, 0);
|
||||||
if (screen == NULL) {
|
if (screen == NULL) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
|
||||||
SDL_DestroyWindow(window);
|
SDL_DestroyWindow(window);
|
||||||
|
|
|
@ -76,7 +76,7 @@ int main(int argc, char **argv)
|
||||||
/* !!! FIXME: check for errors. */
|
/* !!! FIXME: check for errors. */
|
||||||
SDL_Init(SDL_INIT_VIDEO);
|
SDL_Init(SDL_INIT_VIDEO);
|
||||||
window = SDL_CreateWindow("Drag the red boxes", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE);
|
window = SDL_CreateWindow("Drag the red boxes", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE);
|
||||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
renderer = SDL_CreateRenderer(window, NULL, 0);
|
||||||
|
|
||||||
if (SDL_SetWindowHitTest(window, hitTest, NULL) == -1) {
|
if (SDL_SetWindowHitTest(window, hitTest, NULL) == -1) {
|
||||||
SDL_Log("Enabling hit-testing failed!\n");
|
SDL_Log("Enabling hit-testing failed!\n");
|
||||||
|
|
|
@ -291,7 +291,7 @@ int main(int argc, char *argv[])
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
screen = SDL_CreateRenderer(window, -1, 0);
|
screen = SDL_CreateRenderer(window, NULL, 0);
|
||||||
if (screen == NULL) {
|
if (screen == NULL) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
|
||||||
SDL_DestroyWindow(window);
|
SDL_DestroyWindow(window);
|
||||||
|
|
|
@ -187,7 +187,7 @@ int main(int argc, char *argv[])
|
||||||
/* On wayland, no window will actually show until something has
|
/* On wayland, no window will actually show until something has
|
||||||
actually been displayed.
|
actually been displayed.
|
||||||
*/
|
*/
|
||||||
SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, 0);
|
SDL_Renderer *renderer = SDL_CreateRenderer(window, NULL, 0);
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
|
|
||||||
success = SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
success = SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
||||||
|
|
|
@ -271,7 +271,7 @@ int main(int argc, char *argv[])
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
renderer = SDL_CreateRenderer(window, NULL, 0);
|
||||||
if (renderer == NULL) {
|
if (renderer == NULL) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
|
||||||
SDL_DestroyWindow(window);
|
SDL_DestroyWindow(window);
|
||||||
|
|
|
@ -134,7 +134,7 @@ int main(int argc, char *argv[])
|
||||||
SDL_SetWindowTitle(window, "SDL Native Window Test");
|
SDL_SetWindowTitle(window, "SDL Native Window Test");
|
||||||
|
|
||||||
/* Create the renderer */
|
/* Create the renderer */
|
||||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
renderer = SDL_CreateRenderer(window, NULL, 0);
|
||||||
if (renderer == NULL) {
|
if (renderer == NULL) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
|
||||||
quit(5);
|
quit(5);
|
||||||
|
|
|
@ -118,7 +118,7 @@ int main(int argc, char *argv[])
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
renderer = SDL_CreateRenderer(window, NULL, 0);
|
||||||
|
|
||||||
if (renderer == NULL) {
|
if (renderer == NULL) {
|
||||||
SDL_Log("Couldn't create renderer: %s\n",
|
SDL_Log("Couldn't create renderer: %s\n",
|
||||||
|
|
|
@ -113,7 +113,7 @@ int main(int argc, char **argv)
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create shaped window for SDL_Shape.");
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create shaped window for SDL_Shape.");
|
||||||
exit(-4);
|
exit(-4);
|
||||||
}
|
}
|
||||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
renderer = SDL_CreateRenderer(window, NULL, 0);
|
||||||
if (renderer == NULL) {
|
if (renderer == NULL) {
|
||||||
SDL_DestroyWindow(window);
|
SDL_DestroyWindow(window);
|
||||||
for (i = 0; i < num_pictures; i++) {
|
for (i = 0; i < num_pictures; i++) {
|
||||||
|
|
|
@ -164,7 +164,7 @@ int main(int argc, char **argv)
|
||||||
quit(3);
|
quit(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
renderer = SDL_CreateRenderer(window, NULL, 0);
|
||||||
if (renderer == NULL) {
|
if (renderer == NULL) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create renderer: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create renderer: %s\n", SDL_GetError());
|
||||||
quit(4);
|
quit(4);
|
||||||
|
|
|
@ -358,7 +358,7 @@ int main(int argc, char **argv)
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
renderer = SDL_CreateRenderer(window, NULL, 0);
|
||||||
if (renderer == NULL) {
|
if (renderer == NULL) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
|
||||||
return 4;
|
return 4;
|
||||||
|
|
Loading…
Reference in New Issue