aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ft_draw_scene.c5
-rw-r--r--src/ft_init_bmp.c27
-rw-r--r--src/ft_save_to_bmp.c2
3 files changed, 32 insertions, 2 deletions
diff --git a/src/ft_draw_scene.c b/src/ft_draw_scene.c
index 78a56b4..9dcc8df 100644
--- a/src/ft_draw_scene.c
+++ b/src/ft_draw_scene.c
@@ -33,12 +33,15 @@ void
void
ft_draw_scene_bmp(t_cub *clist)
{
+ t_bmp bmp;
+
clist->img.img = mlx_new_image(clist->wlist.wlx,
clist->wlist.x_size, clist->wlist.y_size);
clist->img.ptr = mlx_get_data_addr(clist->img.img, &clist->img.bpp,
&clist->img.sizeline, &clist->img.endian);
ft_castray(clist);
- if (ft_save_to_bmp(clist->img.img, clist) < 0)
+ bmp = ft_init_bmp();
+ if (ft_save_to_bmp(bmp, clist->img.img, clist) < 0)
ft_error(FT_ERR_WR_BMP, clist);
mlx_destroy_image(clist->wlist.wlx, clist->img.img);
}
diff --git a/src/ft_init_bmp.c b/src/ft_init_bmp.c
new file mode 100644
index 0000000..cc8d59b
--- /dev/null
+++ b/src/ft_init_bmp.c
@@ -0,0 +1,27 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_init_bmp.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/14 17:28:46 by rbousset #+# #+# */
+/* Updated: 2020/02/14 17:28:46 by rbousset ### ########lyon.fr */
+/* */
+/* ************************************************************************** */
+
+#include <cub3d.h>
+#include <stdint.h>
+
+t_bmp
+ ft_init_bmp(void)
+{
+ t_bmp bmp;
+
+ bmp.file_type = 0x4d42;
+ bmp.file_size = 0;
+ bmp.reserv_one = 0;
+ bmp.reserv_two = 0;
+ bmp.offset_data = 0;
+ return (bmp);
+}
diff --git a/src/ft_save_to_bmp.c b/src/ft_save_to_bmp.c
index 1118384..f69316f 100644
--- a/src/ft_save_to_bmp.c
+++ b/src/ft_save_to_bmp.c
@@ -30,7 +30,7 @@ static int8_t
}
int8_t
- ft_save_to_bmp(void *img, t_cub *cl)
+ ft_save_to_bmp(t_bmp bmp, void *img, t_cub *cl)
{
if (ft_convert_image_to_bmp(img, cl) < 0)
return (-1);