summaryrefslogtreecommitdiff
path: root/test.c
blob: d3a75e6ed087828b141916e04c424259f2ce4541 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

#include <stdlib.h>
#include <stdio.h>
#include <curses.h>
#include <unistd.h>

#define ms 20000

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);
	for (int f = 0; f <= 9; f++){

	attron(COLOR_PAIR(1));
	for (int i = 1; i <= (19 - (f * 2)); i++) {
		move(1 + f, ((11 + f) + i));
		addch('X');
		refresh();
		usleep(ms);
	}
	attron(COLOR_PAIR(2));
	for (int i = 1; i <= (19 - (f * 2) ); i++) {
		move((f + i),(30 -f));
		addch('X');
		refresh();
		usleep(ms);

	}
	attron(COLOR_PAIR(3));
	for (int i = 1; i <= (20 - (f * 2)); i++) {
		move((20 - f), (31 - (i+f)));
		addch('X');
		refresh();
		usleep(ms);

	}
	attron(COLOR_PAIR(4));
	for (int i = 1; i <= (19 - (f * 2)) ; i++) {
		move((20 - (i + f)), (11 + f));
		addch('X');
		refresh();
		usleep(ms);

	}
	}

	refresh();
	getch();
	delwin(mainwin);
	endwin();
	refresh();;
}