mirror of
https://github.com/love2d/megasource.git
synced 2026-08-17 19:24:09 +02:00
update SDL3 to latest commit
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
|
||||
/* Simple program: draw a RGB triangle, with texture */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "testutils.h"
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
@@ -21,11 +23,8 @@
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
static SDLTest_CommonState *state;
|
||||
static SDL_bool use_texture = SDL_FALSE;
|
||||
static bool use_texture = false;
|
||||
static SDL_Texture **sprites;
|
||||
static SDL_BlendMode blendMode = SDL_BLENDMODE_NONE;
|
||||
static float angle = 0.0f;
|
||||
@@ -53,11 +52,11 @@ static int LoadSprite(const char *file)
|
||||
|
||||
for (i = 0; i < state->num_windows; ++i) {
|
||||
/* This does the SDL_LoadBMP step repeatedly, but that's OK for test code. */
|
||||
sprites[i] = LoadTexture(state->renderers[i], file, SDL_TRUE, &sprite_w, &sprite_h);
|
||||
sprites[i] = LoadTexture(state->renderers[i], file, true, &sprite_w, &sprite_h);
|
||||
if (!sprites[i]) {
|
||||
return -1;
|
||||
}
|
||||
if (SDL_SetTextureBlendMode(sprites[i], blendMode) < 0) {
|
||||
if (!SDL_SetTextureBlendMode(sprites[i], blendMode)) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s\n", SDL_GetError());
|
||||
SDL_DestroyTexture(sprites[i]);
|
||||
return -1;
|
||||
@@ -96,13 +95,13 @@ static void loop(void)
|
||||
}
|
||||
}
|
||||
} else if (event.type == SDL_EVENT_KEY_DOWN) {
|
||||
if (event.key.keysym.sym == SDLK_LEFT) {
|
||||
if (event.key.key == SDLK_LEFT) {
|
||||
translate_cx -= 1;
|
||||
} else if (event.key.keysym.sym == SDLK_RIGHT) {
|
||||
} else if (event.key.key == SDLK_RIGHT) {
|
||||
translate_cx += 1;
|
||||
} else if (event.key.keysym.sym == SDLK_UP) {
|
||||
} else if (event.key.key == SDLK_UP) {
|
||||
translate_cy -= 1;
|
||||
} else if (event.key.keysym.sym == SDLK_DOWN) {
|
||||
} else if (event.key.key == SDLK_DOWN) {
|
||||
translate_cy += 1;
|
||||
} else {
|
||||
SDLTest_CommonEvent(state, &event, &done);
|
||||
@@ -195,9 +194,6 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Enable standard application logging */
|
||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||
|
||||
for (i = 1; i < argc;) {
|
||||
int consumed;
|
||||
|
||||
@@ -224,7 +220,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
} else if (SDL_strcasecmp(argv[i], "--use-texture") == 0) {
|
||||
use_texture = SDL_TRUE;
|
||||
use_texture = true;
|
||||
consumed = 1;
|
||||
}
|
||||
}
|
||||
@@ -260,8 +256,6 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
srand((unsigned int)time(NULL));
|
||||
|
||||
/* Main render loop */
|
||||
frames = 0;
|
||||
then = SDL_GetTicks();
|
||||
|
||||
Reference in New Issue
Block a user