forked from codewithnick/ascii-art
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Ascii.h
239 lines (225 loc) · 7.36 KB
/
Ascii.h
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
// Ascii.h
#ifndef ASCII_H
#define ASCII_H
#include <string>
#include "./Fonts/fonts.h"
#include "./Fonts/SevenStar/sevenstar.h"
#include "./Fonts/Boomer/boomer.h"
#include "./Fonts/Straight/straight.h"
#include "./Fonts/starwar/starwar.h"
#include "./Fonts/carlos/carlos.h"
#include "./Fonts/banner/banner.h"
#include "./Fonts/block/block.h"
#include "./Fonts/amongus/amongus.h"
#include "./Fonts/drpepper/drpepper.h"
#include "./Fonts/small/small.h"
namespace ascii
{
enum FontName
{
sevenstar,
boomer,
straight,
starwar,
carlos,
banner,
block,
amongus,
drpepper,
small
};
class Ascii
{
public:
Fonts *font;
Ascii(const FontName &fontName)
{
if (fontName == FontName::sevenstar)
{
this->font = new SevenStar();
}
else if (fontName == FontName::boomer)
{
this->font = new Boomer();
}
else if (fontName == FontName::straight)
{
this->font = new Straight();
}
else if (fontName == FontName::starwar)
{
this->font = new Starwar();
}
else if (fontName == FontName::carlos)
{
this->font = new Carlos();
}
else if (fontName == FontName::banner)
{
this->font = new Banner();
}
else if (fontName == FontName::block)
{
this->font = new Block();
}
else if (fontName == FontName::amongus)
{
this->font = new Amongus();
}
else if (fontName == FontName::drpepper)
{
this->font = new Drpepper();
}
else if (fontName == FontName::small)
{
this->font = new Small();
}
else
{
exit(500);
}
}
void print(const std::string &text)
{
char **character = nullptr;
for (int i = 0; i < text.size(); i++)
{
char c = text[i];
// Uppercase alphabets
if (c == 'A')
character = font->A();
else if (c == 'B')
character = font->B();
else if (c == 'C')
character = font->C();
else if (c == 'D')
character = font->D();
else if (c == 'E')
character = font->E();
else if (c == 'F')
character = font->F();
else if (c == 'G')
character = font->G();
else if (c == 'H')
character = font->H();
else if (c == 'I')
character = font->I();
else if (c == 'J')
character = font->J();
else if (c == 'K')
character = font->K();
else if (c == 'L')
character = font->L();
else if (c == 'M')
character = font->M();
else if (c == 'N')
character = font->N();
else if (c == 'O')
character = font->O();
else if (c == 'P')
character = font->P();
else if (c == 'Q')
character = font->Q();
else if (c == 'R')
character = font->R();
else if (c == 'S')
character = font->S();
else if (c == 'T')
character = font->T();
else if (c == 'U')
character = font->U();
else if (c == 'V')
character = font->V();
else if (c == 'W')
character = font->W();
else if (c == 'X')
character = font->X();
else if (c == 'Y')
character = font->Y();
else if (c == 'Z')
character = font->Z();
// Lowercase alphabets
else if (c == 'a')
character = font->a();
else if (c == 'b')
character = font->b();
else if (c == 'c')
character = font->c();
else if (c == 'd')
character = font->d();
else if (c == 'e')
character = font->e();
else if (c == 'f')
character = font->f();
else if (c == 'g')
character = font->g();
else if (c == 'h')
character = font->h();
else if (c == 'i')
character = font->i();
else if (c == 'j')
character = font->j();
else if (c == 'k')
character = font->k();
else if (c == 'l')
character = font->l();
else if (c == 'm')
character = font->m();
else if (c == 'n')
character = font->n();
else if (c == 'o')
character = font->o();
else if (c == 'p')
character = font->p();
else if (c == 'q')
character = font->q();
else if (c == 'r')
character = font->r();
else if (c == 's')
character = font->s();
else if (c == 't')
character = font->t();
else if (c == 'u')
character = font->u();
else if (c == 'v')
character = font->v();
else if (c == 'w')
character = font->w();
else if (c == 'x')
character = font->x();
else if (c == 'y')
character = font->y();
else if (c == 'z')
character = font->z();
// Numbers
else if (c == '0')
character = font->zero();
else if (c == '1')
character = font->one();
else if (c == '2')
character = font->two();
else if (c == '3')
character = font->three();
else if (c == '4')
character = font->four();
else if (c == '5')
character = font->five();
else if (c == '6')
character = font->six();
else if (c == '7')
character = font->seven();
else if (c == '8')
character = font->eight();
else if (c == '9')
character = font->nine();
// for space
else if (c == ' ')
character = font->space();
font->pushChar(character);
}
font->printvector();
// font->destroyspace();
}
};
} // namespace ascii
#endif