less string hardcoding

This commit is contained in:
Mylloon 2023-05-08 11:28:57 +02:00
parent c4c49aa04a
commit b07c614411
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -4,6 +4,9 @@ static GLuint _pId = 0;
static GLuint _texId = 0; static GLuint _texId = 0;
static GLuint _quadId = 0; static GLuint _quadId = 0;
static const char matrix_modview[] = "modview";
static const char matrix_proj[] = "proj";
static void init(void); static void init(void);
static void draw(void); static void draw(void);
@ -25,8 +28,8 @@ void credits(int state) {
static void init(void) { static void init(void) {
_pId = gl4duCreateProgram("<vs>shaders/credits.vs", "<fs>shaders/credits.fs", _pId = gl4duCreateProgram("<vs>shaders/credits.vs", "<fs>shaders/credits.fs",
NULL); NULL);
gl4duGenMatrix(GL_FLOAT, "modview"); gl4duGenMatrix(GL_FLOAT, matrix_modview);
gl4duGenMatrix(GL_FLOAT, "proj"); gl4duGenMatrix(GL_FLOAT, matrix_proj);
_quadId = gl4dgGenQuadf(); _quadId = gl4dgGenQuadf();
// Code utilisé en tant qu'erreur de TTF_Font // Code utilisé en tant qu'erreur de TTF_Font
@ -66,11 +69,11 @@ static void draw(void) {
d = -1.1f + .25f * t; d = -1.1f + .25f * t;
GLfloat ratio = (GLfloat)_dims[0] / (GLfloat)_dims[1]; GLfloat ratio = (GLfloat)_dims[0] / (GLfloat)_dims[1];
gl4duBindMatrix("proj"); gl4duBindMatrix(matrix_proj);
gl4duLoadIdentityf(); gl4duLoadIdentityf();
gl4duFrustumf(-ratio, ratio, -1, 1, 2, 100); gl4duFrustumf(-ratio, ratio, -1, 1, 2, 100);
gl4duBindMatrix("modview"); gl4duBindMatrix(matrix_modview);
gl4duLoadIdentityf(); gl4duLoadIdentityf();
gl4duTranslatef(0.f, d, -2.f); gl4duTranslatef(0.f, d, -2.f);