From eb3bf80f9c6a338f4b936d0395477ab154c70cc5 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 21 Sep 2021 18:15:09 -0700 Subject: [PATCH] Fixed compiler warnings using Visual Studio 2019 --- src/render/opengl/SDL_render_gl.c | 2 +- test/testsprite2.c | 60 +++++++++++++++---------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index d58ef1d6a..23a905dbe 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -1459,7 +1459,7 @@ GL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic } { - int j; + size_t j; float currentColor[4]; data->glGetFloatv(GL_CURRENT_COLOR, currentColor); data->glBegin(GL_TRIANGLES); diff --git a/test/testsprite2.c b/test/testsprite2.c index dc48b1e9e..b6ad159b2 100644 --- a/test/testsprite2.c +++ b/test/testsprite2.c @@ -188,22 +188,22 @@ MoveSprites(SDL_Renderer * renderer, SDL_Texture * sprite) color.b = 0xFF; color.a = 0xFF; - verts[0].position.x = temp.x; - verts[0].position.y = temp.y; + verts[0].position.x = (float)temp.x; + verts[0].position.y = (float)temp.y; verts[0].color = color; - verts[1].position.x = temp.x + temp.w; - verts[1].position.y = temp.y; + verts[1].position.x = (float)temp.x + temp.w; + verts[1].position.y = (float)temp.y; verts[1].color = color; - verts[2].position.x = temp.x + temp.w; - verts[2].position.y = temp.y + temp.h; + verts[2].position.x = (float)temp.x + temp.w; + verts[2].position.y = (float)temp.y + temp.h; verts[2].color = color; SDL_RenderGeometry(renderer, NULL, verts, 3, NULL, 0); - verts[1].position.x = temp.x; - verts[1].position.y = temp.y + temp.h; + verts[1].position.x = (float)temp.x; + verts[1].position.y = (float)temp.y + temp.h; verts[1].color = color; SDL_RenderGeometry(renderer, NULL, verts, 3, NULL, 0); @@ -289,43 +289,43 @@ MoveSprites(SDL_Renderer * renderer, SDL_Texture * sprite) for (i = 0; i < num_sprites; ++i) { position = &positions[i]; /* 0 */ - verts->position.x = position->x; - verts->position.y = position->y; + verts->position.x = (float)position->x; + verts->position.y = (float)position->y; verts->color = color; verts->tex_coord.x = 0.0f; verts->tex_coord.y = 0.0f; verts++; /* 1 */ - verts->position.x = position->x + position->w; - verts->position.y = position->y; + verts->position.x = (float)position->x + position->w; + verts->position.y = (float)position->y; verts->color = color; verts->tex_coord.x = 1.0f; verts->tex_coord.y = 0.0f; verts++; /* 2 */ - verts->position.x = position->x + position->w; - verts->position.y = position->y + position->h; + verts->position.x = (float)position->x + position->w; + verts->position.y = (float)position->y + position->h; verts->color = color; verts->tex_coord.x = 1.0f; verts->tex_coord.y = 1.0f; verts++; /* 0 */ - verts->position.x = position->x; - verts->position.y = position->y; + verts->position.x = (float)position->x; + verts->position.y = (float)position->y; verts->color = color; verts->tex_coord.x = 0.0f; verts->tex_coord.y = 0.0f; verts++; /* 2 */ - verts->position.x = position->x + position->w; - verts->position.y = position->y + position->h; + verts->position.x = (float)position->x + position->w; + verts->position.y = (float)position->y + position->h; verts->color = color; verts->tex_coord.x = 1.0f; verts->tex_coord.y = 1.0f; verts++; /* 3 */ - verts->position.x = position->x; - verts->position.y = position->y + position->h; + verts->position.x = (float)position->x; + verts->position.y = (float)position->y + position->h; verts->color = color; verts->tex_coord.x = 0.0f; verts->tex_coord.y = 1.0f; @@ -360,36 +360,36 @@ MoveSprites(SDL_Renderer * renderer, SDL_Texture * sprite) for (i = 0; i < num_sprites; ++i) { position = &positions[i]; /* 0 */ - verts->position.x = position->x; - verts->position.y = position->y; + verts->position.x = (float)position->x; + verts->position.y = (float)position->y; verts->color = color; verts->tex_coord.x = 0.0f; verts->tex_coord.y = 0.0f; verts++; /* 1 */ - verts->position.x = position->x + position->w; - verts->position.y = position->y; + verts->position.x = (float)position->x + position->w; + verts->position.y = (float)position->y; verts->color = color; verts->tex_coord.x = 1.0f; verts->tex_coord.y = 0.0f; verts++; /* 2 */ - verts->position.x = position->x + position->w / 2.0f; - verts->position.y = position->y + position->h / 2.0f; + verts->position.x = (float)position->x + position->w / 2.0f; + verts->position.y = (float)position->y + position->h / 2.0f; verts->color = color; verts->tex_coord.x = 0.5f; verts->tex_coord.y = 0.5f; verts++; /* 3 */ - verts->position.x = position->x; - verts->position.y = position->y + position->h; + verts->position.x = (float)position->x; + verts->position.y = (float)position->y + position->h; verts->color = color; verts->tex_coord.x = 0.0f; verts->tex_coord.y = 1.0f; verts++; /* 4 */ - verts->position.x = position->x + position->w; - verts->position.y = position->y + position->h; + verts->position.x = (float)position->x + position->w; + verts->position.y = (float)position->y + position->h; verts->color = color; verts->tex_coord.x = 1.0f; verts->tex_coord.y = 1.0f;