-
Notifications
You must be signed in to change notification settings - Fork 4
/
global.c
36 lines (35 loc) · 1005 Bytes
/
global.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
#include "global.h"
#include "rterm.h"
#include "time.h"
int _animation(void)
{
time_t mytime = time(NULL);
char *time_str = ctime(&mytime);
//Write char to screen raw to make title animation
resetAnsi(0);
get_terminal_dimensions(&new_rows, &new_columns);
centerX = ((new_columns) / 2) - (strlen(titlemsg) / 2);
gotoxy(centerX + 1, 1);
outputcolor(F_WHITE, B_BLACK);
printf("%s\n", titlemsg); //unicode
gotoxy(centerX + animation + 1, 1);
outputcolor(FH_WHITE, B_YELLOW);
printf("%c\n", titlemsg[animation]); //unicode
animation++;
time_str[strlen(time_str) - 1] = '\0';
//display system time
resetAnsi(0);
if (screen1 != NULL)
write_str(screen1, 12, 2, time_str, F_BLACK, B_WHITE, 1);
if (animation == strlen(titlemsg)) {
animation = 0;
gotoxy(centerX + 1, 1);
outputcolor(FH_WHITE, B_CYAN);
//printf("%s\n", titlemsg); //unicode
}
//return a signal if screen size changes
if (new_rows != old_rows || new_columns != old_columns)
return -1;
else
return 0;
}