diff --git a/fillit.c b/fillit.c index b75598a..29601f5 100644 --- a/fillit.c +++ b/fillit.c @@ -1,4 +1,6 @@ #include "fillit.h" +#include +#include unsigned int ft_sqrt_ceil(unsigned int num) { @@ -22,8 +24,28 @@ void clear_map(t_map *map) t_tetraminos *convert_tetramino(char *s) { t_tetraminos *res; + uint16_t temp; + int i; + int y; res = (t_tetraminos*)malloc(sizeof(t_tetraminos)); + res->offset_y = 0; + i = 0; + y = 1; + while (i < 16) + { + temp = 0; + while (i < y * 4) + { + temp = temp << 1; + if (s[i++] == '#') + temp = temp | 0x01; + + } + temp = temp << 12; + res->line[y - 1] = temp; + y++; + } return (res); }