diff --git a/includes/animations.h b/includes/animations.h index 928c7b1..85418ca 100644 --- a/includes/animations.h +++ b/includes/animations.h @@ -9,13 +9,13 @@ extern GLuint _dims[]; // Scène de manifestation -void manif(int); +void manif(const int); // Scène du tag sur le mur -void tag(int); +void tag(const int); // Crédits de fin -void credits(int); +void credits(const int); // Initialisation des transitions void transitions_init(void); diff --git a/includes/font.h b/includes/font.h index 0fe2417..a4db1e7 100644 --- a/includes/font.h +++ b/includes/font.h @@ -11,7 +11,7 @@ * Renvoie 2 en cas de problème de chargement de la police * * Renvoie 0 en cas de succès */ -int initFont(TTF_Font **, char *, int); +int initFont(TTF_Font **, const char *, const int); /* Ecris un texte sur une texture * @@ -20,7 +20,8 @@ int initFont(TTF_Font **, char *, int); * Renvoie 2 en cas de problème de surface avec la SDL * * Renvoie 0 en cas de succès */ -int writeText(GLuint *, TTF_Font *, const char *, SDL_Color, GLuint *); +int writeText(GLuint *, TTF_Font *, const char *, const SDL_Color, + const GLuint *); // Libère une police de la mémoire void freeFont(TTF_Font *); diff --git a/includes/utils.h b/includes/utils.h index 0599708..9885997 100644 --- a/includes/utils.h +++ b/includes/utils.h @@ -7,7 +7,7 @@ #include // Récupère un delta-temps -double get_dt(double *, GLboolean); +double get_dt(double *, const GLboolean); // Bind and load a matrix void bindAndLoadf(const char *name); @@ -25,15 +25,15 @@ void bindAndLoadf(const char *name); * `+z` => move closer * * `-z` => move away */ -void move(GLfloat x, GLfloat y, GLfloat z); +void move(const GLfloat x, const GLfloat y, const GLfloat z); // Rotate a vector XYZ -void rotate_vec(GLfloat *, GLfloat); +void rotate_vec(GLfloat *, const GLfloat); // Load an image into a GL texture -void load_img(const char *filename, GLuint texture); +void load_img(const char *filename, const GLuint texture); // Copy a texture -void copy_texture(GLuint, GLuint); +void copy_texture(const GLuint, const GLuint); #endif diff --git a/main.c b/main.c index 54fea18..3fcec86 100644 --- a/main.c +++ b/main.c @@ -11,7 +11,7 @@ GLuint _dims[] = {1280, 720}; static void init(void); static void closure(void); -int main(int argc, char *argv[]) { +int main(const int argc, char *argv[]) { if (!gl4duwCreateWindow(argc, argv, "Demo API8 2023", GL4DW_POS_CENTERED, GL4DW_POS_CENTERED, _dims[0], _dims[1], GL4DW_OPENGL | GL4DW_SHOWN)) { diff --git a/src/credits.c b/src/credits.c index c8e5e8b..f8628ee 100644 --- a/src/credits.c +++ b/src/credits.c @@ -11,7 +11,7 @@ static void init(void); static void draw(void); static void deinit(void); -void credits(int state) { +void credits(const int state) { switch (state) { case GL4DH_INIT: init(); diff --git a/src/font.c b/src/font.c index 9515d2a..efa195a 100644 --- a/src/font.c +++ b/src/font.c @@ -1,6 +1,6 @@ #include "../includes/font.h" -int initFont(TTF_Font **font, char *filename, int size) { +int initFont(TTF_Font **font, const char *filename, const int size) { if (TTF_Init() == -1) { fprintf(stderr, "Erreur TTF : %s\n", TTF_GetError()); return 1; @@ -15,7 +15,7 @@ int initFont(TTF_Font **font, char *filename, int size) { } int writeText(GLuint *_textTexId, TTF_Font *font, const char *text, - SDL_Color color, GLuint *backgroundTextureId) { + const SDL_Color color, const GLuint *backgroundTextureId) { SDL_Surface *d, *s; // Create text if (!(d = TTF_RenderUTF8_Blended_Wrapped(font, text, color, 0))) { diff --git a/src/manif.c b/src/manif.c index 3ad185b..1bdd1f1 100644 --- a/src/manif.c +++ b/src/manif.c @@ -13,7 +13,7 @@ static const char *matrix_view = "view"; static void init(void); static void draw(void); -void manif(int state) { +void manif(const int state) { switch (state) { case GL4DH_INIT: init(); diff --git a/src/tag.c b/src/tag.c index c736fa6..b1ec2d3 100644 --- a/src/tag.c +++ b/src/tag.c @@ -12,7 +12,7 @@ static void init(void); static void draw(void); static void deinit(void); -void tag(int state) { +void tag(const int state) { switch (state) { case GL4DH_INIT: init(); diff --git a/src/utils.c b/src/utils.c index 475962e..22fbf1c 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1,6 +1,6 @@ #include "../includes/utils.h" -double get_dt(double *t0, GLboolean override_t0) { +double get_dt(double *t0, const GLboolean override_t0) { double t = gl4dGetElapsedTime(), dt = (t - *t0) / 1000.0; if (override_t0) { *t0 = t; @@ -14,9 +14,11 @@ void bindAndLoadf(const char *name) { gl4duLoadIdentityf(); } -void move(GLfloat x, GLfloat y, GLfloat z) { gl4duTranslatef(x, y, z); } +void move(const GLfloat x, const GLfloat y, const GLfloat z) { + gl4duTranslatef(x, y, z); +} -void rotate_vec(GLfloat *vec, GLfloat angle) { +void rotate_vec(GLfloat *vec, const GLfloat angle) { GLfloat y = vec[1]; GLfloat z = vec[2]; @@ -27,7 +29,7 @@ void rotate_vec(GLfloat *vec, GLfloat angle) { vec[2] = y * sinTheta + z * cosTheta; } -void load_img(const char *filename, GLuint texture) { +void load_img(const char *filename, const GLuint texture) { glBindTexture(GL_TEXTURE_2D, texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); @@ -51,7 +53,7 @@ void load_img(const char *filename, GLuint texture) { glBindTexture(GL_TEXTURE_2D, 0); } -void copy_texture(GLuint src, GLuint dst) { +void copy_texture(const GLuint src, const GLuint dst) { if (!(src || dst)) { fprintf(stderr, "Erreur copie texture: Source/Destination pas initalisée\n");