2023-05-12 13:49:20 +02:00
|
|
|
#include <time.h>
|
2023-03-18 17:51:56 +01:00
|
|
|
|
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
|
2023-05-03 19:53:05 +02:00
|
|
|
static Mix_Chunk *_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};
|
|
|
|
|
2023-05-08 09:25:46 +02:00
|
|
|
static void init(void);
|
|
|
|
static void closure(void);
|
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
|
|
|
// Animations
|
2023-05-19 13:14:48 +02:00
|
|
|
GL4DHanime animations[] = {{10000, manif, NULL, NULL}, // Manifestation
|
|
|
|
{2000, manif, tag, zoom_in}, // Transition
|
2023-05-21 09:01:17 +02:00
|
|
|
{10000, tag, NULL, NULL}, // Tag
|
2023-05-19 13:14:48 +02:00
|
|
|
{2000, tag, credits, zoom_in}, // Transition
|
|
|
|
{9500, credits, NULL, NULL}, // Crédits
|
2023-05-03 12:22:42 +02:00
|
|
|
{0, NULL, NULL, NULL}};
|
2023-03-18 17:51:56 +01:00
|
|
|
|
2023-05-08 09:25:46 +02:00
|
|
|
gl4dhInit(animations, _dims[0], _dims[1], init);
|
2023-05-03 12:22:42 +02:00
|
|
|
atexit(closure);
|
|
|
|
gl4duwDisplayFunc(gl4dhDraw);
|
|
|
|
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
|
|
|
}
|
2023-05-08 09:25:46 +02:00
|
|
|
|
2023-05-08 09:53:17 +02:00
|
|
|
static void init(void) {
|
|
|
|
initMusic(_ambiance, "audio/ambiance.mid");
|
|
|
|
|
|
|
|
if (SDL_GL_SetSwapInterval(-1)) {
|
|
|
|
fprintf(stderr, "Erreur VSync : %s\n", SDL_GetError());
|
|
|
|
}
|
2023-05-08 15:18:50 +02:00
|
|
|
|
2023-05-12 13:49:20 +02:00
|
|
|
srand((Uint32)time(NULL));
|
|
|
|
|
2023-05-19 12:30:47 +02:00
|
|
|
transitions_init();
|
|
|
|
|
2023-05-08 15:18:50 +02:00
|
|
|
printf("Bienvenue dans la démo API8 !\n");
|
2023-05-08 09:53:17 +02:00
|
|
|
}
|
2023-05-08 09:25:46 +02:00
|
|
|
|
|
|
|
static void closure(void) {
|
|
|
|
freeMusic(_ambiance);
|
|
|
|
gl4duClean(GL4DU_ALL);
|
|
|
|
|
|
|
|
printf("Merci du visionnage !\n");
|
|
|
|
}
|