update SDL3 from 3.2.20 to 3.4.2
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright 2022 Collabora Ltd.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@@ -63,7 +63,7 @@ char *GetResourceFilename(const char *user_specified, const char *def)
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the .bmp file whose name is file, from the SDL_GetBasePath() if
|
||||
* Load the .png file whose name is file, from the SDL_GetBasePath() if
|
||||
* possible or the current working directory if not.
|
||||
*
|
||||
* If transparent is true, set the transparent colour from the top left pixel.
|
||||
@@ -72,7 +72,7 @@ char *GetResourceFilename(const char *user_specified, const char *def)
|
||||
*
|
||||
* If height_out is non-NULL, set it to the texture height.
|
||||
*/
|
||||
SDL_Texture *LoadTexture(SDL_Renderer *renderer, const char *file, bool transparent, int *width_out, int *height_out)
|
||||
SDL_Texture *LoadTexture(SDL_Renderer *renderer, const char *file, bool transparent)
|
||||
{
|
||||
SDL_Surface *temp = NULL;
|
||||
SDL_Texture *texture = NULL;
|
||||
@@ -84,7 +84,7 @@ SDL_Texture *LoadTexture(SDL_Renderer *renderer, const char *file, bool transpar
|
||||
file = path;
|
||||
}
|
||||
|
||||
temp = SDL_LoadBMP(file);
|
||||
temp = SDL_LoadSurface(file);
|
||||
if (!temp) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError());
|
||||
} else {
|
||||
@@ -117,22 +117,12 @@ SDL_Texture *LoadTexture(SDL_Renderer *renderer, const char *file, bool transpar
|
||||
}
|
||||
}
|
||||
|
||||
if (width_out) {
|
||||
*width_out = temp->w;
|
||||
}
|
||||
|
||||
if (height_out) {
|
||||
*height_out = temp->h;
|
||||
}
|
||||
|
||||
texture = SDL_CreateTextureFromSurface(renderer, temp);
|
||||
if (!texture) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s", SDL_GetError());
|
||||
}
|
||||
}
|
||||
SDL_DestroySurface(temp);
|
||||
if (path) {
|
||||
SDL_free(path);
|
||||
}
|
||||
SDL_free(path);
|
||||
return texture;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user