/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* write.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/07/31 23:11:14 by axdubois #+# #+# */ /* Updated: 2023/08/02 20:34:57 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ #include "../../includes/Display-h/write.h" #include "../../includes/utils-h/utils.h" #include "../../includes/algo-h/algo.h" #include "../../includes/utils-h/charobj.h" #include "../../includes/utils-h/fst_line.h" #include "../../includes/utils-h/utils.h" void ft_putchar(char c) { write(1, &c, 1); } void ft_print(char *str) { int i; i = 0; while (str[i]) { ft_putchar(str[i]); i++; } } void ft_print_linesq(int side,char x) { int i; i = 0; while(i < side) { ft_putchar(x); i++; } } void ft_print_result(t_square sq,t_charobj c,t_coords *listobj,int file) { int x; int y; int ysq; y = 1; ysq = 0; while (y < ft_len_colum(file)) { x = 0; while (x < ft_len_line(file, y)) { if ((listobj[x].x == x) && (listobj[y].y == y)) ft_putchar(c.o); else if ((sq.x == x) && (ysq < sq.side)) { ft_print_linesq(sq.side,c.x); x += sq.side -1; ysq++; } else ft_putchar(c.n); x++; } ft_putchar('\n'); y++; } }