aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-02-04 20:27:37 +0100
committerRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-02-04 20:27:37 +0100
commit72c24e8e0985b375c572e98446b1dd9fe49464cc (patch)
tree9c3b57358466fbd720cdf5116b92371cf6b57b2d
parentnew func (diff)
download42-cub3d-72c24e8e0985b375c572e98446b1dd9fe49464cc.tar.gz
42-cub3d-72c24e8e0985b375c572e98446b1dd9fe49464cc.tar.bz2
42-cub3d-72c24e8e0985b375c572e98446b1dd9fe49464cc.tar.xz
42-cub3d-72c24e8e0985b375c572e98446b1dd9fe49464cc.tar.zst
42-cub3d-72c24e8e0985b375c572e98446b1dd9fe49464cc.zip
Ok colors
-rw-r--r--inc/cub3d.h3
-rw-r--r--map/map_one.cub2
-rw-r--r--src/ft_drawmap.c2
-rw-r--r--src/ft_get_colors.c8
4 files changed, 12 insertions, 3 deletions
diff --git a/inc/cub3d.h b/inc/cub3d.h
index b9256e9..ce4c658 100644
--- a/inc/cub3d.h
+++ b/inc/cub3d.h
@@ -91,7 +91,8 @@ typedef struct s_cub
struct s_win *wlist;
struct s_player *plist;
struct s_img img;
- struct s_rgb rgb;
+ struct s_rgb f_rgb;
+ struct s_rgb c_rgb;
} t_cub;
t_win *ft_init_win(void);
diff --git a/map/map_one.cub b/map/map_one.cub
index 1a7ecc4..d5b931a 100644
--- a/map/map_one.cub
+++ b/map/map_one.cub
@@ -8,7 +8,7 @@ WE ./path_to_the_west_texture
S ./path_to_the_sprite_texture
-F 220,100,0
+F 100,123,213
C 225,30,0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
diff --git a/src/ft_drawmap.c b/src/ft_drawmap.c
index d5c545a..0380f2d 100644
--- a/src/ft_drawmap.c
+++ b/src/ft_drawmap.c
@@ -35,7 +35,7 @@ static void
0x0033ccff, clist);
else
ft_drawsquare(40 + (x * 41), 40 + (y * 41),
- clist->f_color, clist);
+ ft_rgb_to_hex(clist->f_rgb), clist);
x++;
}
x = 0;
diff --git a/src/ft_get_colors.c b/src/ft_get_colors.c
index 7d7907a..7d9d5d2 100644
--- a/src/ft_get_colors.c
+++ b/src/ft_get_colors.c
@@ -50,6 +50,10 @@ int
clist->f_color += ft_atoi(num[1]);
clist->f_color *= 1000;
clist->f_color += ft_atoi(num[2]);
+
+ clist->f_rgb.r = ft_atoi(num[0]);
+ clist->f_rgb.g = ft_atoi(num[1]);
+ clist->f_rgb.b = ft_atoi(num[2]);
ft_free_words(num);
return (0);
}
@@ -76,6 +80,10 @@ int
clist->c_color += ft_atoi(num[1]);
clist->c_color *= 1000;
clist->c_color += ft_atoi(num[2]);
+
+ clist->c_rgb.r = ft_atoi(num[0]);
+ clist->c_rgb.g = ft_atoi(num[1]);
+ clist->c_rgb.b = ft_atoi(num[2]);
ft_free_words(num);
return (0);
}