convert function is done
This commit is contained in:
parent
01c3cb94d2
commit
e6f030c38a
1 changed files with 22 additions and 0 deletions
22
fillit.c
22
fillit.c
|
@ -1,4 +1,6 @@
|
|||
#include "fillit.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue