Header and init

This commit is contained in:
Etienne Rey-bethbeder 2023-04-26 12:55:14 +02:00
parent 123ceb2391
commit ad754bb579
3 changed files with 68 additions and 6 deletions

View File

@ -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

33
cube3D.h Normal file
View File

@ -0,0 +1,33 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* cube3D.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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<sys/types.h>
// 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

33
main.c Normal file
View File

@ -0,0 +1,33 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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);
}