forked from LordLaffey/MuseDashLightPlay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheader.cpp
70 lines (61 loc) · 1.4 KB
/
header.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
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
/**
* @details Basical function
*/
#ifndef _MDLP_HEADER
#define _MDLP_HEADER
#include <atomic>
#include <conio.h>
#include <cstring>
#include <iostream>
#include <io.h>
#include <map>
#include <set>
#include <string>
#include <thread>
#include <vector>
#include <windows.h>
#include <winspool.h>
using namespace std;
const int OneSecond = 1000;
char lower(char c)
{
return (c>=65 and c<=90) ? c+32 : c;
}
void Print(string s,int times)
{
for(auto v:s)
{
cout<<v;
if(_kbhit())
{
char c=_getch();
times = INT_MAX;
}
Sleep(OneSecond/times);
}
}
char WaitForInput()
{
char ch = 0;
while(true)
{
if(!_kbhit()) continue;
else { ch = _getch();break; }
}
return ch;
}
void ClearScreen()
{
COORD coordScreen = {0, 0};
DWORD cCharsWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;
DWORD dwConSize;
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfo(hConsole, &csbi);
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize, coordScreen, &cCharsWritten);
GetConsoleScreenBufferInfo(hConsole, &csbi);
FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
SetConsoleCursorPosition(hConsole, coordScreen);
}
#endif // _MDLP_HEADER