Add animations
This commit is contained in:
parent
4bea60dad4
commit
1123b1a6ca
4 changed files with 37 additions and 12 deletions
4
Makefile
4
Makefile
|
@ -20,8 +20,8 @@ PACKNAME = sc_00_07
|
|||
PROGNAME = demo
|
||||
VERSION = 1.0
|
||||
distdir = $(PACKNAME)_$(PROGNAME)-$(VERSION)
|
||||
HEADERS =
|
||||
SOURCES = window.c
|
||||
HEADERS = animations.h
|
||||
SOURCES = window.c animations.c
|
||||
MSVCSRC = $(patsubst %,<ClCompile Include=\"%\\\" \\/>,$(SOURCES))
|
||||
OBJ = $(SOURCES:.c=.o)
|
||||
DOXYFILE = documentation/Doxyfile
|
||||
|
|
5
animations.c
Normal file
5
animations.c
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include "animations.h"
|
||||
|
||||
void initialisationAnimation(void) {
|
||||
/* ... */
|
||||
}
|
9
animations.h
Normal file
9
animations.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
#ifndef DEMO_ANIMATION_HPP
|
||||
#define DEMO_ANIMATION_HPP 1
|
||||
|
||||
#include <GL4D/gl4dh.h>
|
||||
|
||||
// Comportement avant de lancer les animations
|
||||
void initialisationAnimation(void);
|
||||
|
||||
#endif
|
31
window.c
31
window.c
|
@ -1,27 +1,38 @@
|
|||
#include <GL4D/gl4dp.h>
|
||||
#include <GL4D/gl4duw_SDL2.h>
|
||||
|
||||
// Dessine dans la fenêtre
|
||||
static void dessin(void);
|
||||
#include "animations.h"
|
||||
|
||||
// Dimensions initiales de la fenêtre
|
||||
static int dimensions[] = {1280, 720};
|
||||
|
||||
// Animations
|
||||
static GL4DHanime animations[] = {
|
||||
{0, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
// Comportement à la fermeture du programme
|
||||
static void fermeture(void);
|
||||
|
||||
// Comportement au démarrage du programme
|
||||
void initialisation(void);
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if(!gl4duwCreateWindow(argc, argv, "Démo Anri KENNEL", 10, 10, dimensions[0], dimensions[1], GL4DW_SHOWN)) {
|
||||
return 1;
|
||||
}
|
||||
initialisation();
|
||||
atexit(fermeture);
|
||||
|
||||
gl4dpInitScreen();
|
||||
gl4duwDisplayFunc(dessin);
|
||||
gl4duwDisplayFunc(gl4dhDraw);
|
||||
gl4duwMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dessin(void) {
|
||||
gl4dpClearScreen();
|
||||
|
||||
/* ... */
|
||||
gl4dpUpdateScreen(NULL);
|
||||
void initialisation(void) {
|
||||
gl4dhInit(animations, dimensions[0], dimensions[1], initialisationAnimation);
|
||||
}
|
||||
|
||||
void fermeture(void) {
|
||||
gl4duClean(GL4DU_ALL);
|
||||
}
|
||||
|
|
Reference in a new issue