mirror of
https://github.com/libsdl-org/SDL.git
synced 2024-11-30 15:23:28 +08:00
SDL_CreateWindowAndRenderer() takes the window title as the first parameter
Fixes https://github.com/libsdl-org/SDL/issues/9626
This commit is contained in:
parent
2d7cc6ded0
commit
14f584a94b
@ -1092,6 +1092,8 @@ which index is the "opengl" or whatnot driver, you can just pass that string dir
|
||||
here, now. Passing NULL is the same as passing -1 here in SDL2, to signify you want SDL
|
||||
to decide for you.
|
||||
|
||||
SDL_CreateWindowAndRenderer() now takes the window title as the first parameter.
|
||||
|
||||
Mouse and touch events are no longer filtered to change their coordinates, instead you
|
||||
can call SDL_ConvertEventToRenderCoordinates() to explicitly map event coordinates into
|
||||
the rendering viewport.
|
||||
|
@ -196,6 +196,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetRenderDriver(int index);
|
||||
/**
|
||||
* Create a window and default renderer.
|
||||
*
|
||||
* \param title the title of the window, in UTF-8 encoding
|
||||
* \param width the width of the window
|
||||
* \param height the height of the window
|
||||
* \param window_flags the flags used to create the window (see
|
||||
@ -210,7 +211,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetRenderDriver(int index);
|
||||
* \sa SDL_CreateRenderer
|
||||
* \sa SDL_CreateWindow
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(int width, int height, SDL_WindowFlags window_flags, SDL_Window **window, SDL_Renderer **renderer);
|
||||
extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(const char *title, int width, int height, SDL_WindowFlags window_flags, SDL_Window **window, SDL_Renderer **renderer);
|
||||
|
||||
/**
|
||||
* Create a 2D rendering context for a window.
|
||||
|
@ -151,7 +151,7 @@ SDL_DYNAPI_PROC(SDL_Texture*,SDL_CreateTexture,(SDL_Renderer *a, SDL_PixelFormat
|
||||
SDL_DYNAPI_PROC(SDL_Texture*,SDL_CreateTextureFromSurface,(SDL_Renderer *a, SDL_Surface *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_Texture*,SDL_CreateTextureWithProperties,(SDL_Renderer *a, SDL_PropertiesID b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_Window*,SDL_CreateWindow,(const char *a, int b, int c, Uint32 d),(a,b,c,d),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,(const char *a, int b, int c, Uint32 d, SDL_Window **e, SDL_Renderer **f),(a,b,c,d,e,f),return)
|
||||
SDL_DYNAPI_PROC(SDL_Window*,SDL_CreateWindowWithProperties,(SDL_PropertiesID a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_CursorVisible,(void),(),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_DXGIGetOutputInfo,(SDL_DisplayID a, int *b, int *c),(a,b,c),return)
|
||||
|
@ -826,7 +826,7 @@ static int SDLCALL SDL_RendererEventWatch(void *userdata, SDL_Event *event)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SDL_CreateWindowAndRenderer(int width, int height, SDL_WindowFlags window_flags, SDL_Window **window, SDL_Renderer **renderer)
|
||||
int SDL_CreateWindowAndRenderer(const char *title, int width, int height, SDL_WindowFlags window_flags, SDL_Window **window, SDL_Renderer **renderer)
|
||||
{
|
||||
SDL_bool hidden = (window_flags & SDL_WINDOW_HIDDEN) != 0;
|
||||
|
||||
@ -840,7 +840,7 @@ int SDL_CreateWindowAndRenderer(int width, int height, SDL_WindowFlags window_fl
|
||||
|
||||
// Hide the window so if the renderer recreates it, we don't get a visual flash on screen
|
||||
window_flags |= SDL_WINDOW_HIDDEN;
|
||||
*window = SDL_CreateWindow(NULL, width, height, window_flags);
|
||||
*window = SDL_CreateWindow(title, width, height, window_flags);
|
||||
if (!*window) {
|
||||
*renderer = NULL;
|
||||
return -1;
|
||||
|
@ -69,7 +69,7 @@ int SDL_AppInit(void **appstate, int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (SDL_CreateWindowAndRenderer(320, 240, 0, &window, &renderer) < 0) {
|
||||
if (SDL_CreateWindowAndRenderer("testaudiocapture", 320, 240, 0, &window, &renderer) < 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create SDL window and renderer: %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ int main(int argc, char *argv[]) {
|
||||
SDL_Log("SDL_Init failed (%s)", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
if (SDL_CreateWindowAndRenderer(640, 480, 0, &w, &r) < 0) {
|
||||
if (SDL_CreateWindowAndRenderer("testdialog", 640, 480, 0, &w, &r) < 0) {
|
||||
SDL_Log("Failed to create window and/or renderer: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
|
@ -122,15 +122,11 @@ int main(int argc, char *argv[])
|
||||
goto quit;
|
||||
}
|
||||
|
||||
if (SDL_CreateWindowAndRenderer(WINDOW_WIDTH, WINDOW_HEIGHT, 0, &window, &renderer) < 0) {
|
||||
if (SDL_CreateWindowAndRenderer("testspriteminimal", WINDOW_WIDTH, WINDOW_HEIGHT, 0, &window, &renderer) < 0) {
|
||||
return_code = 2;
|
||||
goto quit;
|
||||
}
|
||||
|
||||
if (SDL_SetWindowTitle(window, argv[0]) < 0) {
|
||||
SDL_Log("SDL_SetWindowTitle: %s", SDL_GetError());
|
||||
}
|
||||
|
||||
sprite = CreateTexture(renderer, icon_bmp, icon_bmp_len, &sprite_w, &sprite_h);
|
||||
|
||||
if (!sprite) {
|
||||
|
Loading…
Reference in New Issue
Block a user