Created
February 25, 2023 00:16
-
-
Save webgtx/44a3ad41ae4095c53d724c75fb43c1ec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <sys/ioctl.h> | |
| #include <unistd.h> | |
| #include <time.h> | |
| int main() { | |
| struct winsize w; | |
| ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); | |
| printf("lines: %i\ncolumns: %i\n", w.ws_row, w.ws_col); | |
| char props[] = "/#0"; | |
| void draw_line(char ch_prop) { | |
| for (unsigned idx = 0; idx < w.ws_col; idx++) { | |
| if (idx < w.ws_col / 4) | |
| putchar(' '); | |
| if (idx > w.ws_col / 2) | |
| putchar(ch_prop); | |
| } | |
| putchar('\n'); | |
| } | |
| void texture_flow(char *props_arr) { | |
| while (1) { | |
| sleep(1); | |
| char prop = *props_arr; | |
| putchar(prop); | |
| // prop++; | |
| // if (prop == '\0') | |
| // prop--; | |
| for (unsigned idx = 0; idx < w.ws_row; idx++) { | |
| if (idx < w.ws_row / 2) | |
| putchar('\n'); | |
| if (idx > w.ws_row / 2) | |
| draw_line(prop); | |
| } | |
| } | |
| } | |
| texture_flow(props); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment