diff options
Diffstat (limited to '')
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | inc/cub3d.h | 17 | ||||
-rw-r--r-- | src/ft_init_lists.c | 27 | ||||
-rw-r--r-- | src/ft_parse_map.c | 8 | ||||
-rw-r--r-- | src/main.c | 18 |
5 files changed, 67 insertions, 11 deletions
@@ -17,6 +17,8 @@ MLX_DIR = libmlx/ INCS = cub3d.h #------------------------------------------------------------------------------# SRCS_NAME = main.c +SRCS_NAME += ft_init_lists.c +# SRCS_NAME += ft_parse_map.c #------------------------------------------------------------------------------# SRCS = $(addprefix ${SRCS_DIR},${SRCS_NAME}) #------------------------------------------------------------------------------# @@ -49,11 +51,11 @@ RM = rm -rf #==============================================================================# ${OBJS_DIR}%.o: ${SRCS_DIR}%.c ${INCS_DIR}${INCS} @${MKDIR} ${OBJS_DIR} - ${CC} -c ${CFLAGS} -I${LFT_DIR}${INCS_DIR} -I${MLX_DIR} \ --I${INCS_DIR} -o $@ $< + ${CC} -c ${CFLAGS} -I${LFT_DIR}${INCS_DIR} -I${MLX_DIR} -I${INCS_DIR} \ +-o $@ $< #------------------------------------------------------------------------------# ${NAME}: ${OBJS} - ${CC} ${CFLAGS} -o $@ $< -L${LFT_DIR} -L${MLX_DIR} -lft -lmlx -lm \ + ${CC} ${CFLAGS} -o $@ ${OBJS} -L${LFT_DIR} -L${MLX_DIR} -lft -lmlx -lm \ -framework OpenGL -framework AppKit #------------------------------------------------------------------------------# all: diff --git a/inc/cub3d.h b/inc/cub3d.h index 7441583..eaac735 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -1,4 +1,21 @@ #ifndef CUB3D_H #define CUB3D_H +typedef struct s_winlist +{ + void *wlx; + void *winptr; + int x_size; + int y_size; +} t_winlist; + +typedef struct s_cublist +{ + char coolcub; +} t_cublist; + +t_cublist *ft_init_cublist(void); +t_winlist *ft_init_winlist(void); +void ft_parse_map(t_cublist *clist); + #endif diff --git a/src/ft_init_lists.c b/src/ft_init_lists.c new file mode 100644 index 0000000..c61dd45 --- /dev/null +++ b/src/ft_init_lists.c @@ -0,0 +1,27 @@ +#include <libft.h> +#include <mlx.h> +#include <cub3d.h> +#include <stdlib.h> + +t_winlist +*ft_init_winlist(void) +{ + t_winlist *wlist; + + wlist = (t_winlist*)malloc(sizeof(t_winlist)); + wlist->x_size = 800; + wlist->y_size = 600; + wlist->wlx = mlx_init(); + wlist->winptr = (void*)malloc(800 * 600); + wlist->winptr = mlx_new_window(wlist->wlx, 800, 600, "Cub3D"); + return (wlist); +} + +t_cublist +*ft_init_cublist(void) +{ + t_cublist *clist; + + clist = (t_cublist*)malloc(sizeof(t_cublist)); + return (clist); +} diff --git a/src/ft_parse_map.c b/src/ft_parse_map.c new file mode 100644 index 0000000..b600849 --- /dev/null +++ b/src/ft_parse_map.c @@ -0,0 +1,8 @@ +#include <libft.h> +#include <cub3d.h> +#include <stdlib.h> + +void +ft_parse_map(t_cublist *clist) +{ +} @@ -1,18 +1,20 @@ #include <libft.h> #include <mlx.h> +#include <cub3d.h> #include <stdlib.h> int main(void) { - void *win; - void *winptr; + t_winlist *wlist; + t_cublist *clist; - win = mlx_init(); - winptr = (void*)malloc(800 * 600); - winptr = mlx_new_window(win, 800, 600, "Cub3d"); - mlx_loop(win); - free(winptr); - free(win); + wlist = ft_init_winlist(); + clist = ft_init_cublist(); + mlx_loop(wlist->wlx); + ft_memdel(wlist->wlx); + ft_memdel(wlist->winptr); + ft_memdel(wlist); + ft_memdel(clist); return (0); } |