aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_tex_num_init.c
blob: 34b5c115e1975bec4b235d864eebbcb9986b18ef (plain)
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
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
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_tex_num_init.c                                  :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: fmoenne- <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/14 17:43:55 by fmoenne-          #+#    #+#             */
/*   Updated: 2020/02/14 17:43:56 by fmoenne-         ###   ########lyon.fr   */
/*                                                                            */
/* ************************************************************************** */

#include <cub3d.h>
#include <mlx.h>

/*
** tnum[] index summary
** ---------------------
**  0: zero
**  1: one
**  2: two
**  3: three
**  4: four
**  5: five
**  6: six
**  7: seven
**  8: eight
**  9: nine
** 10: percent
** 11: infinite
*/

static void
	ft_next_num_init(t_cub *cl)
{
	cl->tnum[6].img = mlx_xpm_file_to_image(cl->wlist.wlx,
		FT_SIX_PATH, &cl->tnum[6].img_w, &cl->tnum[6].img_h);
	cl->tnum[6].ptr = mlx_get_data_addr(cl->tnum[6].img,
		&cl->tnum[6].bpp, &cl->tnum[6].sizeline, &cl->tnum[6].endian);
	cl->tnum[7].img = mlx_xpm_file_to_image(cl->wlist.wlx,
		FT_SEV_PATH, &cl->tnum[7].img_w, &cl->tnum[7].img_h);
	cl->tnum[7].ptr = mlx_get_data_addr(cl->tnum[7].img,
		&cl->tnum[7].bpp, &cl->tnum[7].sizeline, &cl->tnum[7].endian);
	cl->tnum[8].img = mlx_xpm_file_to_image(cl->wlist.wlx,
		FT_EIG_PATH, &cl->tnum[8].img_w, &cl->tnum[8].img_h);
	cl->tnum[8].ptr = mlx_get_data_addr(cl->tnum[8].img,
		&cl->tnum[8].bpp, &cl->tnum[8].sizeline, &cl->tnum[8].endian);
	cl->tnum[9].img = mlx_xpm_file_to_image(cl->wlist.wlx,
		FT_NIN_PATH, &cl->tnum[9].img_w, &cl->tnum[9].img_h);
	cl->tnum[9].ptr = mlx_get_data_addr(cl->tnum[9].img,
		&cl->tnum[9].bpp, &cl->tnum[9].sizeline, &cl->tnum[9].endian);
	cl->tnum[10].img = mlx_xpm_file_to_image(cl->wlist.wlx,
		FT_PER_PATH, &cl->tnum[10].img_w, &cl->tnum[10].img_h);
	cl->tnum[10].ptr = mlx_get_data_addr(cl->tnum[10].img,
		&cl->tnum[10].bpp, &cl->tnum[10].sizeline, &cl->tnum[10].endian);
	cl->tnum[11].img = mlx_xpm_file_to_image(cl->wlist.wlx,
		FT_INF_PATH, &cl->tnum[11].img_w, &cl->tnum[11].img_h);
	cl->tnum[11].ptr = mlx_get_data_addr(cl->tnum[11].img,
		&cl->tnum[11].bpp, &cl->tnum[11].sizeline, &cl->tnum[11].endian);
}

void
	ft_num_tex_init(t_cub *cl)
{
	cl->tnum[0].img = mlx_xpm_file_to_image(cl->wlist.wlx,
		FT_ZER_PATH, &cl->tnum[0].img_w, &cl->tnum[0].img_h);
	cl->tnum[0].ptr = mlx_get_data_addr(cl->tnum[0].img,
		&cl->tnum[0].bpp, &cl->tnum[0].sizeline, &cl->tnum[0].endian);
	cl->tnum[1].img = mlx_xpm_file_to_image(cl->wlist.wlx,
		FT_ONE_PATH, &cl->tnum[1].img_w, &cl->tnum[1].img_h);
	cl->tnum[1].ptr = mlx_get_data_addr(cl->tnum[1].img,
		&cl->tnum[1].bpp, &cl->tnum[1].sizeline, &cl->tnum[1].endian);
	cl->tnum[2].img = mlx_xpm_file_to_image(cl->wlist.wlx,
		FT_TWO_PATH, &cl->tnum[2].img_w, &cl->tnum[2].img_h);
	cl->tnum[2].ptr = mlx_get_data_addr(cl->tnum[2].img,
		&cl->tnum[2].bpp, &cl->tnum[2].sizeline, &cl->tnum[2].endian);
	cl->tnum[3].img = mlx_xpm_file_to_image(cl->wlist.wlx,
		FT_THR_PATH, &cl->tnum[3].img_w, &cl->tnum[3].img_h);
	cl->tnum[3].ptr = mlx_get_data_addr(cl->tnum[3].img,
		&cl->tnum[3].bpp, &cl->tnum[3].sizeline, &cl->tnum[3].endian);
	cl->tnum[4].img = mlx_xpm_file_to_image(cl->wlist.wlx,
		FT_FOU_PATH, &cl->tnum[4].img_w, &cl->tnum[4].img_h);
	cl->tnum[4].ptr = mlx_get_data_addr(cl->tnum[4].img,
		&cl->tnum[4].bpp, &cl->tnum[4].sizeline, &cl->tnum[4].endian);
	cl->tnum[5].img = mlx_xpm_file_to_image(cl->wlist.wlx,
		FT_FIV_PATH, &cl->tnum[5].img_w, &cl->tnum[5].img_h);
	cl->tnum[5].ptr = mlx_get_data_addr(cl->tnum[5].img,
		&cl->tnum[5].bpp, &cl->tnum[5].sizeline, &cl->tnum[5].endian);
	ft_next_num_init(cl);
}