-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.cpp
More file actions
112 lines (95 loc) · 3.19 KB
/
Copy pathexample.cpp
File metadata and controls
112 lines (95 loc) · 3.19 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
// Source: https://github.com/brentmaas/py
#include <iostream>
#include <chrono>
#include <thread>
const std::string p1l1= " ______ ";
const std::string p1l2= "/ \\ ";
const std::string p1l3= "| | | | _____ ";
const std::string p1l4= "\\_____ \\ / _ \\ __";
const std::string p1l5= " | \\ \\_/ / \\ \\_/ /";
const std::string p1l6= " /\\ \\_____/ \\____/ ";
const std::string p2l1= " ______ ";
const std::string p2l2= "/ \\ ";
const std::string p2l3= "| | | | _______ ";
const std::string p2l4= "\\_____ \\ / ___ \\ __";
const std::string p2l5= " | \\ \\___/ / \\ \\___/ /";
const std::string p2l6= " /\\ \\_______/ \\______/ ";
const int dl= 6, len1= 24, len2= 30, maxx= 80;
int x= 80;
int
main(int argc, char ** argv)
{
using namespace std::chrono_literals;
std::string l1, l2, l3, l4, l5, l6;
while (x > -len1) {
std::string spaces= "";
for (int i= 0; i < x; i++) { spaces+= " "; }
if (x > maxx - len1) {
l1= p1l1.substr(0, maxx - x);
l2= p1l2.substr(0, maxx - x);
l3= p1l3.substr(0, maxx - x);
l4= p1l4.substr(0, maxx - x);
l5= p1l5.substr(0, maxx - x);
l6= p1l6.substr(0, maxx - x);
} else if (x < 0) {
l1= p1l1.substr(-x);
l2= p1l2.substr(-x);
l3= p1l3.substr(-x);
l4= p1l4.substr(-x);
l5= p1l5.substr(-x);
l6= p1l6.substr(-x);
} else {
l1= p1l1;
l2= p1l2;
l3= p1l3;
l4= p1l4;
l5= p1l5;
l6= p1l6;
}
std::cout << spaces << l1 << std::endl;
std::cout << spaces << l2 << std::endl;
std::cout << spaces << l3 << std::endl;
std::cout << spaces << l4 << std::endl;
std::cout << spaces << l5 << std::endl;
std::cout << spaces << l6 << std::endl;
std::this_thread::sleep_for(200ms);
// std::cout << "\r\e[A\e[2K\e[A\e[2K\e[A\e[2K\e[A\e[2K\e[A\e[2K\e[A\e[2K";
std::cout << "\e[2J\e[1;1H" << std::endl;
x-= dl;
spaces= "";
for (int i= 0; i < x; i++) { spaces+= " "; }
if (x > maxx - len2) {
l1= p2l1.substr(0, maxx - x);
l2= p2l2.substr(0, maxx - x);
l3= p2l3.substr(0, maxx - x);
l4= p2l4.substr(0, maxx - x);
l5= p2l5.substr(0, maxx - x);
l6= p2l6.substr(0, maxx - x);
} else if (x < 0) {
l1= p2l1.substr(-x);
l2= p2l2.substr(-x);
l3= p2l3.substr(-x);
l4= p2l4.substr(-x);
l5= p2l5.substr(-x);
l6= p2l6.substr(-x);
} else {
l1= p2l1;
l2= p2l2;
l3= p2l3;
l4= p2l4;
l5= p2l5;
l6= p2l6;
}
std::cout << spaces << l1 << std::endl;
std::cout << spaces << l2 << std::endl;
std::cout << spaces << l3 << std::endl;
std::cout << spaces << l4 << std::endl;
std::cout << spaces << l5 << std::endl;
std::cout << spaces << l6 << std::endl;
std::this_thread::sleep_for(200ms);
// std::cout << "\r\e[A\e[2K\e[A\e[2K\e[A\e[2K\e[A\e[2K\e[A\e[2K\e[A\e[2K";
std::cout << "\e[2J\e[1;1H" << std::endl;
}
std::this_thread::sleep_for(200ms);
return 0;
}