-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.cpp
More file actions
55 lines (51 loc) · 1.22 KB
/
Copy pathutils.cpp
File metadata and controls
55 lines (51 loc) · 1.22 KB
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
#include "header/utils.hpp"
#include <iostream>
#include <ctime>
// check if screen size is correct to play the game; 110x40
void checkScreen(int screenCols, int screenLines)
{
while ((screenCols < MIN_COLS) || (screenLines < MIN_LINES))
{
refresh();
move(0, 0);
printw("Resize your screen...");
move(1, 0);
mvprintw(0, 0, "Minimum screen size is %dx%d", MIN_LINES, MIN_COLS);
getmaxyx(stdscr, screenCols, screenLines);
}
}
// check if color is supported by user's terminal
void checkColors()
{
if (has_colors() == FALSE)
{
endwin();
std::cout << "Your terminal does not support color\n";
exit(1);
}
}
// clear the screen with " " in int delay seconds
void clearScreen(int y, int x, int length, WINDOW *win, int delay)
{
if (delay > 0)
{
delay *= CLOCKS_PER_SEC;
clock_t now = clock();
while (clock() - now < delay)
{
for (int i = length; i != 0; i--)
{
mvprintw(y, x + i - 1, " ");
}
}
}
else
{
for (int i = length; i != 0; i--)
{
mvprintw(y, x + i - 1, " ");
}
}
refresh();
wrefresh(win);
}