test/testgles2_sdf.c: type fixes from commit e26e893daf, style clean-up.

This commit is contained in:
Ozkan Sezer 2023-05-19 17:00:24 +03:00
parent d361acdd4e
commit feeec90873

View file

@ -16,6 +16,7 @@
#endif #endif
#include "SDL_test_common.h" #include "SDL_test_common.h"
#include "testutils.h"
#if defined(__IPHONEOS__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(__NACL__) \ #if defined(__IPHONEOS__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(__NACL__) \
|| defined(__WINDOWS__) || defined(__LINUX__) || defined(__WINDOWS__) || defined(__LINUX__)
@ -26,8 +27,6 @@
#include "SDL_opengles2.h" #include "SDL_opengles2.h"
#include "testutils.h"
typedef struct GLES2_Context typedef struct GLES2_Context
{ {
#define SDL_PROC(ret, func, params) ret (APIENTRY *func) params; #define SDL_PROC(ret, func, params) ret (APIENTRY *func) params;
@ -127,7 +126,7 @@ quit(int rc)
* shader_type: Passed to GL, e.g. GL_VERTEX_SHADER. * shader_type: Passed to GL, e.g. GL_VERTEX_SHADER.
*/ */
void void
process_shader(GLint *shader, const char *source, GLenum shader_type) process_shader(GLenum *shader, const char *source, GLenum shader_type)
{ {
GLint status = GL_FALSE; GLint status = GL_FALSE;
const char *shaders[1] = { NULL }; const char *shaders[1] = { NULL };
@ -245,7 +244,8 @@ static float matrix_mvp[4][4];
typedef struct shader_data typedef struct shader_data
{ {
GLint shader_program, shader_frag, shader_vert; GLint shader_program;
GLenum shader_frag, shader_vert;
GLint attr_position; GLint attr_position;
GLint attr_color, attr_mvp; GLint attr_color, attr_mvp;
@ -294,8 +294,8 @@ void renderCopy_position(SDL_Rect *srcrect, SDL_Rect *dstrect)
minx = (GLfloat)dstrect->x; minx = (GLfloat)dstrect->x;
miny = (GLfloat)dstrect->y; miny = (GLfloat)dstrect->y;
maxx = (GLfloat)dstrect->x + dstrect->w; maxx = (GLfloat)(dstrect->x + dstrect->w);
maxy = (GLfloat)dstrect->y + dstrect->h; maxy = (GLfloat)(dstrect->y + dstrect->h);
minu = (GLfloat) srcrect->x / (GLfloat)g_surf_sdf->w; minu = (GLfloat) srcrect->x / (GLfloat)g_surf_sdf->w;
maxu = (GLfloat) (srcrect->x + srcrect->w) / (GLfloat)g_surf_sdf->w; maxu = (GLfloat) (srcrect->x + srcrect->w) / (GLfloat)g_surf_sdf->w;
@ -339,28 +339,25 @@ void loop()
{ {
const int sym = event.key.keysym.sym; const int sym = event.key.keysym.sym;
if (sym == SDLK_TAB) { if (sym == SDLK_TAB) {
SDL_Log("Tab"); SDL_Log("Tab");
} }
if (sym == SDLK_LEFT) {
if (sym == SDLK_LEFT) { g_val -= 0.05f;
g_val -= 0.05f; }
} if (sym == SDLK_RIGHT) {
if (sym == SDLK_RIGHT) { g_val += 0.05f;
g_val += 0.05f; }
} if (sym == SDLK_UP) {
if (sym == SDLK_UP) { g_angle -= 1.0f;
g_angle -= 1.0f; }
} if (sym == SDLK_DOWN) {
if (sym == SDLK_DOWN) { g_angle += 1.0f;
g_angle += 1.0f;
}
break;
} }
break; break;
}
case SDL_WINDOWEVENT: case SDL_WINDOWEVENT:
switch (event.window.event) { switch (event.window.event) {