mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 09:58:09 +01:00
dev: Added width and height texture information
This commit is contained in:
parent
33f0c4e896
commit
70f6a36aad
2 changed files with 11 additions and 10 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/17 15:47:13 by kcolin #+# #+# */
|
||||
/* Updated: 2025/07/17 15:47:39 by kcolin ### ########.fr */
|
||||
/* Updated: 2025/08/20 16:36:44 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -20,6 +20,8 @@ typedef struct s_img_data
|
|||
int bits_per_pixel;
|
||||
int line_length;
|
||||
int endian;
|
||||
int width;
|
||||
int height;
|
||||
} t_img_data;
|
||||
|
||||
#endif // IMG_DATA_H
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/31 13:43:05 by kcolin #+# #+# */
|
||||
/* Updated: 2025/08/18 13:52:41 by kcolin ### ########.fr */
|
||||
/* Updated: 2025/08/20 16:37:44 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -21,22 +21,21 @@
|
|||
|
||||
t_img_data *load_single_texture(t_cub3d_data *data, char *path)
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
void *img;
|
||||
t_img_data *img_data;
|
||||
|
||||
img = mlx_xpm_file_to_image(data->mlx, path, &width, &height);
|
||||
img = mlx_xpm_file_to_image(data->mlx, path, &img_data->width,
|
||||
&img_data->height);
|
||||
if (img == NULL)
|
||||
{
|
||||
ft_printf("Error: failed to open image at %s\n", path);
|
||||
destroy(data, 1);
|
||||
}
|
||||
if (width != height || width != TEXTURE_SIZE)
|
||||
{
|
||||
ft_printf("Error: textures are not the right size\n");
|
||||
destroy(data, 1);
|
||||
}
|
||||
// if (width != height || width != TEXTURE_SIZE)
|
||||
// {
|
||||
// ft_printf("Error: textures are not the right size\n");
|
||||
// destroy(data, 1);
|
||||
// }
|
||||
ft_printf("image: %p\n", img);
|
||||
img_data = ft_calloc(sizeof(t_img_data), 1);
|
||||
img_data->img = img;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue