-
Notifications
You must be signed in to change notification settings - Fork 0
/
Display.c
127 lines (108 loc) · 2.07 KB
/
Display.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
//
// Created by Soltani and Moucer 1CPG07 on 15/04/2023.
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <windows.h>
#include <ctype.h>
#include <conio.h>
//_____________________________________________________________________________________________________________________
/* Start Color Functions */
void Black ()
{
printf("\033[1;30m");
}
void Red ()
{
printf("\033[1;31m");
}
void Green ()
{
printf("\033[1;32m");
}
void Yellow ()
{
printf("\033[1;33m");
}
void Blue ()
{
printf("\033[1;34m");
}
void Purple ()
{
printf("\033[1;35m");
}
void Cyan ()
{
printf("\033[1;36m");
}
void Reset ()
{
printf("\033[0m");
}
void Set_Color_Console ()
{
system("color 0f");
}
void Set_Width_Console ()
{
system("mode con cols=120");
}
/* End Color Functions */
//_____________________________________________________________________________________________________________________
/* Start Some output functions */
/* This function goes up with the cursor n times */
void Go_up ( int times )
{
for ( int i = 0 ; i<times ; i++ )
{
printf("\033[A");
}
}
/* This functions goes up with the cursor and clears the line */
void Go_up_Clear_line ( int times )
{
for ( int i = 0 ; i<times ; i++ )
{
printf("\033[A");
printf("\033[2K");
}
}
/* Thid function clears the current line */
void Clear_line ()
{
printf("\033[2K");
}
/* This functions clears the screen */
void Clear_Screen()
{
system("cls||clear");
}
void Animate_str ( char* string , int time )
{
/*
This function animates a string :
- if time = 0 it uses the default sleeping timer value
- if time has a value other than 0 it uses that value as sleeping timer value
*/
int num;
if ( time == 0 )
{
num = 30000;
}
else
{
num = time;
}
for ( int i = 0 ; i<=strlen(string) ; i++ )
{
printf("%c",string[i]);
usleep(num);
}
}
/* End Some output functions */
//
// Created by Soltani and Moucer 1CPG07 on 15/04/2023.
//