/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* rush00.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: jtorrez- +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/03/18 20:15:12 by jtorrez- #+# #+# */ /* Updated: 2023/03/19 02:05:20 by tischmid ### ########.fr */ /* */ /* ************************************************************************** */ #include "include/ft_putchar.h" #include "include/ft_lib.h" #include "include/rush0X.h" const char g_inside = ' '; // corners specified clockwise, starting from top left const char g_corners[] = {'o', 'o', 'o', 'o', '\0'}; const char g_horizontal = '-'; const char g_vertical = '|'; void rush(int x, int y) { int i; i = 0; if (x * y == 0) return ; horiz_line(g_corners[0], g_horizontal, g_corners[1], x); while (i++ < y - 2) horiz_line(g_vertical, g_inside, g_vertical, x); if (y > 1) horiz_line(g_corners[3], g_horizontal, g_corners[2], x); } void horiz_line(char left, char middle, char right, int width) { int i; i = 0; ft_putchar(left); while (i++ < width - 2) ft_putchar(middle); if (width > 1) ft_putchar(right); ft_putchar('\n'); }