From e42e0bc31d1e8b8416ac69cc9ffb474ad6383c0e Mon Sep 17 00:00:00 2001 From: Mylloon Date: Mon, 8 May 2023 09:53:17 +0200 Subject: [PATCH] init everything in init fn --- main.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/main.c b/main.c index 949f336..feacf41 100644 --- a/main.c +++ b/main.c @@ -18,8 +18,6 @@ int main(int argc, char *argv[]) { return 1; } - initMusic(_ambiance, "audio/ambiance.mid"); - // Animations GL4DHanime animations[] = {{10000, manif, NULL, NULL}, {9000, credits, NULL, NULL}, @@ -27,19 +25,19 @@ int main(int argc, char *argv[]) { gl4dhInit(animations, _dims[0], _dims[1], init); atexit(closure); - gl4duwDisplayFunc(gl4dhDraw); - - if (SDL_GL_SetSwapInterval(-1)) { - fprintf(stderr, "Erreur VSync : %s\n", SDL_GetError()); - } - gl4duwMainLoop(); 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) { freeMusic(_ambiance);