diff --git a/includes/animations.h b/includes/animations.h index 68659e3..5963fa7 100644 --- a/includes/animations.h +++ b/includes/animations.h @@ -1,8 +1,6 @@ #ifndef DEMO_ANIMATION_H #define DEMO_ANIMATION_H 1 -#include - #include "audio.h" #include "font.h" #include "utils.h" diff --git a/includes/utils.h b/includes/utils.h index 286d8d5..ca33eb7 100644 --- a/includes/utils.h +++ b/includes/utils.h @@ -1,9 +1,12 @@ #ifndef DEMO_UTILS_H #define DEMO_UTILS_H 1 -#include +#include // Récupère un delta-temps double get_dt(double *, GLboolean); +// Bind and load a matrix +void bindAndLoadf(const char *name); + #endif diff --git a/src/credits.c b/src/credits.c index 949ab31..0e2e23a 100644 --- a/src/credits.c +++ b/src/credits.c @@ -67,12 +67,10 @@ static void draw(void) { GLfloat dt = .25f * (GLfloat)get_dt(&t0, GL_FALSE) - 1.1f; GLfloat ratio = (GLfloat)_dims[0] / (GLfloat)_dims[1]; - gl4duBindMatrix(matrix_proj); - gl4duLoadIdentityf(); + bindAndLoadf(matrix_proj); gl4duFrustumf(-ratio, ratio, -1, 1, 2, 100); - gl4duBindMatrix(matrix_modview); - gl4duLoadIdentityf(); + bindAndLoadf(matrix_modview); gl4duTranslatef(0.f, dt, -2.f); glActiveTexture(GL_TEXTURE0); diff --git a/src/utils.c b/src/utils.c index e9cae7b..f07416d 100644 --- a/src/utils.c +++ b/src/utils.c @@ -8,3 +8,8 @@ double get_dt(double *t0, GLboolean override_t0) { return dt; } + +void bindAndLoadf(const char *name) { + gl4duBindMatrix(name); + gl4duLoadIdentityf(); +}