-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprint.c
51 lines (45 loc) · 1.79 KB
/
print.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: alimotta <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/18 14:15:42 by alimotta #+# #+# */
/* Updated: 2024/01/18 14:15:44 by alimotta ### ########.fr */
/* */
/* ************************************************************************** */
#include "solong.h"
void ft_print_moves(t_vars **v)
{
char *move;
mlx_string_put((*v)->mlx, (*v)->win, 5,
(*v)->win_h - 40, 0xffffff, "Moves :");
move = ft_itoa((*v)->move);
mlx_string_put((*v)->mlx, (*v)->win, 50, (*v)->win_h - 40,
0x000000, move);
free (move);
(*v)->move++;
move = ft_itoa((*v)->move);
mlx_string_put((*v)->mlx, (*v)->win, 50, (*v)->win_h - 40,
0xffffff, move);
free (move);
}
void put_image(t_vars ***v, int h, int w, char *img)
{
int img_w;
int img_h;
(**v)-> img = mlx_xpm_file_to_image((**v)-> mlx, img, &img_w, &img_h);
mlx_put_image_to_window((**v)-> mlx, (**v)-> win, (**v)-> img, h, w);
mlx_destroy_image((**v)-> mlx, (**v)-> img);
}
int ft_print_end(t_vars **v)
{
if ((*v)->lose == 2)
put_image(&v, 0, 0, "./textures/lost.xpm");
else
put_image(&v, 0, 0, "./textures/won.xpm");
mlx_string_put((*v)->mlx, (*v)->win, 5,
512 + 50, 0xffffff, "PRESS ESC TO EXIT");
return (0);
}