From ad754bb579769032da7c93ffffcbce925ca8f964 Mon Sep 17 00:00:00 2001 From: Etienne Rey-bethbeder Date: Wed, 26 Apr 2023 12:55:14 +0200 Subject: [PATCH] Header and init --- Makefile | 8 ++------ cube3D.h | 33 +++++++++++++++++++++++++++++++++ main.c | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 cube3D.h create mode 100644 main.c diff --git a/Makefile b/Makefile index 77b2616..f8b4899 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,19 @@ -SRCS = +SRCS = main.c OBJS = ${SRCS:.c=.o} -LIBS = libft/libft.a CC = clang CFLAGS = -g -Wall -Wextra -Werror -NAME = pipex +NAME = cub3D all: ${NAME} ${NAME}: ${OBJS} - make -C libft ${CC} ${CFLAGS} -o ${NAME} ${OBJS} ${LIBS} clean: rm -f ${OBJS} - make -C libft clean fclean: rm -f ${OBJS} ${NAME} - make -C libft fclean re: fclean all diff --git a/cube3D.h b/cube3D.h new file mode 100644 index 0000000..68bb4c6 --- /dev/null +++ b/cube3D.h @@ -0,0 +1,33 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* cube3D.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: erey-bet +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/04/26 12:34:04 by erey-bet #+# #+# */ +/* Updated: 2023/04/26 12:50:18 by erey-bet ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef CUBE3D_H +# define CUBE3D_H + +# include + +// img: 0=Nord, 1=WEST, 2=SUD, 3=EAST; + +typedef struct s_map +{ + char **map; + size_t size_x; + size_t size_y; + void *img[4]; + long color_bot; + long color_top; +} t_map; + +t_map *map_parsing(char *path); +int start_game(t_map *map); + +#endif diff --git a/main.c b/main.c new file mode 100644 index 0000000..31c6bc8 --- /dev/null +++ b/main.c @@ -0,0 +1,33 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: erey-bet +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/04/26 12:44:55 by erey-bet #+# #+# */ +/* Updated: 2023/04/26 12:52:13 by erey-bet ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "cube3D.h" + +int main(int argc, char **argv) +{ + t_map *map; + + if (argc != 2) + { + return (1); + } + map = map_parsing(argv[1]); + if (!map) + { + return (2); + } + if (start_game(map)) + { + return (3); + } + return (0); +}