-
Notifications
You must be signed in to change notification settings - Fork 0
/
GoToXY.cpp
37 lines (33 loc) · 938 Bytes
/
GoToXY.cpp
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
/***************************************
Credit for finding this code goes to:
Yoav Aharoni
***************************************/
#include "Config.h"
// function definition -- requires windows.h
void gotoxy(int x, int y)
{
HANDLE hConsoleOutput;
COORD dwCursorPosition;
cout.flush();
dwCursorPosition.X = x;
dwCursorPosition.Y = y;
hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hConsoleOutput, dwCursorPosition);
}
// function definition -- requires process.h
void clrscr()
{
system("cls");
}
void setTextColor(Color colorToSet){
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), (int)colorToSet);
}
void hideCursor()
{
HANDLE myconsole = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO CURSOR;
CURSOR.dwSize = 1;
CURSOR.bVisible = FALSE;
SetConsoleCursorInfo(myconsole, &CURSOR);//second argument need pointer
}