fillit/inc/fillit.h

76 lines
2.2 KiB
C
Raw Normal View History

2016-12-14 20:00:58 +02:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fillit.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/14 16:42:06 by gtertysh #+# #+# */
/* Updated: 2016/12/14 16:45:34 by gtertysh ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FILLIT_H
# define FILLIT_H
#include "libft.h"
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <stdio.h> // warning!
# define BUF_S 8192
typedef struct s_tetrominoes
{
uint16_t line[16];
int offset_y;
2016-12-14 20:20:59 +02:00
int height;
2016-12-14 20:00:58 +02:00
} t_tetrominoes;
typedef struct s_map
{
uint16_t line[16];
unsigned int size;
t_tetrominoes *figure[26];
unsigned int figure_amount;
} t_map;
typedef struct s_tetrominoes_templates
{
char figure[17];
} t_tetrominoes_templates;
2016-12-14 20:20:59 +02:00
void convert_tetramino(char *s, t_map *map, int index);
void map_initialization(char **tetramino_table, t_map *map);
2016-12-14 20:00:58 +02:00
// reads from file
char *read_file(char *path);
// convert string to table by spliting by '\n'
char **to_table(char **string);
// print table returned by to_table()
void print_table(char **table);
// creates new table where each string represent whole figrure
char **glue_figure(char **table);
// move tetromino in top left corner
void move_up_left(char **table);
// print table returned by glue_figure()
void print_one_string(char **glued);
// compare 19 templates with each tetromino in *ttr table
void test_check(char **ttr, char **tamplates);
2016-12-14 20:00:58 +02:00
// change hashes ('#') with letters
// obsolete, rewrite for structs array
void to_letters(char **ttr);
// проверка считаной строки
int check_raw_string(char *raw_string);
2016-12-14 20:00:58 +02:00
#endif