2023-03-18 17:51:56 +01:00
|
|
|
|
2023-05-03 15:46:19 +02:00
|
|
|
#include "SDL_error.h"
|
|
|
|
#include "SDL_video.h"
|
2023-05-03 12:22:42 +02:00
|
|
|
#include "includes/animations.h"
|
2023-03-18 17:51:56 +01:00
|
|
|
|
2023-05-03 12:22:42 +02:00
|
|
|
// Son de fond
|
|
|
|
// static Mix_Music *_ambiance = NULL;
|
2023-03-18 17:51:56 +01:00
|
|
|
|
2023-05-03 12:22:42 +02:00
|
|
|
// Dimensions initiales de la fenêtre
|
|
|
|
GLuint _dims[] = {1280, 720};
|
|
|
|
|
|
|
|
// Comportement à la fermeture du programme
|
|
|
|
static void closure(void) {
|
|
|
|
// freeMusic(_ambiance);
|
|
|
|
gl4duClean(GL4DU_ALL);
|
2023-05-03 12:51:49 +02:00
|
|
|
|
|
|
|
printf("Merci du visionnage !\n");
|
2023-05-03 12:22:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
2023-03-18 17:51:56 +01:00
|
|
|
if (!gl4duwCreateWindow(argc, argv, "Demo API8 2023", GL4DW_POS_CENTERED,
|
2023-05-03 12:22:42 +02:00
|
|
|
GL4DW_POS_CENTERED, _dims[0], _dims[1],
|
2023-03-18 17:51:56 +01:00
|
|
|
GL4DW_OPENGL | GL4DW_SHOWN)) {
|
|
|
|
fprintf(stderr, "Erreur lors de la création de la fenêtre.\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2023-05-03 12:22:42 +02:00
|
|
|
// initMusic(_ambiance, "audio/ambiance.mid");
|
2023-05-01 01:00:50 +02:00
|
|
|
|
2023-05-03 12:22:42 +02:00
|
|
|
// Animations
|
|
|
|
GL4DHanime animations[] = {{7000, lights, NULL, NULL},
|
2023-05-03 17:24:54 +02:00
|
|
|
{10000, credits, NULL, NULL},
|
2023-05-03 12:22:42 +02:00
|
|
|
{0, NULL, NULL, NULL}};
|
2023-03-18 17:51:56 +01:00
|
|
|
|
2023-05-03 12:22:42 +02:00
|
|
|
gl4dhInit(animations, _dims[0], _dims[1], NULL);
|
|
|
|
atexit(closure);
|
2023-05-01 01:00:50 +02:00
|
|
|
|
2023-05-03 12:22:42 +02:00
|
|
|
gl4duwDisplayFunc(gl4dhDraw);
|
2023-05-03 15:46:19 +02:00
|
|
|
|
|
|
|
if (SDL_GL_SetSwapInterval(-1)) {
|
|
|
|
fprintf(stderr, "Erreur VSync : %s\n", SDL_GetError());
|
|
|
|
}
|
|
|
|
|
2023-05-03 12:22:42 +02:00
|
|
|
gl4duwMainLoop();
|
2023-05-01 01:00:50 +02:00
|
|
|
|
2023-05-03 12:22:42 +02:00
|
|
|
return 0;
|
2023-05-01 01:00:50 +02:00
|
|
|
}
|