init everything in init fn
This commit is contained in:
parent
2f3f89b940
commit
e42e0bc31d
1 changed files with 7 additions and 9 deletions
16
main.c
16
main.c
|
@ -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);
|
||||||
|
|
Reference in a new issue