aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r5p2.le-101.fr>2020-02-29 20:39:06 +0100
committerRudy Bousset <rbousset@z2r5p2.le-101.fr>2020-02-29 20:39:06 +0100
commit69773438b156d74db51287301ae0fdb456fec0a2 (patch)
tree5d102095cef27e4df6296a5d978c5b6cf0b0a453
parentRemoved opti flags (diff)
download42-cub3d-69773438b156d74db51287301ae0fdb456fec0a2.tar.gz
42-cub3d-69773438b156d74db51287301ae0fdb456fec0a2.tar.bz2
42-cub3d-69773438b156d74db51287301ae0fdb456fec0a2.tar.xz
42-cub3d-69773438b156d74db51287301ae0fdb456fec0a2.tar.zst
42-cub3d-69773438b156d74db51287301ae0fdb456fec0a2.zip
Argv in progress
-rw-r--r--Makefile1
-rw-r--r--inc/cub3d.h1
-rw-r--r--src/ft_save_to_bmp.c8
-rw-r--r--src/main.c13
4 files changed, 19 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index b0ea728..9f643a4 100644
--- a/Makefile
+++ b/Makefile
@@ -66,6 +66,7 @@ SRCS_NAME += ft_draw_hud.c
SRCS_NAME += ft_music.c
SRCS_NAME += ft_draw_sprite.c
SRCS_NAME += ft_warp_level.c
+SRCS_NAME += ft_save_to_bmp.c
#--------------------------------------------------------------------------------------------------#
SRCS = $(addprefix ${SRCS_DIR},${SRCS_NAME})
#--------------------------------------------------------------------------------------------------#
diff --git a/inc/cub3d.h b/inc/cub3d.h
index f534fe8..c1ed9c3 100644
--- a/inc/cub3d.h
+++ b/inc/cub3d.h
@@ -86,5 +86,6 @@ void ft_music(t_cub *cl);
void ft_draw_sprite(t_cub *cl, int i);
int8_t ft_warp_level(t_cub *cl);
t_rgb ft_init_rgb(void);
+void ft_save_to_bmp(void);
# endif
diff --git a/src/ft_save_to_bmp.c b/src/ft_save_to_bmp.c
new file mode 100644
index 0000000..f8d1a6e
--- /dev/null
+++ b/src/ft_save_to_bmp.c
@@ -0,0 +1,8 @@
+#include <libft.h>
+#include <cub3d.h>
+
+void
+ ft_save_to_bmp(void)
+{
+ ft_printf("qwe\n");
+}
diff --git a/src/main.c b/src/main.c
index 52bb211..0e21668 100644
--- a/src/main.c
+++ b/src/main.c
@@ -24,15 +24,20 @@ int
if (argc < 2)
{
ft_dprintf(STDERR_FILENO, "Error\n\033[1;31mNo map selected\n\033[0m");
- return (1);
+ return (RET_NO_ARGV);
}
if (ft_init_cub3d(&clist) < 0)
- return (2);
+ return (RET_FAILED_STRUCTS);
ft_parse_map(argv[1], clist);
if (ft_init_winlx(clist) < 0)
return (ft_exit(3, clist));
ft_wall_tex_init(clist);
- ft_draw_scene(clist);
- ft_hooks_and_loops(clist->wlist, clist);
+ if (argc < 3)
+ {
+ ft_draw_scene(clist);
+ ft_hooks_and_loops(clist->wlist, clist);
+ }
+ else if (argc == 3 && !ft_strncmp("--save", argv[2], 7))
+ ft_save_to_bmp();
return (0);
}