-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconsole.h
More file actions
39 lines (34 loc) · 913 Bytes
/
console.h
File metadata and controls
39 lines (34 loc) · 913 Bytes
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
//class to do simple console functions that are different from the ANSI C++ version. I found tht gotoxy n textcolor etc doesn't work so...
class console
{
public:
void static gotoxy (int x, int y)
{
COORD coord;
coord.X = x; coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
int static getcursorx()
{
CONSOLE_SCREEN_BUFFER_INFO scrinfo;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE),&scrinfo);
return scrinfo.dwCursorPosition.X;
}
int static getcursory()
{
CONSOLE_SCREEN_BUFFER_INFO scrinfo;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE),&scrinfo);
return scrinfo.dwCursorPosition.Y;
}
void static textcolor(SHORT color)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color);
}
void static drawHline(int startxcoord, int endxcoord)
{
for (int i=startxcoord;i<=endxcoord;i++)
{
cout<<"-";
}
}
};