aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-02-04 20:17:21 +0100
committerRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-02-04 20:17:21 +0100
commitd74aa337b4260840afd8e6b1ab99acc29dc0e9d9 (patch)
tree62f0367ee063850f94f9fe62a8a8ba911ed5d89c
parentuseless change (diff)
download42-cub3d-d74aa337b4260840afd8e6b1ab99acc29dc0e9d9.tar.gz
42-cub3d-d74aa337b4260840afd8e6b1ab99acc29dc0e9d9.tar.bz2
42-cub3d-d74aa337b4260840afd8e6b1ab99acc29dc0e9d9.tar.xz
42-cub3d-d74aa337b4260840afd8e6b1ab99acc29dc0e9d9.tar.zst
42-cub3d-d74aa337b4260840afd8e6b1ab99acc29dc0e9d9.zip
new func
Diffstat (limited to '')
-rw-r--r--Makefile1
-rw-r--r--inc/cub3d.h19
-rw-r--r--src/ft_rgb_to_hex.c11
3 files changed, 31 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 9ba60e9..7f4eee6 100644
--- a/Makefile
+++ b/Makefile
@@ -36,6 +36,7 @@ SRCS_NAME += ft_map_error.c
SRCS_NAME += ft_init_winlx.c
SRCS_NAME += ft_drawmap.c
SRCS_NAME += ft_print_list.c
+SRCS_NAME += ft_rgb_to_hex.c
#------------------------------------------------------------------------------#
SRCS = $(addprefix ${SRCS_DIR},${SRCS_NAME})
#------------------------------------------------------------------------------#
diff --git a/inc/cub3d.h b/inc/cub3d.h
index 6dcd67b..b9256e9 100644
--- a/inc/cub3d.h
+++ b/inc/cub3d.h
@@ -42,6 +42,22 @@ typedef struct s_win
int16_t y_size;
} t_win;
+typedef struct s_img
+{
+ void *img;
+ char *ptr;
+ int bpp;
+ int sizeline;
+ int endian;
+} t_img;
+
+typedef struct s_rgb
+{
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+} t_rgb;
+
/*
** view_side:
** 1: North
@@ -74,6 +90,8 @@ typedef struct s_cub
uint8_t isspawn;
struct s_win *wlist;
struct s_player *plist;
+ struct s_img img;
+ struct s_rgb rgb;
} t_cub;
t_win *ft_init_win(void);
@@ -103,5 +121,6 @@ int ft_map_error(t_cub *clist);
int ft_init_winlx(t_cub *clist);
void ft_drawmap(t_cub *clist);
void ft_print_list(t_cub *clist);
+int ft_rgb_to_hex(t_rgb rgb);
# endif
diff --git a/src/ft_rgb_to_hex.c b/src/ft_rgb_to_hex.c
new file mode 100644
index 0000000..525296d
--- /dev/null
+++ b/src/ft_rgb_to_hex.c
@@ -0,0 +1,11 @@
+#include <cub3d.h>
+
+int
+ ft_rgb_to_hex(t_rgb rgb)
+{
+ int res;
+
+ res = 0;
+ res += ((rgb.r << 16) + (rgb.g << 8) + rgb.b);
+ return (res);
+}