-
Notifications
You must be signed in to change notification settings - Fork 2
/
cful.c
107 lines (91 loc) · 2.08 KB
/
cful.c
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#include <stdio.h>
#include "cful.h"
#ifdef _WIN32
#include <windows.h>
#define SLEEP(x) sleep(x)
void gotoxy(int x,int y)
{
COORD pos={x,y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
void cursor_view(unsigned char show)
{
HANDLE hConsole;
CONSOLE_CURSOR_INFO ConsoleCursor;
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
ConsoleCursor.bVisible = show;
ConsoleCursor.dwSize = 1;
SetConsoleCursorInfo(hConsole , &ConsoleCursor);
}
#else
#include <unistd.h>
#define SLEEP(x) usleep(x * 1000)
void gotoxy(int x, int y)
{
printf("\033[%d;%df",y,x);
}
void cursor_view(unsigned char show)
{
if ( show ) {
printf("\e[?25h");
} else {
printf("\e[?25l");
}
}
#endif
#define clear() printf("\033[H\033[J")
void print_cful( void )
{
gotoxy(0, 0);
printf(" ██████╗███████╗██╗ ██╗██╗ \n");
printf("██╔════╝██╔════╝██║ ██║██║ \n");
printf("██║ █████╗ ██║ ██║██║ \n");
printf("██║ ██╔══╝ ██║ ██║██║ \n");
printf("╚██████╗██║ ╚██████╔╝███████╗\n");
printf(RESET);
}
void one_time_print( int r, int g, int b )
{
SET_FG_COLOR(r, g, b);
print_cful();
SLEEP(2);
}
int main ( void )
{
int r = 255, g = 100, b = 100;
cursor_view(0);
clear();
do {
while ( g < 255 ) {
one_time_print(r, g, b);
if ( g < 255 ) g++;
}
one_time_print(r, g, b);
while ( r > 100 ) {
one_time_print(r, g, b);
if ( r > 100 ) r--;
}
one_time_print(r, g, b);
while ( b < 255 ) {
one_time_print(r, g, b);
if ( b < 255 ) b++;
}
one_time_print(r, g, b);
while ( g > 100 ) {
one_time_print(r, g, b);
if ( g > 100 ) g--;
}
one_time_print(r, g, b);
while ( r < 255 ) {
one_time_print(r, g, b);
if ( r < 255 ) r++;
}
one_time_print(r, g, b);
while ( b > 100 ) {
one_time_print(r, g, b);
if ( b > 100 ) b--;
}
one_time_print(r, g, b);
} while ( 1 );
return 0;
}