diff --git a/Makefile b/Makefile index 27824fd..54046b1 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ SOURCEFILES=src/main.c \ src/map/forbidden_characters.c \ src/utils/hooks.c \ src/draw/drawutils.c \ - src/draw/map.c + src/draw/draw_map.c OBJECTS=$(patsubst src/%.c,objects/%.o,$(SOURCEFILES)) OBJDIR=objects NAME=cub3d diff --git a/src/draw/map.c b/src/draw/draw_map.c similarity index 83% rename from src/draw/map.c rename to src/draw/draw_map.c index b39b0a7..645c819 100644 --- a/src/draw/map.c +++ b/src/draw/draw_map.c @@ -1,16 +1,17 @@ /* ************************************************************************** */ /* */ /* ::: :::::::: */ -/* map.c :+: :+: :+: */ +/* draw_map.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: tchampio +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ -/* Created: 2025/07/15 10:28:39 by tchampio #+# #+# */ -/* Updated: 2025/07/15 10:29:06 by tchampio ### ########.fr */ +/* Created: 2025/07/17 14:20:00 by kcolin #+# #+# */ +/* Updated: 2025/07/17 14:30:59 by kcolin ### ########.fr */ /* */ /* ************************************************************************** */ -#include "../../includes/cub3d.h" +#include "../../includes/structs.h" +#include "drawutils.h" void draw_2d_wall(unsigned int color, t_mlx_data *data, int x, int y) diff --git a/includes/cub3d.h b/src/draw/draw_map.h similarity index 51% rename from includes/cub3d.h rename to src/draw/draw_map.h index c74ec85..7343db3 100644 --- a/includes/cub3d.h +++ b/src/draw/draw_map.h @@ -1,28 +1,20 @@ /* ************************************************************************** */ /* */ /* ::: :::::::: */ -/* cub3d.h :+: :+: :+: */ +/* draw_map.h :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: tchampio +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ -/* Created: 2025/07/15 10:18:44 by tchampio #+# #+# */ -/* Updated: 2025/07/15 10:32:42 by tchampio ### ########.fr */ +/* Created: 2025/07/17 14:20:13 by kcolin #+# #+# */ +/* Updated: 2025/07/17 14:35:31 by kcolin ### ########.fr */ /* */ /* ************************************************************************** */ -#ifndef CUB3D_H -# define CUB3D_H +#ifndef DRAW_MAP_H +# define DRAW_MAP_H -# include "structs.h" -# include "cub3d_consts.h" -# include "maputils.h" +# include "../../includes/structs.h" -int destroy(t_cub3d_data *data); -int keypress_handler(int keycode, t_cub3d_data *data); -int keyrelease_handler(int keycode, t_cub3d_data *data); -void my_mlx_pixel_put(t_mlx_data *data, int x, int y, int color); -void draw_2d_wall(unsigned int color, t_mlx_data *data, int x, int y); void draw_map(t_mapdata *map, t_player *player, t_mlx_data *data); -void gnl_exhaust(int fd); #endif diff --git a/src/draw/drawutils.c b/src/draw/drawutils.c index 6e7a93d..8592e7e 100644 --- a/src/draw/drawutils.c +++ b/src/draw/drawutils.c @@ -3,14 +3,14 @@ /* ::: :::::::: */ /* drawutils.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: tchampio +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ -/* Created: 2025/07/15 10:27:46 by tchampio #+# #+# */ -/* Updated: 2025/07/15 10:28:10 by tchampio ### ########.fr */ +/* Created: 2025/07/17 14:28:56 by kcolin #+# #+# */ +/* Updated: 2025/07/17 14:29:08 by kcolin ### ########.fr */ /* */ /* ************************************************************************** */ -#include "../../includes/cub3d.h" +#include "../../includes/structs.h" void my_mlx_pixel_put(t_mlx_data *data, int x, int y, int color) { diff --git a/src/draw/drawutils.h b/src/draw/drawutils.h new file mode 100644 index 0000000..0ed70cd --- /dev/null +++ b/src/draw/drawutils.h @@ -0,0 +1,20 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* drawutils.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: kcolin +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/07/17 14:30:04 by kcolin #+# #+# */ +/* Updated: 2025/07/17 14:30:38 by kcolin ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef DRAWUTILS_H +# define DRAWUTILS_H + +# include "../../includes/structs.h" + +void my_mlx_pixel_put(t_mlx_data *data, int x, int y, int color); + +#endif // DRAWUTILS_H diff --git a/src/main.c b/src/main.c index 94bb7d3..1148bd2 100644 --- a/src/main.c +++ b/src/main.c @@ -6,7 +6,7 @@ /* By: kcolin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */ -/* Updated: 2025/07/17 14:15:04 by kcolin ### ########.fr */ +/* Updated: 2025/07/17 14:24:45 by kcolin ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,7 +15,8 @@ #include "../mlx/mlx.h" #include "../includes/maputils.h" #include "../includes/cub3d_consts.h" -#include "../includes/cub3d.h" +#include "draw/draw_map.h" +#include "utils/hooks.h" #include #include #include diff --git a/src/map/setters.c b/src/map/setters.c index a5b472b..8c5f039 100644 --- a/src/map/setters.c +++ b/src/map/setters.c @@ -6,13 +6,13 @@ /* By: kcolin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/06/21 19:35:43 by tchampio #+# #+# */ -/* Updated: 2025/07/17 14:17:39 by kcolin ### ########.fr */ +/* Updated: 2025/07/17 14:27:56 by kcolin ### ########.fr */ /* */ /* ************************************************************************** */ #include "../../includes/maputils.h" #include "../../libft/includes/libft.h" -#include "../../includes/cub3d.h" +#include "../utils/frees.h" unsigned long set_color(const char *s, t_mapdata *map) { diff --git a/src/utils/frees.c b/src/utils/frees.c index 416cc94..1f73498 100644 --- a/src/utils/frees.c +++ b/src/utils/frees.c @@ -6,7 +6,7 @@ /* By: kcolin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/07/17 13:59:27 by kcolin #+# #+# */ -/* Updated: 2025/07/17 14:18:05 by kcolin ### ########.fr */ +/* Updated: 2025/07/17 14:27:07 by kcolin ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/src/utils/frees.h b/src/utils/frees.h new file mode 100644 index 0000000..909b35d --- /dev/null +++ b/src/utils/frees.h @@ -0,0 +1,21 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* frees.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: kcolin +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/07/17 14:27:11 by kcolin #+# #+# */ +/* Updated: 2025/07/17 14:28:47 by kcolin ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef FREES_H +# define FREES_H + +# include "../../includes/structs.h" + +void gnl_exhaust(int fd); +int destroy(t_cub3d_data *data); + +#endif // FREES_H diff --git a/src/utils/hooks.c b/src/utils/hooks.c index 609a837..1ddcfeb 100644 --- a/src/utils/hooks.c +++ b/src/utils/hooks.c @@ -3,16 +3,16 @@ /* ::: :::::::: */ /* hooks.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: tchampio +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ -/* Created: 2025/07/15 10:13:47 by tchampio #+# #+# */ -/* Updated: 2025/07/15 10:27:03 by tchampio ### ########.fr */ +/* Created: 2025/07/17 14:22:57 by kcolin #+# #+# */ +/* Updated: 2025/07/17 14:28:18 by kcolin ### ########.fr */ /* */ /* ************************************************************************** */ #include "../../includes/cub3d_consts.h" -#include "../../includes/cub3d.h" #include "../../includes/structs.h" +#include "frees.h" #include #include diff --git a/src/utils/hooks.h b/src/utils/hooks.h new file mode 100644 index 0000000..ba3944c --- /dev/null +++ b/src/utils/hooks.h @@ -0,0 +1,21 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* hooks.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: kcolin +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/07/17 14:23:06 by kcolin #+# #+# */ +/* Updated: 2025/07/17 14:24:58 by kcolin ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef HOOKS_H +# define HOOKS_H + +# include "../../includes/structs.h" + +int keypress_handler(int keycode, t_cub3d_data *data); +int keyrelease_handler(int keycode, t_cub3d_data *data); + +#endif // HOOKS_H