texture_perso.c 28.7 KB
Newer Older
Valentin MEUNIER's avatar
le  
Valentin MEUNIER committed
1
2
#include "texture_perso.h"

Valentin MEUNIER's avatar
Valentin MEUNIER committed
3
4
void play_with_elve_end(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,int deplacement,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive,int right, int direction)
{
Valentin MEUNIER's avatar
le  
Valentin MEUNIER committed
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
    SDL_Rect source = {0},destination = {0};                 
             
    SDL_QueryTexture(texture_elve, NULL, NULL,&source.w, &source.h);

    int nb_images = 8;
    int nb_images_animation=9;
    int i=0;                          
    int offset_x = source.w/nb_images;
    int offset_y = source.h;   
    SDL_Rect state[10];

    destination.w = offset_x * zoom;  //taille image largeur
    destination.h = offset_y * zoom; //taille image hauteur
    destination.x=pos_x;             //position image x
    destination.y=pos_y;             //position image y

Valentin MEUNIER's avatar
Valentin MEUNIER committed
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
	if (right && direction==1)//NORD
	{
    state[0].x=0; state[0].y=0; state[0].w=offset_x; state[0].h = offset_y;//different rectangle qu'on prend comme sprite 
    state[1].x=4*offset_x; state[1].y=0; state[1].w=offset_x; state[1].h = offset_y;
    state[2].x=5*offset_x; state[2].y=0; state[2].w=offset_x; state[2].h = offset_y;
	 state[3].x=6*offset_x; state[3].y=0; state[3].w=offset_x; state[3].h = offset_y;
    state[4].x=7*offset_x; state[4].y=0; state[4].w=offset_x; state[4].h = offset_y;
    state[5].x=4*offset_x; state[5].y=0; state[5].w=offset_x; state[5].h = offset_y;
    state[6].x=5*offset_x; state[6].y=0; state[6].w=offset_x; state[6].h = offset_y; 
    state[7].x=7*offset_x; state[7].y=0; state[7].w=offset_x; state[7].h = offset_y;
    state[8].x=4*offset_x; state[8].y=0; state[8].w=offset_x; state[8].h = offset_y; 
	 state[9].x=0; state[9].y=0; state[9].w=offset_x; state[9].h = offset_y;
	}
	else if (!right && direction==1) //NORD
	{
	 state[0].x=7*offset_x; state[0].y=0; state[0].w=offset_x; state[0].h = offset_y;
    state[1].x=3*offset_x; state[1].y=0; state[1].w=offset_x; state[1].h = offset_y;
    state[2].x=2*offset_x; state[2].y=0; state[2].w = offset_x; state[2].h = offset_y;
    state[3].x=1*offset_x; state[3].y=0; state[3].w = offset_x; state[3].h = offset_y;
    state[4].x=0; 			state[4].y=0; state[4].w=offset_x; state[4].h = offset_y;
    state[5].x=3*offset_x; state[5].y=0; state[5].w=offset_x; state[5].h = offset_y;
    state[6].x=1*offset_x; state[6].y=0; state[6].w=offset_x; state[6].h = offset_y;
    state[7].x=0; 			state[7].y=0; state[7].w=offset_x; state[7].h = offset_y;
    state[8].x=3*offset_x; state[8].y=0; state[8].w=offset_x; state[8].h = offset_y;
    state[9].x=7*offset_x; state[9].y=0; state[9].w=offset_x; state[9].h = offset_y;
    }
	else if (right && direction==2) //SUD
	{
    state[0].x=0; state[0].y=0; state[0].w=offset_x; state[0].h = offset_y; 
    state[1].x=4*offset_x; state[1].y=0; state[1].w=offset_x; state[1].h = offset_y; 
    state[2].x=5*offset_x; state[2].y=0; state[2].w = offset_x; state[2].h = offset_y; 
    state[3].x=6*offset_x; state[3].y=0; state[3].w = offset_x; state[3].h = offset_y; 
    state[4].x=7*offset_x; state[4].y=0;    state[4].w=offset_x; state[4].h = offset_y; 
    state[5].x=4*offset_x; state[5].y=0; state[5].w=offset_x; state[5].h = offset_y; 
    state[6].x=6*offset_x; state[6].y=0; state[6].w=offset_x; state[6].h = offset_y; 
    state[7].x=7*offset_x; state[7].y=0; state[7].w=offset_x; state[7].h = offset_y; 
    state[8].x=4*offset_x; state[8].y=0; state[8].w=offset_x; state[8].h = offset_y; 
    state[9].x=0; state[9].y=0; state[9].w=offset_x; state[9].h = offset_y;
	}
	else if (!right && direction==2) //SUD
	{
    state[0].x=7*offset_x; state[0].y=0; state[0].w=offset_x; state[0].h = offset_y; 
    state[1].x=3*offset_x; state[1].y=0; state[1].w=offset_x; state[1].h = offset_y; 
    state[2].x=2*offset_x; state[2].y=0; state[2].w = offset_x; state[2].h = offset_y; 
    state[3].x=1*offset_x; state[3].y=0; state[3].w = offset_x; state[3].h = offset_y; 
    state[4].x=0; state[4].y=0;    state[4].w=offset_x; state[4].h = offset_y; 
    state[5].x=3*offset_x; state[5].y=0; state[5].w=offset_x; state[5].h = offset_y; 
    state[6].x=2*offset_x; state[6].y=0; state[6].w=offset_x; state[6].h = offset_y; 
    state[6].x=1*offset_x; state[6].y=0; state[6].w=offset_x; state[6].h = offset_y; 
    state[7].x=0; state[7].y=0; state[7].w=offset_x; state[7].h = offset_y; 
    state[8].x=3*offset_x; state[8].y=0; state[8].w=offset_x; state[8].h = offset_y; 
	}
	else if (direction==3) //OEUST
	{
    state[0].x=7*offset_x; state[0].y=0; state[0].w=offset_x; state[0].h = offset_y; 
    state[1].x=3*offset_x; state[1].y=0; state[1].w=offset_x; state[1].h = offset_y; 
    state[2].x=2*offset_x; state[2].y=0; state[2].w=offset_x; state[2].h = offset_y; 
    state[3].x=1*offset_x; state[3].y=0; state[3].w=offset_x; state[3].h = offset_y; 
    state[4].x=0; state[4].y=0; state[4].w=offset_x; state[4].h = offset_y; 
    state[5].x=3*offset_x; state[5].y=0; state[5].w=offset_x; state[5].h = offset_y; 
    state[6].x=1*offset_x; state[6].y=0; state[6].w=offset_x; state[6].h = offset_y; 
    state[7].x=offset_x;; state[7].y=0; state[7].w=offset_x; state[7].h = offset_y; 
    state[8].x=7*offset_x; state[8].y=0; state[8].w=offset_x; state[8].h = offset_y; 
    state[9].x=0; state[9].y=0; state[9].w=offset_x; state[9].h = offset_y;
	}
	else if (direction==4) //EST
	{
    state[1].x=4*offset_x; state[1].y=0; state[1].w=offset_x; state[1].h = offset_y; 
    state[2].x=5*offset_x; state[2].y=0; state[2].w = offset_x; state[2].h = offset_y; 
    state[3].x=6*offset_x; state[3].y=0; state[3].w = offset_x; state[3].h = offset_y; 
    state[4].x=7*offset_x; state[4].y=0;    state[4].w=offset_x; state[4].h = offset_y; 
    state[5].x=4*offset_x; state[5].y=0; state[5].w=offset_x; state[5].h = offset_y; 
    state[6].x=5*offset_x; state[6].y=0; state[6].w=offset_x; state[6].h = offset_y; 
    state[6].x=6*offset_x; state[6].y=0; state[6].w=offset_x; state[6].h = offset_y; 
    state[7].x=7*offset_x;; state[7].y=0; state[7].w=offset_x; state[7].h = offset_y; 
    state[8].x=4*offset_x; state[8].y=0; state[8].w=offset_x; state[8].h = offset_y; 
    state[9].x=0; state[9].y=0; state[9].w=offset_x; state[9].h = offset_y;
	}
		

    for(i=0;i<nb_images_animation;++i)
	{
        //afficherImage(renderer,window,tab,taille_cell,background);
	afficherImageBrouillard(renderer,window,tab,taille_cell,background,pos_x,pos_y);
	affichage_fin(texture_fin,window,renderer,noeud_arrive/P,noeud_arrive%P,taille_cell);
	destination.y=destination.y-(deplacement/nb_images_animation); //déplacement du personnage ici de wind dim.h /32 en tout (diviser par nb animation pour chaque anim)
        SDL_RenderCopy(renderer,texture_elve, &state[i], &destination);
        SDL_RenderPresent(renderer);
        SDL_Delay(10);
    }      
}
Valentin MEUNIER's avatar
le  
Valentin MEUNIER committed
112
113


Valentin MEUNIER's avatar
Valentin MEUNIER committed
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142

void play_with_elve_N(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,int deplacement,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive){
    SDL_Rect source = {0},destination = {0};                 
             
    SDL_QueryTexture(texture_elve, NULL, NULL,&source.w, &source.h);

    int nb_images = 8;
    int nb_images_animation=9;
    int i=0;                          
    int offset_x = source.w/nb_images;
    int offset_y = source.h;   
    SDL_Rect state[10];

    destination.w = offset_x * zoom;  //taille image largeur
    destination.h = offset_y * zoom; //taille image hauteur
    destination.x=pos_x;             //position image x
    destination.y=pos_y;             //position image y


    state[0].x=0; state[0].y=0; state[0].w=offset_x; state[0].h = offset_y;//different rectangle qu'on prend comme sprite 
    state[1].x=4*offset_x; state[1].y=0; state[1].w=offset_x; state[1].h = offset_y;
    state[2].x=5*offset_x; state[2].y=0; state[2].w=offset_x; state[2].h = offset_y;
	 state[3].x=6*offset_x; state[3].y=0; state[3].w=offset_x; state[3].h = offset_y;
    state[4].x=7*offset_x; state[4].y=0; state[4].w=offset_x; state[4].h = offset_y;
    state[5].x=4*offset_x; state[5].y=0; state[5].w=offset_x; state[5].h = offset_y;
    state[6].x=5*offset_x; state[6].y=0; state[6].w=offset_x; state[6].h = offset_y; 
    state[7].x=7*offset_x; state[7].y=0; state[7].w=offset_x; state[7].h = offset_y;
    state[8].x=4*offset_x; state[8].y=0; state[8].w=offset_x; state[8].h = offset_y; 
	 state[9].x=0; state[9].y=0; state[9].w=offset_x; state[9].h = offset_y;
Valentin MEUNIER's avatar
le  
Valentin MEUNIER committed
143
144
    
    for(i=0;i<nb_images_animation;++i){
Valentin MEUNIER's avatar
Valentin MEUNIER committed
145
146
        //afficherImage(renderer,window,tab,taille_cell,background);
	afficherImageBrouillard(renderer,window,tab,taille_cell,background,pos_x,pos_y);
Valentin MEUNIER's avatar
le  
Valentin MEUNIER committed
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
	affichage_fin(texture_fin,window,renderer,noeud_arrive/P,noeud_arrive%P,taille_cell);
	destination.y=destination.y-(deplacement/nb_images_animation); //déplacement du personnage ici de wind dim.h /32 en tout (diviser par nb animation pour chaque anim)
        SDL_RenderCopy(renderer,texture_elve, &state[i], &destination);
        SDL_RenderPresent(renderer);
        SDL_Delay(10);
    }      
}
void play_with_elve_N_l(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,int deplacement,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive){
    SDL_Rect source = {0},destination = {0};                 
             
    SDL_QueryTexture(texture_elve, NULL, NULL,&source.w, &source.h);

    int nb_images = 8;
    int nb_images_animation=9;
    int i=0;                          
    int offset_x = source.w/nb_images;
    int offset_y = source.h;   
    SDL_Rect state[10];

    destination.w = offset_x * zoom;  //taille image largeur
    destination.h = offset_y * zoom; //taille image hauteur
    destination.x=pos_x;             //position image x
    destination.y=pos_y;             //position image y


Valentin MEUNIER's avatar
Valentin MEUNIER committed
172
173
174
175
176
177
178
179
180
181
182
    state[0].x=7*offset_x; state[0].y=0; state[0].w=offset_x; state[0].h = offset_y; 
    state[1].x=3*offset_x; state[1].y=0; state[1].w=offset_x; state[1].h = offset_y; 
    state[2].x=2*offset_x; state[2].y=0; state[2].w = offset_x; state[2].h = offset_y; 
    state[3].x=1*offset_x; state[3].y=0; state[3].w = offset_x; state[3].h = offset_y; 
    state[4].x=0; state[4].y=0;    state[4].w=offset_x; state[4].h = offset_y; 
    state[5].x=3*offset_x; state[5].y=0; state[5].w=offset_x; state[5].h = offset_y; 
    state[6].x=2*offset_x; state[6].y=0; state[6].w=offset_x; state[6].h = offset_y; 
    state[6].x=1*offset_x; state[6].y=0; state[6].w=offset_x; state[6].h = offset_y; 
    state[7].x=0; state[7].y=0; state[7].w=offset_x; state[7].h = offset_y; 
    state[8].x=3*offset_x; state[8].y=0; state[8].w=offset_x; state[8].h = offset_y; 
    state[9].x=7*offset_x; state[9].y=0; state[9].w=offset_x; state[9].h = offset_y;
Valentin MEUNIER's avatar
le  
Valentin MEUNIER committed
183
184
    
    for(i=0;i<nb_images_animation;++i){
Valentin MEUNIER's avatar
Valentin MEUNIER committed
185
186
        //afficherImage(renderer,window,tab,taille_cell,background);
	afficherImageBrouillard(renderer,window,tab,taille_cell,background,pos_x,pos_y);
Valentin MEUNIER's avatar
le  
Valentin MEUNIER committed
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
	affichage_fin(texture_fin,window,renderer,noeud_arrive/P,noeud_arrive%P,taille_cell);
	destination.y=destination.y-(deplacement/nb_images_animation);
        SDL_RenderCopy(renderer,texture_elve, &state[i], &destination);
        SDL_RenderPresent(renderer);
        SDL_Delay(10);
    }      
}
void play_with_elve_S(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,int deplacement,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive){
     SDL_Rect source = {0}, window_dimensions = {0},destination = {0};                 

     SDL_GetWindowSize(window, &window_dimensions.w,&window_dimensions.h);               
     SDL_QueryTexture(texture_elve, NULL, NULL,&source.w, &source.h);

    int nb_images = 8;
    int nb_images_animation=9;
    int i=0;                      
    int offset_x = source.w/nb_images;
    int offset_y = source.h;   
    SDL_Rect state[10];

    destination.w = offset_x * zoom;           
    destination.h = offset_y * zoom;
    destination.x=pos_x;
    destination.y=pos_y;



Valentin MEUNIER's avatar
Valentin MEUNIER committed
214
215
216
217
218
219
220
221
222
223
    state[0].x=0; state[0].y=0; state[0].w=offset_x; state[0].h = offset_y; 
    state[1].x=4*offset_x; state[1].y=0; state[1].w=offset_x; state[1].h = offset_y; 
    state[2].x=5*offset_x; state[2].y=0; state[2].w = offset_x; state[2].h = offset_y; 
    state[3].x=6*offset_x; state[3].y=0; state[3].w = offset_x; state[3].h = offset_y; 
    state[4].x=7*offset_x; state[4].y=0;    state[4].w=offset_x; state[4].h = offset_y; 
    state[5].x=4*offset_x; state[5].y=0; state[5].w=offset_x; state[5].h = offset_y; 
    state[6].x=6*offset_x; state[6].y=0; state[6].w=offset_x; state[6].h = offset_y; 
    state[7].x=7*offset_x; state[7].y=0; state[7].w=offset_x; state[7].h = offset_y; 
    state[8].x=4*offset_x; state[8].y=0; state[8].w=offset_x; state[8].h = offset_y; 
    state[9].x=0; state[9].y=0; state[9].w=offset_x; state[9].h = offset_y;
Valentin MEUNIER's avatar
le  
Valentin MEUNIER committed
224
225
    
    for(i=0;i<nb_images_animation;++i){
Valentin MEUNIER's avatar
Valentin MEUNIER committed
226
227
        //afficherImage(renderer,window,tab,taille_cell,background);
	afficherImageBrouillard(renderer,window,tab,taille_cell,background,pos_x,pos_y);
Valentin MEUNIER's avatar
le  
Valentin MEUNIER committed
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
	affichage_fin(texture_fin,window,renderer,noeud_arrive/P,noeud_arrive%P,taille_cell);
	destination.y=destination.y+(deplacement/nb_images_animation);
        SDL_RenderCopy(renderer,texture_elve, &state[i], &destination);
        SDL_RenderPresent(renderer);
        SDL_Delay(10);
    }      

}
void play_with_elve_S_l(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,int deplacement,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive){
     SDL_Rect source = {0}, window_dimensions = {0},destination = {0};                 

     SDL_GetWindowSize(window, &window_dimensions.w,&window_dimensions.h);               
     SDL_QueryTexture(texture_elve, NULL, NULL,&source.w, &source.h);

    int nb_images = 8;
    int nb_images_animation=9;
    int i=0;                      
    int offset_x = source.w/nb_images;
    int offset_y = source.h;   
    SDL_Rect state[10];

    destination.w = offset_x * zoom;           
    destination.h = offset_y * zoom;
    destination.x=pos_x;
    destination.y=pos_y;



Valentin MEUNIER's avatar
Valentin MEUNIER committed
256
257
258
259
260
261
262
263
264
265
266
    state[0].x=7*offset_x; state[0].y=0; state[0].w=offset_x; state[0].h = offset_y; 
    state[1].x=3*offset_x; state[1].y=0; state[1].w=offset_x; state[1].h = offset_y; 
    state[2].x=2*offset_x; state[2].y=0; state[2].w = offset_x; state[2].h = offset_y; 
    state[3].x=1*offset_x; state[3].y=0; state[3].w = offset_x; state[3].h = offset_y; 
    state[4].x=0; state[4].y=0;    state[4].w=offset_x; state[4].h = offset_y; 
    state[5].x=3*offset_x; state[5].y=0; state[5].w=offset_x; state[5].h = offset_y; 
    state[6].x=2*offset_x; state[6].y=0; state[6].w=offset_x; state[6].h = offset_y; 
    state[6].x=1*offset_x; state[6].y=0; state[6].w=offset_x; state[6].h = offset_y; 
    state[7].x=0; state[7].y=0; state[7].w=offset_x; state[7].h = offset_y; 
    state[8].x=3*offset_x; state[8].y=0; state[8].w=offset_x; state[8].h = offset_y; 
    state[9].x=7*offset_x; state[9].y=0; state[9].w=offset_x; state[9].h = offset_y;
Valentin MEUNIER's avatar
le  
Valentin MEUNIER committed
267
268
    
    for(i=0;i<nb_images_animation;++i){
269
        //afficherImage(renderer,window,tab,taille_cell,background);
Valentin MEUNIER's avatar
Valentin MEUNIER committed
270
	afficherImageBrouillard(renderer,window,tab,taille_cell,background,pos_x,pos_y);
Valentin MEUNIER's avatar
le  
Valentin MEUNIER committed
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
	affichage_fin(texture_fin,window,renderer,noeud_arrive/P,noeud_arrive%P,taille_cell);
	destination.y=destination.y+(deplacement/nb_images_animation);
        SDL_RenderCopy(renderer,texture_elve, &state[i], &destination);
        SDL_RenderPresent(renderer);
        SDL_Delay(10);
    }      

}
void play_with_elve_O(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,int deplacement,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive){

     SDL_Rect source = {0}, window_dimensions = {0},destination = {0};                 

     SDL_GetWindowSize(window, &window_dimensions.w,&window_dimensions.h);               
     SDL_QueryTexture(texture_elve, NULL, NULL,&source.w, &source.h);

    int nb_images = 8;
    int nb_images_animation=9;
    int i=0;                         
    int offset_x = source.w/nb_images;
    int offset_y = source.h;   
    SDL_Rect state[10];

    destination.w = offset_x * zoom;           
    destination.h = offset_y * zoom;
    destination.x=pos_x;
    destination.y=pos_y;



Valentin MEUNIER's avatar
Valentin MEUNIER committed
300
301
302
303
304
305
306
307
308
309
    state[0].x=7*offset_x; state[0].y=0; state[0].w=offset_x; state[0].h = offset_y; 
    state[1].x=3*offset_x; state[1].y=0; state[1].w=offset_x; state[1].h = offset_y; 
    state[2].x=2*offset_x; state[2].y=0; state[2].w=offset_x; state[2].h = offset_y; 
    state[3].x=1*offset_x; state[3].y=0; state[3].w=offset_x; state[3].h = offset_y; 
    state[4].x=0; state[4].y=0; state[4].w=offset_x; state[4].h = offset_y; 
    state[5].x=3*offset_x; state[5].y=0; state[5].w=offset_x; state[5].h = offset_y; 
    state[6].x=1*offset_x; state[6].y=0; state[6].w=offset_x; state[6].h = offset_y; 
    state[7].x=offset_x;; state[7].y=0; state[7].w=offset_x; state[7].h = offset_y; 
    state[8].x=7*offset_x; state[8].y=0; state[8].w=offset_x; state[8].h = offset_y; 
    state[9].x=0; state[9].y=0; state[9].w=offset_x; state[9].h = offset_y;
Valentin MEUNIER's avatar
le  
Valentin MEUNIER committed
310
311
    
    for(i=0;i<nb_images_animation;++i){
Valentin MEUNIER's avatar
Valentin MEUNIER committed
312
313
        //afficherImage(renderer,window,tab,taille_cell,background);
	afficherImageBrouillard(renderer,window,tab,taille_cell,background,pos_x,pos_y);
Valentin MEUNIER's avatar
le  
Valentin MEUNIER committed
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
	affichage_fin(texture_fin,window,renderer,noeud_arrive/P,noeud_arrive%P,taille_cell);
	destination.x=destination.x-(deplacement/nb_images_animation);
        SDL_RenderCopy(renderer,texture_elve, &state[i], &destination);
        SDL_RenderPresent(renderer);
        SDL_Delay(10);
    }           
}       
void play_with_elve_E(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,int deplacement,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive){
    SDL_Rect source = {0}, window_dimensions = {0},destination = {0};                 

    SDL_GetWindowSize(window, &window_dimensions.w,&window_dimensions.h);               
    SDL_QueryTexture(texture_elve, NULL, NULL,&source.w, &source.h);

    int nb_images = 8;
    int nb_images_animation=9;
    int i=0;                           
    int offset_x = source.w/nb_images;
    int offset_y = source.h;   
    SDL_Rect state[10];

    destination.w = offset_x * zoom;           
    destination.h = offset_y * zoom;
    destination.x=pos_x;
    destination.y=pos_y;



    state[0].x=0;
    state[0].y=0;
    state[0].w=offset_x;
    state[0].h = offset_y;

Valentin MEUNIER's avatar
Valentin MEUNIER committed
346
347
348
349
350
351
352
353
354
355
    state[1].x=4*offset_x; state[1].y=0; state[1].w=offset_x; state[1].h = offset_y; 
    state[2].x=5*offset_x; state[2].y=0; state[2].w = offset_x; state[2].h = offset_y; 
    state[3].x=6*offset_x; state[3].y=0; state[3].w = offset_x; state[3].h = offset_y; 
    state[4].x=7*offset_x; state[4].y=0;    state[4].w=offset_x; state[4].h = offset_y; 
    state[5].x=4*offset_x; state[5].y=0; state[5].w=offset_x; state[5].h = offset_y; 
    state[6].x=5*offset_x; state[6].y=0; state[6].w=offset_x; state[6].h = offset_y; 
    state[6].x=6*offset_x; state[6].y=0; state[6].w=offset_x; state[6].h = offset_y; 
    state[7].x=7*offset_x;; state[7].y=0; state[7].w=offset_x; state[7].h = offset_y; 
    state[8].x=4*offset_x; state[8].y=0; state[8].w=offset_x; state[8].h = offset_y; 
    state[9].x=0; state[9].y=0; state[9].w=offset_x; state[9].h = offset_y;
Valentin MEUNIER's avatar
le  
Valentin MEUNIER committed
356
357
    
    for(i=0;i<nb_images_animation;++i){
358
        //afficherImage(renderer,window,tab,taille_cell,background);
Valentin MEUNIER's avatar
Valentin MEUNIER committed
359
	afficherImageBrouillard(renderer,window,tab,taille_cell,background,pos_x,pos_y);
Valentin MEUNIER's avatar
le  
Valentin MEUNIER committed
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
	affichage_fin(texture_fin,window,renderer,noeud_arrive/P,noeud_arrive%P,taille_cell);
	destination.x=destination.x+(deplacement/nb_images_animation);
        SDL_RenderCopy(renderer,texture_elve, &state[i], &destination);
        SDL_RenderPresent(renderer);
        SDL_Delay(10);
    }  
}
void play_standstill_1(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive){
    SDL_Rect source = {0}, window_dimensions = {0},destination = {0};                 

    SDL_GetWindowSize(window, &window_dimensions.w,&window_dimensions.h);               
    SDL_QueryTexture(texture_elve, NULL, NULL,&source.w, &source.h);

    int nb_images = 8;
    int i=0;                           
    int offset_x = source.w/nb_images;
    int offset_y = source.h;   
    SDL_Rect state[1];

    destination.w = offset_x * zoom;           
    destination.h = offset_y * zoom;
    destination.x=pos_x;
    destination.y=pos_y;



    state[0].x=0;
    state[0].y=0;
    state[0].w=offset_x;
    state[0].h = offset_y;
Valentin MEUNIER's avatar
Valentin MEUNIER committed
390
391
    //afficherImage(renderer,window,tab,taille_cell,background);
    afficherImageBrouillard(renderer,window,tab,taille_cell,background,pos_x,pos_y);
Valentin MEUNIER's avatar
le  
Valentin MEUNIER committed
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
    affichage_fin(texture_fin,window,renderer,noeud_arrive/P,noeud_arrive%P,taille_cell);
    SDL_RenderCopy(renderer,texture_elve, &state[i], &destination);
}
void play_standstill_1_l(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive){
    SDL_Rect source = {0}, window_dimensions = {0},destination = {0};                 

    SDL_GetWindowSize(window, &window_dimensions.w,&window_dimensions.h);               
    SDL_QueryTexture(texture_elve, NULL, NULL,&source.w, &source.h);

    int nb_images = 8;
    int i=0;                           
    int offset_x = source.w/nb_images;
    int offset_y = source.h;   
    SDL_Rect state[1];

    destination.w = offset_x * zoom;           
    destination.h = offset_y * zoom;
    destination.x=pos_x;
    destination.y=pos_y;



Valentin MEUNIER's avatar
Valentin MEUNIER committed
414
415
    state[0].x=7*offset_x; state[0].y=0; state[0].w=offset_x; state[0].h = offset_y;

416
    //afficherImage(renderer,window,tab,taille_cell,background);
Valentin MEUNIER's avatar
Valentin MEUNIER committed
417
	 afficherImageBrouillard(renderer,window,tab,taille_cell,background,pos_x,pos_y);
Valentin MEUNIER's avatar
le  
Valentin MEUNIER committed
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
    affichage_fin(texture_fin,window,renderer,noeud_arrive/P,noeud_arrive%P,taille_cell);
    SDL_RenderCopy(renderer,texture_elve, &state[i], &destination);
}
void play_standstill_2(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive){
    SDL_Rect source = {0}, window_dimensions = {0},destination = {0};                 

    SDL_GetWindowSize(window, &window_dimensions.w,&window_dimensions.h);               
    SDL_QueryTexture(texture_elve, NULL, NULL,&source.w, &source.h);

    int nb_images = 8;
    int i=0;                           
    int offset_x = source.w/nb_images;
    int offset_y = source.h;   
    SDL_Rect state[1];

    destination.w = offset_x * zoom;           
    destination.h = offset_y * zoom;
    destination.x=pos_x;
    destination.y=pos_y;



Valentin MEUNIER's avatar
Valentin MEUNIER committed
440
441
442
443
    state[0].x=offset_x; state[0].y=0; state[0].w=offset_x; state[0].h = offset_y;

    //afficherImage(renderer,window,tab,taille_cell,background);
    afficherImageBrouillard(renderer,window,tab,taille_cell,background,pos_x,pos_y);
Valentin MEUNIER's avatar
le  
Valentin MEUNIER committed
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
    affichage_fin(texture_fin,window,renderer,noeud_arrive/P,noeud_arrive%P,taille_cell);
    SDL_RenderCopy(renderer,texture_elve, &state[i], &destination);
}
void play_standstill_2_l(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive){
    SDL_Rect source = {0}, window_dimensions = {0},destination = {0};                 

    SDL_GetWindowSize(window, &window_dimensions.w,&window_dimensions.h);               
    SDL_QueryTexture(texture_elve, NULL, NULL,&source.w, &source.h);

    int nb_images = 8;
    int i=0;                           
    int offset_x = source.w/nb_images;
    int offset_y = source.h;   
    SDL_Rect state[1];

    destination.w = offset_x * zoom;           
    destination.h = offset_y * zoom;
    destination.x=pos_x;
    destination.y=pos_y;



Valentin MEUNIER's avatar
Valentin MEUNIER committed
466
467
468
    state[0].x=6*offset_x; state[0].y=0; state[0].w=offset_x; state[0].h = offset_y;
    //afficherImage(renderer,window,tab,taille_cell,background);
    afficherImageBrouillard(renderer,window,tab,taille_cell,background,pos_x,pos_y);
Valentin MEUNIER's avatar
le  
Valentin MEUNIER committed
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
    affichage_fin(texture_fin,window,renderer,noeud_arrive/P,noeud_arrive%P,taille_cell);
    SDL_RenderCopy(renderer,texture_elve, &state[i], &destination);
}
void play_standstill_3(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive){
    SDL_Rect source = {0}, window_dimensions = {0},destination = {0};                 

    SDL_GetWindowSize(window, &window_dimensions.w,&window_dimensions.h);               
    SDL_QueryTexture(texture_elve, NULL, NULL,&source.w, &source.h);

    int nb_images = 8;
    int i=0;                           
    int offset_x = source.w/nb_images;
    int offset_y = source.h;   
    SDL_Rect state[1];

    destination.w = offset_x * zoom;           
    destination.h = offset_y * zoom;
    destination.x=pos_x;
    destination.y=pos_y;



Valentin MEUNIER's avatar
Valentin MEUNIER committed
491
492
493
    state[0].x=2*offset_x; state[0].y=0; state[0].w=offset_x; state[0].h = offset_y;
    //afficherImage(renderer,window,tab,taille_cell,background);
    afficherImageBrouillard(renderer,window,tab,taille_cell,background,pos_x,pos_y);
Valentin MEUNIER's avatar
le  
Valentin MEUNIER committed
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
    affichage_fin(texture_fin,window,renderer,noeud_arrive/P,noeud_arrive%P,taille_cell);
    SDL_RenderCopy(renderer,texture_elve, &state[i], &destination);
}
void play_standstill_3_l(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive){
    SDL_Rect source = {0}, window_dimensions = {0},destination = {0};                 

    SDL_GetWindowSize(window, &window_dimensions.w,&window_dimensions.h);               
    SDL_QueryTexture(texture_elve, NULL, NULL,&source.w, &source.h);

    int nb_images = 8;
    int i=0;                           
    int offset_x = source.w/nb_images;
    int offset_y = source.h;   
    SDL_Rect state[1];

    destination.w = offset_x * zoom;           
    destination.h = offset_y * zoom;
    destination.x=pos_x;
    destination.y=pos_y;



Valentin MEUNIER's avatar
Valentin MEUNIER committed
516
517
518
    state[0].x=5*offset_x; state[0].y=0; state[0].w=offset_x; state[0].h = offset_y;
    //afficherImage(renderer,window,tab,taille_cell,background);
    afficherImageBrouillard(renderer,window,tab,taille_cell,background,pos_x,pos_y);
Valentin MEUNIER's avatar
le  
Valentin MEUNIER committed
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
    affichage_fin(texture_fin,window,renderer,noeud_arrive/P,noeud_arrive%P,taille_cell);
    SDL_RenderCopy(renderer,texture_elve, &state[i], &destination);
}
void play_standstill_4(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive){
    SDL_Rect source = {0}, window_dimensions = {0},destination = {0};                 

    SDL_GetWindowSize(window, &window_dimensions.w,&window_dimensions.h);               
    SDL_QueryTexture(texture_elve, NULL, NULL,&source.w, &source.h);

    int nb_images = 8;
    int i=0;                           
    int offset_x = source.w/nb_images;
    int offset_y = source.h;   
    SDL_Rect state[1];

    destination.w = offset_x * zoom;           
    destination.h = offset_y * zoom;
    destination.x=pos_x;
    destination.y=pos_y;



Valentin MEUNIER's avatar
Valentin MEUNIER committed
541
542
543
    state[0].x=3*offset_x; state[0].y=0; state[0].w=offset_x; state[0].h = offset_y;
    //afficherImage(renderer,window,tab,taille_cell,background);
    afficherImageBrouillard(renderer,window,tab,taille_cell,background,pos_x,pos_y);
Valentin MEUNIER's avatar
le  
Valentin MEUNIER committed
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
    affichage_fin(texture_fin,window,renderer,noeud_arrive/P,noeud_arrive%P,taille_cell);
    SDL_RenderCopy(renderer,texture_elve, &state[i], &destination);
}
void play_standstill_4_l(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive){
    SDL_Rect source = {0}, window_dimensions = {0},destination = {0};                 

    SDL_GetWindowSize(window, &window_dimensions.w,&window_dimensions.h);               
    SDL_QueryTexture(texture_elve, NULL, NULL,&source.w, &source.h);

    int nb_images = 8;
    int i=0;                           
    int offset_x = source.w/nb_images;
    int offset_y = source.h;   
    SDL_Rect state[1];

    destination.w = offset_x * zoom;           
    destination.h = offset_y * zoom;
    destination.x=pos_x;
    destination.y=pos_y;



Valentin MEUNIER's avatar
Valentin MEUNIER committed
566
567
568
    state[0].x=4*offset_x; state[0].y=0; state[0].w=offset_x; state[0].h = offset_y;
    //afficherImage(renderer,window,tab,taille_cell,background);
    afficherImageBrouillard(renderer,window,tab,taille_cell,background,pos_x,pos_y);
Valentin MEUNIER's avatar
le  
Valentin MEUNIER committed
569
570
571
572
    affichage_fin(texture_fin,window,renderer,noeud_arrive/P,noeud_arrive%P,taille_cell);
    SDL_RenderCopy(renderer,texture_elve, &state[i], &destination);
}