From fb98fd19ba9e27eb3a169a7599ce41fb0877b7a6 Mon Sep 17 00:00:00 2001
From: Rudy Bousset <rbousset@z3r8p1.le-101.fr>
Date: Thu, 13 Feb 2020 19:22:15 +0100
Subject: Better code structure

---
 inc/cub3d.h         | 12 ++++++++----
 inc/cub3d_structs.h | 20 +++++---------------
 2 files changed, 13 insertions(+), 19 deletions(-)

(limited to 'inc')

diff --git a/inc/cub3d.h b/inc/cub3d.h
index f0dbf61..81692e4 100644
--- a/inc/cub3d.h
+++ b/inc/cub3d.h
@@ -39,6 +39,9 @@
 #	ifndef FT_ESC_KEY
 #	define FT_ESC_KEY 53
 #	endif
+#	ifndef FT_F1_KEY
+#	define FT_F1_KEY 122
+#	endif
 #	ifndef FT_SCR_SIZE
 #	define FT_SCR_SIZE "1920x1080"
 #	endif
@@ -59,7 +62,7 @@ void				ft_hooks_and_loops(t_win *wl, t_cub *cl);
 int					ft_key_event(int keycode, t_cub *clist);
 int					ft_click_close(int keycode, t_cub *clist);
 int					ft_exit(uint8_t exit_code, t_cub *clist);
-void				ft_drawsquare(int a, int b, int rgb, t_cub *clist);
+void				ft_draw_square(int a, int b, int rgb, t_cub *clist);
 void				ft_parse_map(const char *map_path, t_cub *clist);
 int8_t				ft_select_get(char **words, t_cub *clist);
 int8_t				ft_get_screen_size(t_win *wlist);
@@ -79,10 +82,9 @@ int					ft_check_missing(t_cub *clist);
 int8_t				ft_check_map_line(char *line, uint8_t l, t_cub *clist);
 size_t				ft_get_line_len(char *line);
 int					ft_missing_error(const char *err, t_cub *clist);
-uint8_t				ft_free_words(char **words);
-int					ft_map_error(t_cub *clist);
+uint8_t				ft_free_words(char **words); int					ft_map_error(t_cub *clist);
 int					ft_init_winlx(t_cub *clist);
-void				ft_drawmap(t_cub *clist);
+void				ft_draw_scene(t_cub *clist);
 void				ft_print_list(t_cub *clist);
 uint32_t			ft_rgb_to_hex(t_rgb rgb);
 t_ray				ft_init_s_ray(void);
@@ -90,5 +92,7 @@ void				ft_detect(t_cub *cl);
 int8_t				ft_draw_verline(t_cub *cl, int32_t x, int32_t y1,
 									int32_t y2, int32_t color);
 void				ft_castray(t_cub *cl);
+void				ft_draw_map(char **map, t_cub *clist);
+int8_t				ft_f1_key(t_cub *clist);
 
 #	endif
diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h
index 0c3cb7c..f40a438 100644
--- a/inc/cub3d_structs.h
+++ b/inc/cub3d_structs.h
@@ -48,21 +48,6 @@ typedef struct		s_player
 	float			plane_y;
 }					t_player;
 
-/* typedef struct		s_ray */
-/* { */
-/* 	double			x_ray_position; */
-/* 	double			y_ray_position; */
-/* 	double			x_ray_direction; */
-/* 	double			y_ray_direction; */
-/* 	double			x_side_distance; */
-/* 	double			y_side_distance; */
-/* 	double			x_delta_distance; */
-/* 	double			y_delta_distance; */
-/* 	int				hitX; */
-/* 	int				hitY; */
-/* 	int				hits[150]; */
-/* }					t_ray; */
-
 typedef struct		s_ray
 {
 	uint16_t		line_h;
@@ -83,6 +68,10 @@ typedef struct		s_ray
 	uint8_t			hit;
 }					t_ray;
 
+/* typedef struct		s_map */
+/* { */
+/* }					t_map; */
+
 typedef struct		s_cub
 {
 	char			*no_tex_path;
@@ -100,6 +89,7 @@ typedef struct		s_cub
 	size_t			map_start;
 	uint8_t			isspawn;
 	uint8_t			scale;
+	uint8_t			minimap;
 	struct s_win	*wlist;
 	struct s_player	*plist;
 	struct s_ray	rlist;
-- 
cgit v1.2.3