-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCONFunctions.h
More file actions
198 lines (190 loc) · 4.31 KB
/
CONFunctions.h
File metadata and controls
198 lines (190 loc) · 4.31 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#define _WIN32_WINNT 0x0500
#include <iostream>
#include <windows.h>
#include <string>
#include <fstream>
#include <thread>
#include <chrono>
#include <conio.h>
#include <stdlib.h>
using namespace std;
class Functions
{
public:
string playerName, input, tb, decision1, decision1sub1, decision2 = "";
int a = 0, b = 0, sequence, level, xp, requiredxp, initiallvl, hp, currenthp, maxdmg, plvlbonusdmg;
bool isAlive = true;
const string mc = "\033[33m", vc = "\033[36m";
void clearLine() {
cout << "\r \r";
}
void narrator(const string& text, int tickspeed) {
bool a = false;
tb="<< ";
tb+=text;
for (char c : text) {
if (!a) {
cout << vc << "<< ";
a = true;
}
if(_kbhit()){
char key = _getch();
if(key=='\r' or key==' '){
clearLine();
cout << vc << "<< " << text;
break;
}
}
cout << c;
this_thread::sleep_for(chrono::milliseconds(tickspeed));
}
cout << "\033[0m";
}
void MCS(const string& text, int tickspeed){
bool a = false;
tb=">> ";
tb+=text;
for (char c : text) {
if (!a) {
cout << mc << ">> ";
a = true;
}
if(_kbhit()){
char key = _getch();
if(key=='\r' or key==' '){
clearLine();
cout << mc << ">> " << text;
break;
}
}
cout << c;
this_thread::sleep_for(chrono::milliseconds(tickspeed));
}
cout << "\033[0m";
}
void narratorclean(string currentColor, const string& text, int tickspeed) {
bool a = false;
tb += text;
for(char c : text) {
if(currentColor != "") {
cout << currentColor;
}
cout << c;
if(_kbhit()) {
char key = _getch();
if(key=='\r' or key==' ') {
clearLine();
if(currentColor != "") {
cout << currentColor;
}
cout << tb;
break;
}
}
this_thread::sleep_for(chrono::milliseconds(tickspeed));
}
cout << "\033[0m";
}
void MCSC(string currentColor, const string& text, int tickspeed) {
tb=">> ";
tb+=text;
bool a = false;
for(char c : text) {
if(currentColor != "") {
cout << currentColor;
}
cout << c;
if(_kbhit()) {
char key = _getch();
if(key=='\r' or key==' ') {
clearLine();
if(currentColor != "") {
cout << currentColor;
}
cout << tb;
break;
}
}
this_thread::sleep_for(chrono::milliseconds(tickspeed));
}
cout << "\033[0m";
}
void truenarrator(const string& text, int tickspeed) {
tb=" ";
tb+=text; cout << " ";
bool a = false;
for (char c : text) {
cout << c;
if(_kbhit()){
char key = _getch();
if(key=='\r' or key==' '){
clearLine();
cout << tb;
break;
}
}
this_thread::sleep_for(chrono::milliseconds(tickspeed));
}
}
void TNC(const string& text, int tickspeed){
bool a = false;
tb+=text;
for (char c : text) {
cout << c;
if(_kbhit()){
char key = _getch();
if(key=='\r' or key==' '){
clearLine();
cout << tb;
break;
}
}
this_thread::sleep_for(chrono::milliseconds(tickspeed));
}
}
void skip(int time) {
for (time; time > 0; time -= 50) {
if (_kbhit()) {
char key = _getch();
if (key == '\r' or key == ' ') {
break;
}
}
Sleep(50);
}
}
void getInput() {
cout << ">> ";
getline(cin, input);
skip(1000);
}
string GVI(int min, int max) {
string dinput;
while (true) {
char input = _getch();
if (input >= min+'0' && input <= max+'0') {
dinput = string(1, input);
cout << dinput;
break;
}
}
return dinput;
}
string GVIclean(int min, int max) {
string dinput;
while (true) {
char input = _getch();
if (input >= min+'0' && input <= max+'0') {
dinput = string(1, input);
break;
}
}
return dinput;
}
void flushInput() {
while (_kbhit()) {
_getch();
Sleep(50);
}
}
};