Bonjour ,
Je veux mettre une vidéo en intro pour mon projet.
Je l'ai donc décomposé en image par image.
Il y a 140 images en tout. Je veux les bliter une par une.
J'ai fais une fonction ( appelé ubisoft )
Et je l'emploie dans le main après le chargement de la SDL .
Mais voila quand je lance le programme, ça quitte tout de suite.
Voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53 #include <fmod.h> #include <SDL.h> #include <SDL_image.h> SDL_Surface *init_img(char *file); void introUbisoft(SDL_Surface *ecran) { SDL_Surface *imgUbisoft[140]; //FSOUND_STREAM *son; int i=0 , j=0, y,m=0 ,continuer=1; char nomImg[140][100]; static int counter = 10; int lol = 0; for(j=0; j<140; j++) { for(m=0; m<140; m++) { sprintf(nomImg[j], "img//vid//img logo%000d.jpeg",j); imgUbisoft[j] = init_img(nomImg); } } if(imgUbisoft[0]==NULL) exit(0); //son = FSOUND_Stream_Open("sound\\sonUbisoft.mp3" , FSOUND_LOOP_NORMAL , 0 , 0); //FSOUND_Stream_Play (FSOUND_FREE ,son); while(continuer) { counter--; if(counter <= 0) { lol++; counter = 10; } if(lol == 140) continuer=0; SDL_BlitSurface(imgUbisoft[lol] , NULL , ecran , NULL); SDL_Flip(ecran); } for(y=0; y<140; y++) SDL_FreeSurface(imgUbisoft[y]); //FSOUND_Stream_Close(son); }
Partager