mirror of
https://github.com/love2d/megasource.git
synced 2026-08-20 12:40:06 +02:00
update SDL3 to latest commit
This commit is contained in:
@@ -26,7 +26,7 @@ static SDLTest_CommonState *state;
|
||||
|
||||
static SDL_Rect viewport;
|
||||
static int done, j;
|
||||
static SDL_bool use_target = SDL_FALSE;
|
||||
static bool use_target = false;
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
static Uint32 wait_start;
|
||||
#endif
|
||||
@@ -48,7 +48,6 @@ static void DrawOnViewport(SDL_Renderer *renderer)
|
||||
{
|
||||
SDL_FRect rect;
|
||||
SDL_Rect cliprect;
|
||||
int w, h;
|
||||
|
||||
/* Set the viewport */
|
||||
SDL_SetRenderViewport(renderer, &viewport);
|
||||
@@ -91,15 +90,11 @@ static void DrawOnViewport(SDL_Renderer *renderer)
|
||||
SDL_RenderFillRect(renderer, &rect);
|
||||
|
||||
/* Add a clip rect and fill it with the sprite */
|
||||
SDL_QueryTexture(sprite, NULL, NULL, &w, &h);
|
||||
cliprect.x = (viewport.w - w) / 2;
|
||||
cliprect.y = (viewport.h - h) / 2;
|
||||
cliprect.w = w;
|
||||
cliprect.h = h;
|
||||
rect.x = (float)cliprect.x;
|
||||
rect.y = (float)cliprect.y;
|
||||
rect.w = (float)cliprect.w;
|
||||
rect.h = (float)cliprect.h;
|
||||
cliprect.x = (viewport.w - sprite->w) / 2;
|
||||
cliprect.y = (viewport.h - sprite->h) / 2;
|
||||
cliprect.w = sprite->w;
|
||||
cliprect.h = sprite->h;
|
||||
SDL_RectToFRect(&cliprect, &rect);
|
||||
SDL_SetRenderClipRect(renderer, &cliprect);
|
||||
SDL_RenderTexture(renderer, sprite, NULL, &rect);
|
||||
SDL_SetRenderClipRect(renderer, NULL);
|
||||
@@ -174,7 +169,7 @@ int main(int argc, char *argv[])
|
||||
if (consumed == 0) {
|
||||
consumed = -1;
|
||||
if (SDL_strcasecmp(argv[i], "--target") == 0) {
|
||||
use_target = SDL_TRUE;
|
||||
use_target = true;
|
||||
consumed = 1;
|
||||
}
|
||||
}
|
||||
@@ -189,7 +184,7 @@ int main(int argc, char *argv[])
|
||||
quit(2);
|
||||
}
|
||||
|
||||
sprite = LoadTexture(state->renderers[0], "icon.bmp", SDL_TRUE, &sprite_w, &sprite_h);
|
||||
sprite = LoadTexture(state->renderers[0], "icon.bmp", true, &sprite_w, &sprite_h);
|
||||
|
||||
if (!sprite) {
|
||||
quit(2);
|
||||
|
||||
Reference in New Issue
Block a user