-
Notifications
You must be signed in to change notification settings - Fork 0
/
outils.cpp
36 lines (29 loc) · 833 Bytes
/
outils.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
#include "outils.h"
#include <windows.h>
void gotoxy(int posX, int posY)
{
static HANDLE h = NULL;
if(!h)
h = GetStdHandle(STD_OUTPUT_HANDLE);
COORD c = {posX, posY};
SetConsoleCursorPosition(h,c);
}
void ShowCursor(bool show)
{
HANDLE hConsoleOutput;
CONSOLE_CURSOR_INFO structCursorInfo;
hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE );
GetConsoleCursorInfo(hConsoleOutput, &structCursorInfo);
structCursorInfo.bVisible = show;
SetConsoleCursorInfo(hConsoleOutput, &structCursorInfo);
}
void textcolor(int color)
{
CONSOLE_SCREEN_BUFFER_INFO Info ;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &Info) ;
textattr((Info.wAttributes & 0xF0) | color);
}
void textattr(int attr)
{
SetConsoleTextAttribute (GetStdHandle(STD_OUTPUT_HANDLE), attr);
}