-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShared.cpp
More file actions
108 lines (102 loc) · 3.15 KB
/
Copy pathShared.cpp
File metadata and controls
108 lines (102 loc) · 3.15 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// ********************************************************************************
/// <summary>
///
/// </summary>
/// <created>ʆϒʅ,13.10.2018</created>
/// <changed>ʆϒʅ,13.10.2019</changed>
// ********************************************************************************
#include "Packers.h"
#include "Shared.h"
#include "Console.h"
Inserter::Inserter ()
{
consoleOutput = GetStdHandle ( STD_OUTPUT_HANDLE );
screenBinfoEX = {};
};
void Inserter::colourInserter ( const COORD& pos )
{
lastInsertStartPosition = pos;
SetConsoleCursorPosition ( consoleOutput, pos );
};
void Inserter::colourInserter ( const std::string& str, const WORD& colour )
{
GetConsoleScreenBufferInfoEx ( consoleOutput, &screenBinfoEX );
SetConsoleTextAttribute ( consoleOutput, colour );
std::cout << str;
};
void Inserter::colourInserter ( const std::string& str, const COORD& pos )
{
lastInsertStartPosition = pos;
GetConsoleScreenBufferInfoEx ( consoleOutput, &screenBinfoEX );
SetConsoleCursorPosition ( consoleOutput, pos );
std::cout << str;
};
void Inserter::colourInserter ( const std::string& str, const WORD& colour, const COORD& pos )
{
lastInsertStartPosition = pos;
GetConsoleScreenBufferInfoEx ( consoleOutput, &screenBinfoEX );
SetConsoleCursorPosition ( consoleOutput, pos );
SetConsoleTextAttribute ( consoleOutput, colour );
std::cout << str;
};
void Inserter::clear ()
{
COORD temp { 0,0 };
COORD zero { 0,0 };
std::string strTemp { "" };
for ( unsigned char i = 0; i < SCREEN_W; i++ )
{
strTemp += " ";
}
colourInserter ( strTemp, temp );
for ( unsigned char i = 0; i < SCREEN_H; i++ )
std::cout << strTemp;
colourInserter ( zero );
}
COORD Inserter::lastInsertStartPosition { 0,0 };
Loading::Loading ( const unsigned char& mode )
{
// set
std::string str { "LOADING# " };
unsigned char i { 0 };
for ( char element : str )
{
characters [i] = element;
++i;
}
copywrite = u8" ©: ʆϒʅ"; // usable in true type fonts
copywrite = u8" ©: }Y{";
colourOne = B_bBLUE | F_bWHITE;
colourTwo = B_BLACK | F_bGREEN;
colourThree = B_BLACK | F_bWHITE;
startPoint = { SCREEN_W - 13, SCREEN_H - 3 };
speed = mode;
// cout
inserter ();
//std::thread tOne ( inserter );
//tOne.join ();
};
void Loading::inserter ()
{
COORD position { startPoint };
for ( unsigned char i = 0; i < 7; i++ )
{
colourInserter ( characters [i], colourOne, position );
std::this_thread::sleep_for ( std::chrono::milliseconds ( 100 * speed ) );
position.X += 1;
}
for ( unsigned char i = 1; i <= 3; i++ )
{
colourInserter ( characters [7], colourTwo, position );
std::this_thread::sleep_for ( std::chrono::milliseconds ( 150 * speed ) );
colourInserter ( characters [8], colourTwo, position );
std::this_thread::sleep_for ( std::chrono::milliseconds ( 200 * speed ) );
}
std::this_thread::sleep_for ( std::chrono::milliseconds ( 200 * speed ) );
colourInserter ( copywrite, colourThree, startPoint );
};
void Loading::setter ( const unsigned char& mode )
{
speed = mode;
inserter ();
};