This repository has been archived on 2023-05-27. You can view files and clone it, but cannot push or open issues or pull requests.
api8/main.c
2023-05-23 12:56:32 +02:00

57 lines
1.5 KiB
C

#include <time.h>
#include "includes/animations.h"
// Son de fond
static Mix_Chunk *_ambiance = NULL;
// Dimensions initiales de la fenêtre
GLuint _dims[] = {1280, 720};
static void init(void);
static void closure(void);
int main(const int argc, char *argv[]) {
if (!gl4duwCreateWindow(argc, argv, "Demo API8 2023", GL4DW_POS_CENTERED,
GL4DW_POS_CENTERED, _dims[0], _dims[1],
GL4DW_OPENGL | GL4DW_SHOWN)) {
fprintf(stderr, "Erreur lors de la création de la fenêtre.\n");
return 1;
}
// Animations
GL4DHanime animations[] = {{10000, manif, NULL, NULL}, // Manifestation
{2000, manif, tag, zoom_in}, // Transition
{10000, tag, NULL, NULL}, // Tag
{2000, tag, credits, zoom_in}, // Transition
{9500, credits, NULL, NULL}, // Crédits
{0, NULL, NULL, NULL}};
gl4dhInit(animations, _dims[0], _dims[1], init);
atexit(closure);
gl4duwDisplayFunc(gl4dhDraw);
gl4duwMainLoop();
return 0;
}
static void init(void) {
initMusic(_ambiance, "audio/ambiance.mid");
if (SDL_GL_SetSwapInterval(-1)) {
fprintf(stderr, "Erreur VSync : %s\n", SDL_GetError());
}
srand((Uint32)time(NULL));
transitions_init();
printf("Bienvenue dans la démo API8 !\n");
}
static void closure(void) {
freeMusic(_ambiance);
gl4duClean(GL4DU_ALL);
printf("Merci du visionnage !\n");
}