From b03b61b232c1fa0b9ff1ae607232f8ab3f55ea38 Mon Sep 17 00:00:00 2001 From: b4rkod Date: Wed, 17 Jan 2024 21:17:07 +0300 Subject: AAAA --- odev_6_better.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 odev_6_better.c (limited to 'odev_6_better.c') diff --git a/odev_6_better.c b/odev_6_better.c new file mode 100644 index 0000000..7369eac --- /dev/null +++ b/odev_6_better.c @@ -0,0 +1,63 @@ + +#include +#include +#include +#include + +#define ms 50000 + +int main(void) +{ + WINDOW * mainwin; + + if ( (mainwin = initscr()) == NULL ) { + fprintf(stderr, "Error initialising ncurses.\n"); + exit(EXIT_FAILURE); + } + + + start_color(); + init_pair(1, COLOR_GREEN, COLOR_BLACK); + init_pair(2, COLOR_CYAN, COLOR_BLACK); + init_pair(3, COLOR_RED, COLOR_BLACK); + init_pair(4, COLOR_YELLOW, COLOR_BLACK); + attron(COLOR_PAIR(1)); + move(1, 10); + for (int i = 1; i <= 39; i += 2) { + move(1, (11 + i)); + addch('*'); + refresh(); + usleep(ms); + } + attron(COLOR_PAIR(2)); + for (int i = 1; i <= 19; i++) { + move((1 + i),50); + addch('*'); + refresh(); + usleep(ms); + + } + attron(COLOR_PAIR(3)); + for (int i = 1; i <= 39; i += 2) { + move(20, (50 - i)); + addch('*'); + refresh(); + usleep(ms); + + } + attron(COLOR_PAIR(4)); + for (int i = 1; i <= 19; i++) { + move((20 - i), 11); + addch('*'); + refresh(); + usleep(ms); + + } + + refresh(); + getch(); + delwin(mainwin); + endwin(); + refresh();; +} + -- cgit v1.2.3