1
0

🏗️」 wip: information map

This commit is contained in:
Maelys
2024-09-12 17:00:27 +02:00
parent 621a7b8e21
commit fa4c3d6d39
7 changed files with 103 additions and 70 deletions

View File

@ -16,7 +16,12 @@ MACRO_DIR = MacroLibX/
INCLUDE = -I $(I_DIR) -I $(LIBFT_DIR)/$(I_DIR) -I $(MACRO_DIR)/$(I_DIR)
SRCS = $(shell find src -name '*.c')
SRCS = src/utils/mess_error.c \
src/utils/parse_utils.c \
src/parsing/check_map.c \
src/parsing/check_arg.c \
src/parsing/principal_pars.c \
src/cub3d.c
OBJS = $(addprefix $(OBJSDIR), $(SRCS:.c=.o))

View File

@ -6,13 +6,26 @@
/* By: madumerg <madumerg@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/12 12:49:16 by madumerg #+# #+# */
/* Updated: 2024/09/12 12:57:11 by madumerg ### ########.fr */
/* Updated: 2024/09/12 16:58:29 by madumerg ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef PARSING_H
# define PARSING_H
typedef struct s_coord
{
int x;
int y;
} t_coord;
typedef struct s_pars
{
int f_color;
int c_color;
t_coord coor;
} t_pars;
//check_arg.c
int check_err_arg(int ac, char **av);
int check_format_file(char *file);
@ -25,6 +38,7 @@ int count_player(char **map);
int check_char_map(char **map);
//principal_pars.c
int verif_info_map(char *av);
int verif_all_map(char **map);
char **parse_map(char *map);
@ -32,6 +46,7 @@ char **parse_map(char *map);
int err_mess(char *str);
//parse_utils.c
char **info_map(char **file);
void convert_white_s(char *str);
int verif_char(char c);
#endif

43
map.cub
View File

@ -1,33 +1,22 @@
11111
1001S1
11111
1 1 1
NO ./path_to_the_north_texture
SO ./path_to_the_south_texture
WE ./path_to_the_west_texture
EA ./path_to_the_east_texture
F 220,100,0
C 225,30,0
11111
11111
1001S1
11111
11111
11111
11101
11111
111
101
111

View File

@ -6,33 +6,36 @@
/* By: madumerg <madumerg@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/04 16:58:27 by madumerg #+# #+# */
/* Updated: 2024/09/12 11:22:31 by adjoly ### ########.fr */
/* Updated: 2024/09/12 16:56:30 by madumerg ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3d.h"
#include "game.h"
#include "mlx.h"
#include "libft.h"
#include "parsing.h"
t_pars init_pars(void)
{
t_pars new;
new = ft_calloc(sizeof(t_pars));
if (!new)
return (NULL);
new->f_color = 0;
new->c_color = 0;
new->coor->x = 0;
new->coor->y = 0
return (new);
}
int main(int ac, char **av)
{
//char **map;
t_pars pars;
(void)ac;
(void)av;
// if (check_err_arg(ac, av) == 1)
// return (1);
// map = parse_map(av[1]);
// if (verif_all_map(map) == 1)
// return (1);
void *mlx = mlx_init();
void *win = mlx_new_window(mlx, 400, 400, "WTF");
mlx_on_event(mlx, win, MLX_KEYDOWN, key_hook, mlx);
mlx_loop(mlx);
mlx_destroy_window(mlx, win);
mlx_destroy_display(mlx);
pars = init_pars(void);
if (check_err_arg(ac, av) == 1)
return (1);
if (verif_info_map(av[1], &pars) == 1)
return (1);
return (0);
}

View File

@ -1,23 +1,6 @@
char **map = ft_parse_map(av[1]);
int i = 0;
while (map[i])
{
ft_putchar_fd('*', 2);
ft_putstr_fd(map[i], 2);
ft_putchar_fd('*', 2);
ft_putchar_fd('\n', 2);
i++;
}
//envoyer de 0 a 3 inclus dans check id texture
//envoyer de 4 a 5 inclus dans check rgb format
//envoyer de 6 a jusqu a la fin dans check map
// convertir tt les whites spaces en simple espace sur les 6 1ere lignes
// convertir tt les whites spaces en simple espace //prblm avec les tab
struct typedef s_pars
{
} t_pars;
WARNIIIIIINNNNNNNNNNNNNGGG TESTER LES MALLOC A NULL
//faire struct de coor
utiliser la ft pour couleur

View File

@ -6,12 +6,30 @@
/* By: madumerg <madumerg@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/12 12:44:52 by madumerg #+# #+# */
/* Updated: 2024/09/12 12:54:54 by madumerg ### ########.fr */
/* Updated: 2024/09/12 16:49:20 by madumerg ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3d.h"
int check_info(char **l)
{
}
int verif_info_map(char *av)
{
char **map;
char **f_part;
map = parse_map(av);
f_part = info_map(map);
if (check_info(f_part) == 1)
return (1);
if (verif_all_map(map) == 1)
return (1);
}
int verif_all_map(char **map)
{
if (check_char_map(map) == 1)

View File

@ -6,12 +6,32 @@
/* By: madumerg <madumerg@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/11 14:20:54 by madumerg #+# #+# */
/* Updated: 2024/09/11 22:15:23 by madumerg ### ########.fr */
/* Updated: 2024/09/12 16:20:31 by madumerg ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3d.h"
char **info_map(char **file)
{
char **f_part;
int i;
int j;
i = 0;
j = 0;
f_part = ft_calloc(6, sizeof(char *));
if (!f_part)
return (NULL);
while (i < 6)
{
f_part[j] = file[i];
j++;
i++;
}
return (f_part);
}
void convert_white_s(char *str)
{
int i;