aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_tex_init.c
blob: aba5338f312d2b39bca4b2ac040e167e44b1bac8 (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
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_basic_keys.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 <stdint.h>
#include <mlx.h>

/*
 * 0 : no
 * 1 : so
 * 2 : ea
 * 3 : we
 * 4 : sprite
 **/

void	ft_wall_tex_init(t_cub *clist)
{
	clist->tlist[0].img = mlx_xpm_file_to_image(clist->wlist->wlx, 
		clist->mlist->no_tex_path, &clist->tlist[0].img_w, &clist->tlist[0].img_h);
	clist->tlist[0].ptr = mlx_get_data_addr(clist->tlist[0].img,
		&clist->tlist[0].bpp, &clist->tlist[0].sizeline, &clist->tlist[0].endian);
	clist->tlist[1].img = mlx_xpm_file_to_image(clist->wlist->wlx, 
		clist->mlist->so_tex_path, &clist->tlist[1].img_w, &clist->tlist[1].img_h);
	clist->tlist[1].ptr = mlx_get_data_addr(clist->tlist[1].img,
		&clist->tlist[1].bpp, &clist->tlist[1].sizeline, &clist->tlist[1].endian);
	clist->tlist[2].img = mlx_xpm_file_to_image(clist->wlist->wlx, 
		clist->mlist->ea_tex_path, &clist->tlist[2].img_w, &clist->tlist[2].img_h);
	clist->tlist[2].ptr = mlx_get_data_addr(clist->tlist[2].img,
		&clist->tlist[2].bpp, &clist->tlist[2].sizeline, &clist->tlist[2].endian);
	clist->tlist[3].img = mlx_xpm_file_to_image(clist->wlist->wlx, 
		clist->mlist->we_tex_path, &clist->tlist[3].img_w, &clist->tlist[3].img_h);
	clist->tlist[3].ptr = mlx_get_data_addr(clist->tlist[3].img,
		&clist->tlist[3].bpp, &clist->tlist[3].sizeline, &clist->tlist[3].endian);
	clist->tlist[4].img = mlx_xpm_file_to_image(clist->wlist->wlx, 
		clist->mlist->sprite_path, &clist->tlist[4].img_w, &clist->tlist[4].img_h);
	clist->tlist[4].ptr = mlx_get_data_addr(clist->tlist[4].img,
		&clist->tlist[4].bpp, &clist->tlist[4].sizeline, &clist->tlist[4].endian);
}