This commit is contained in:
Mylloon 2023-05-08 09:25:46 +02:00
parent aa77e8120c
commit 2f3f89b940
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 12 additions and 11 deletions

22
main.c
View file

@ -1,6 +1,4 @@
#include "SDL_error.h"
#include "SDL_video.h"
#include "includes/animations.h" #include "includes/animations.h"
// Son de fond // Son de fond
@ -9,13 +7,8 @@ static Mix_Chunk *_ambiance = NULL;
// Dimensions initiales de la fenêtre // Dimensions initiales de la fenêtre
GLuint _dims[] = {1280, 720}; GLuint _dims[] = {1280, 720};
// Comportement à la fermeture du programme static void init(void);
static void closure(void) { static void closure(void);
freeMusic(_ambiance);
gl4duClean(GL4DU_ALL);
printf("Merci du visionnage !\n");
}
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
if (!gl4duwCreateWindow(argc, argv, "Demo API8 2023", GL4DW_POS_CENTERED, if (!gl4duwCreateWindow(argc, argv, "Demo API8 2023", GL4DW_POS_CENTERED,
@ -32,7 +25,7 @@ int main(int argc, char *argv[]) {
{9000, credits, NULL, NULL}, {9000, credits, NULL, NULL},
{0, NULL, NULL, NULL}}; {0, NULL, NULL, NULL}};
gl4dhInit(animations, _dims[0], _dims[1], NULL); gl4dhInit(animations, _dims[0], _dims[1], init);
atexit(closure); atexit(closure);
gl4duwDisplayFunc(gl4dhDraw); gl4duwDisplayFunc(gl4dhDraw);
@ -45,3 +38,12 @@ int main(int argc, char *argv[]) {
return 0; return 0;
} }
static void init(void) { printf("Chargement de la démo...\n"); }
static void closure(void) {
freeMusic(_ambiance);
gl4duClean(GL4DU_ALL);
printf("Merci du visionnage !\n");
}

View file

@ -1,5 +1,4 @@
#include "../includes/font.h" #include "../includes/font.h"
#include "SDL_ttf.h"
int initFont(TTF_Font **font, char *filename, int size) { int initFont(TTF_Font **font, char *filename, int size) {
if (TTF_Init() == -1) { if (TTF_Init() == -1) {