Compare commits
6 commits
f0a2ec04b3
...
5454729293
Author | SHA1 | Date | |
---|---|---|---|
5454729293 | |||
6ef675d765 | |||
f07503e647 | |||
d4823a7832 | |||
783ac75683 | |||
7ab8734993 |
6 changed files with 16 additions and 17 deletions
10
Makefile
10
Makefile
|
@ -54,13 +54,13 @@ LDFLAGS += -lGL4Dummies $(shell sdl2-config --libs) -lSDL2_mixer -lSDL2_image
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
# Par défaut
|
# Version finale avec optimisations (défaut)
|
||||||
$(PROGNAME): CFLAGS += -Wall -Wextra -Wshadow -pedantic -g -Wsign-conversion -fanalyzer
|
$(PROGNAME): CFLAGS += -O3
|
||||||
$(PROGNAME): compilation
|
$(PROGNAME): compilation
|
||||||
|
|
||||||
# Version finale avec optimisations
|
# Débug
|
||||||
release: CFLAGS += -O3
|
debug: CFLAGS += -Wall -Wextra -Wshadow -pedantic -g -Wsign-conversion -fanalyzer
|
||||||
release: compilation
|
debug: compilation
|
||||||
|
|
||||||
compilation: $(OBJ)
|
compilation: $(OBJ)
|
||||||
$(CC) $(OBJ) $(LDFLAGS) -o $(PROGNAME)
|
$(CC) $(OBJ) $(LDFLAGS) -o $(PROGNAME)
|
||||||
|
|
BIN
images/kirby.jpg
BIN
images/kirby.jpg
Binary file not shown.
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 81 KiB |
|
@ -13,7 +13,7 @@ void callback(void *_, Uint8 *stream, int taille) {
|
||||||
(void)_;
|
(void)_;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
float moyenne_calcul = 0.f;
|
double moyenne_calcul = 0.;
|
||||||
for(signed short *stream16 = (signed short *)stream; i < taille / 2; ++i) {
|
for(signed short *stream16 = (signed short *)stream; i < taille / 2; ++i) {
|
||||||
moyenne_calcul += stream16[i] / ((1 << 15) - 1.);
|
moyenne_calcul += stream16[i] / ((1 << 15) - 1.);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
void kirbyRotation(int etat) {
|
void kirbyRotation(int etat) {
|
||||||
static GLuint boule = 0, proc_id = 0, tex_id = 0;
|
static GLuint boule = 0, proc_id = 0, tex_id = 0;
|
||||||
static int a = 0;
|
static int a = 0;
|
||||||
|
static GLfloat b = 0.f;
|
||||||
|
|
||||||
switch(etat) {
|
switch(etat) {
|
||||||
case GL4DH_INIT:
|
case GL4DH_INIT:
|
||||||
|
@ -52,6 +53,7 @@ void kirbyRotation(int etat) {
|
||||||
gl4duPushMatrix();
|
gl4duPushMatrix();
|
||||||
|
|
||||||
gl4duRotatef(135 - a, 0, 1, 0);
|
gl4duRotatef(135 - a, 0, 1, 0);
|
||||||
|
gl4duScalef(.23f + b, .23f + b, .23f + b);
|
||||||
|
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||||
gl4duSendMatrices();
|
gl4duSendMatrices();
|
||||||
|
@ -65,8 +67,8 @@ void kirbyRotation(int etat) {
|
||||||
|
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
|
|
||||||
a += 6;
|
a += 2;
|
||||||
printf("rot=%d\n", 135-a);
|
b += 0.012f;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -76,7 +78,6 @@ void kirbyRotation(int etat) {
|
||||||
|
|
||||||
void kirbyCredits(int etat) {
|
void kirbyCredits(int etat) {
|
||||||
static GLuint boule = 0, proc_id = 0, tex_id = 0;
|
static GLuint boule = 0, proc_id = 0, tex_id = 0;
|
||||||
static int a = 0;
|
|
||||||
|
|
||||||
switch(etat) {
|
switch(etat) {
|
||||||
case GL4DH_INIT:
|
case GL4DH_INIT:
|
||||||
|
@ -134,8 +135,6 @@ void kirbyCredits(int etat) {
|
||||||
gl4duPopMatrix();
|
gl4duPopMatrix();
|
||||||
|
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
|
|
||||||
a += 7;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -57,10 +57,10 @@ void kirby(int etat) {
|
||||||
if(musique[0] != 0 || musique[1] != 0) {
|
if(musique[0] != 0 || musique[1] != 0) {
|
||||||
s = (s - musique[0]) / (musique[1] - musique[0]) + .2f;
|
s = (s - musique[0]) / (musique[1] - musique[0]) + .2f;
|
||||||
if(s > musique[2]) {
|
if(s > musique[2]) {
|
||||||
s -= s / 20.f;
|
s -= s / 7.f;
|
||||||
}
|
}
|
||||||
if(s < musique[2]) {
|
if(s < musique[2]) {
|
||||||
s += s / 20.f;
|
s += s / 7.f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
musique[1] = musique[1] < s ? s : musique[1];
|
musique[1] = musique[1] < s ? s : musique[1];
|
||||||
|
|
8
window.c
8
window.c
|
@ -5,7 +5,7 @@
|
||||||
#include "includes/animations.h"
|
#include "includes/animations.h"
|
||||||
|
|
||||||
// Son de fond
|
// Son de fond
|
||||||
static Mix_Music * ambiance = NULL;
|
static Mix_Music *ambiance = NULL;
|
||||||
|
|
||||||
// Comportement à la fermeture du programme
|
// Comportement à la fermeture du programme
|
||||||
void fermeture(void) {
|
void fermeture(void) {
|
||||||
|
@ -25,11 +25,11 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
// Animations
|
// Animations
|
||||||
GL4DHanime animations[] = {
|
GL4DHanime animations[] = {
|
||||||
/* { 6800, cube, NULL, NULL },
|
{ 6800, cube, NULL, NULL },
|
||||||
{ 8500, voronoi, NULL, NULL },
|
{ 8500, voronoi, NULL, NULL },
|
||||||
{ 6000, polygone, NULL, NULL },
|
{ 6000, polygone, NULL, NULL },
|
||||||
{ 5000, kirby, NULL, NULL }, */
|
{ 5000, kirby, NULL, NULL },
|
||||||
{ 1000, kirbyRotation, NULL, NULL},
|
{ 1700, kirbyRotation, NULL, NULL},
|
||||||
{ 3000, kirbyCredits, NULL, NULL},
|
{ 3000, kirbyCredits, NULL, NULL},
|
||||||
{ 0, NULL, NULL, NULL }
|
{ 0, NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
Reference in a new issue