Skip to content

Commit

Permalink
Fix colors
Browse files Browse the repository at this point in the history
  • Loading branch information
Yesim Zaim committed Mar 6, 2024
1 parent bfc6b69 commit 5686045
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions include/meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: joppe <[email protected]> +#+ */
/* +#+ */
/* Created: 2024/02/05 14:01:44 by joppe #+# #+# */
/* Updated: 2024/03/06 14:25:06 by yzaim ######## odam.nl */
/* Updated: 2024/03/06 15:02:35 by yzaim ######## odam.nl */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -110,10 +110,10 @@ typedef union s_rgba
uint32_t value;
struct
{
uint8_t a;
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t a;
};
} t_rgba;

Expand Down
6 changes: 3 additions & 3 deletions src/parser/check_colors.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: yzaim <[email protected]> +#+ */
/* +#+ */
/* Created: 2024/01/08 15:30:18 by yzaim #+# #+# */
/* Updated: 2024/03/06 14:25:01 by yzaim ######## odam.nl */
/* Updated: 2024/03/06 15:02:27 by yzaim ######## odam.nl */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -55,15 +55,15 @@ bool get_colour_value(char *content, t_rgba *col)
arr = ft_split(content, ',');
i = 0;
ptr = (uint8_t *) col;
ptr[0] = 255;
while (i < 3)
{
tmp = ft_atoi(arr[i]);
if (tmp < 0 || tmp > 255)
return (free_2d_array(arr), false);
ptr[i + 1] = tmp;
ptr[i] = tmp;
i++;
}
ptr[i] = 255;
free_2d_array(arr);
return (true);
}
5 changes: 3 additions & 2 deletions test_maps/subject.cub
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ NO texture_examples/redbrick.png
WE texture_examples/purplestone.png
EA texture_examples/purplestone.png
SO texture_examples/redbrick.png
F 220,100,0
C 225,30,0
C 0,0,255
C_ALT 0,255,0
F 255,0,0

1111111111111111111111111
1000000000110000000000001
Expand Down

0 comments on commit 5686045

Please sign in to comment.