-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconsole.cpp
More file actions
88 lines (77 loc) · 1.7 KB
/
console.cpp
File metadata and controls
88 lines (77 loc) · 1.7 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
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
#include "console.h"
void gotoxy(int x, int y)
{
HANDLE hout;
COORD Cur;
hout = GetStdHandle(STD_OUTPUT_HANDLE);
Cur.X = x;
Cur.Y = y;
SetConsoleCursorPosition(hout, Cur);
}
void setcolor(int color, int bgcolor)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), (bgcolor << 4) | color);
}
void hideCursor()
{
CONSOLE_CURSOR_INFO cursorInfo = { 0, };
cursorInfo.dwSize = 1;
cursorInfo.bVisible = FALSE;
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursorInfo);
}
int GetRandom(int min, int max)
{
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<int> dis(min, max);
return dis(gen);
}
POINT intToPoint(int x, int y)
{
return POINT{ x, y };
}
bool IsPOINTEqual(const POINT p1, const POINT p2)
{
if (p1.x == p2.x && p1.y == p2.y)
{
return true;
}
else
{
return false;
}
perror("Have problem");
return false;
}
int wherex(void)
{
CONSOLE_SCREEN_BUFFER_INFO info;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info);
return info.dwCursorPosition.X;
}
void fullscreen()
{
SetConsoleDisplayMode(GetStdHandle(STD_OUTPUT_HANDLE), CONSOLE_FULLSCREEN_MODE, 0);
}
void LetterIntegrate(char& letter)
{
if (letter >= 'a' && letter <= 'z')
{
letter = letter - 32;
}
}
/*
HWND console = GetConsoleWindow();
SetWindowLong(console, GWL_STYLE, GetWinsowLong(console, GWL_STYLE) & WS_MAXMIZEBOX & WS_SIZEBOX)
대충 이거 쓰면 못건들임 콘솔창의 크기를 변경하는 것을
---------------------------------------------------------------------------------------------------
RECT rect;
GetWindowRect(console, &rect);
while(true)
{
BOOL result = gotoxy(x,y);
if(result == FALSE)
continue;
그냥 이거 벗어났을때 이동하는 코드 작동 시키지 않는 것
}
*/