-
Notifications
You must be signed in to change notification settings - Fork 0
/
loading.c
54 lines (50 loc) · 2.2 KB
/
loading.c
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
54
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* loading.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mhedeon <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/01/21 18:21:14 by mhedeon #+# #+# */
/* Updated: 2019/01/31 18:08:28 by mhedeon ### ########.fr */
/* */
/* ************************************************************************** */
#include "wolf3d.h"
static int load_screen(t_texture *load, int persent)
{
if (persent <= 10)
return (load_texture(load, "./resource/img/loading/L10.jpg"));
else if (persent > 10 && persent <= 20)
return (load_texture(load, "./resource/img/loading/L20.jpg"));
else if (persent > 20 && persent <= 30)
return (load_texture(load, "./resource/img/loading/L30.jpg"));
else if (persent > 30 && persent <= 40)
return (load_texture(load, "./resource/img/loading/L40.jpg"));
else if (persent > 40 && persent <= 50)
return (load_texture(load, "./resource/img/loading/L50.jpg"));
else if (persent > 50 && persent <= 60)
return (load_texture(load, "./resource/img/loading/L60.jpg"));
else if (persent > 60 && persent <= 70)
return (load_texture(load, "./resource/img/loading/L70.jpg"));
else if (persent > 70 && persent <= 80)
return (load_texture(load, "./resource/img/loading/L80.jpg"));
else if (persent > 80 && persent <= 90)
return (load_texture(load, "./resource/img/loading/L90.jpg"));
else if (persent > 90)
return (load_texture(load, "./resource/img/loading/L100.jpg"));
return (0);
}
void loading(t_wolf *wolf, int persent)
{
t_texture load;
SDL_Event e;
load.sur = NULL;
while (SDL_PollEvent(&e))
;
if (load_screen(&load, persent))
{
cp_tex_to_buff(wolf, &load);
screen_upd(wolf);
destroy_texture(&load);
}
}