init everything in init fn

This commit is contained in:
Mylloon 2023-05-08 09:53:17 +02:00
parent 2f3f89b940
commit e42e0bc31d
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

16
main.c
View file

@ -18,8 +18,6 @@ int main(int argc, char *argv[]) {
return 1; return 1;
} }
initMusic(_ambiance, "audio/ambiance.mid");
// Animations // Animations
GL4DHanime animations[] = {{10000, manif, NULL, NULL}, GL4DHanime animations[] = {{10000, manif, NULL, NULL},
{9000, credits, NULL, NULL}, {9000, credits, NULL, NULL},
@ -27,19 +25,19 @@ int main(int argc, char *argv[]) {
gl4dhInit(animations, _dims[0], _dims[1], init); gl4dhInit(animations, _dims[0], _dims[1], init);
atexit(closure); atexit(closure);
gl4duwDisplayFunc(gl4dhDraw); gl4duwDisplayFunc(gl4dhDraw);
if (SDL_GL_SetSwapInterval(-1)) {
fprintf(stderr, "Erreur VSync : %s\n", SDL_GetError());
}
gl4duwMainLoop(); gl4duwMainLoop();
return 0; return 0;
} }
static void init(void) { printf("Chargement de la démo...\n"); } static void init(void) {
initMusic(_ambiance, "audio/ambiance.mid");
if (SDL_GL_SetSwapInterval(-1)) {
fprintf(stderr, "Erreur VSync : %s\n", SDL_GetError());
}
}
static void closure(void) { static void closure(void) {
freeMusic(_ambiance); freeMusic(_ambiance);