mirror of
https://github.com/p-ranav/indicators.git
synced 2025-12-15 20:08:53 +08:00
Updated alien spaceship sample
This commit is contained in:
@@ -1,11 +1,51 @@
|
||||
#include <progress/bar.hpp>
|
||||
#include <vector>
|
||||
|
||||
/*
|
||||
[
|
||||
"|/-\\",
|
||||
"⠂-–—–-",
|
||||
"◐◓◑◒",
|
||||
"◴◷◶◵",
|
||||
"◰◳◲◱",
|
||||
"▖▘▝▗",
|
||||
"■□▪▫",
|
||||
"▌▀▐▄",
|
||||
"▉▊▋▌▍▎▏▎▍▌▋▊▉",
|
||||
"▁▃▄▅▆▇█▇▆▅▄▃",
|
||||
"←↖↑↗→↘↓↙",
|
||||
"┤┘┴└├┌┬┐",
|
||||
"◢◣◤◥",
|
||||
".oO°Oo.",
|
||||
".oO@*",
|
||||
["🌍", "🌎", "🌏"],
|
||||
"◡◡ ⊙⊙ ◠◠",
|
||||
"☱☲☴",
|
||||
"⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏",
|
||||
"⠋⠙⠚⠞⠖⠦⠴⠲⠳⠓",
|
||||
"⠄⠆⠇⠋⠙⠸⠰⠠⠰⠸⠙⠋⠇⠆",
|
||||
"⠋⠙⠚⠒⠂⠂⠒⠲⠴⠦⠖⠒⠐⠐⠒⠓⠋",
|
||||
"⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠴⠲⠒⠂⠂⠒⠚⠙⠉⠁",
|
||||
"⠈⠉⠋⠓⠒⠐⠐⠒⠖⠦⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈",
|
||||
"⠁⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈⠈",
|
||||
"⢄⢂⢁⡁⡈⡐⡠",
|
||||
"⢹⢺⢼⣸⣇⡧⡗⡏",
|
||||
"⣾⣽⣻⢿⡿⣟⣯⣷",
|
||||
"⠁⠂⠄⡀⢀⠠⠐⠈",
|
||||
["🌑", "🌒", "🌓", "🌔", "🌕", "🌝", "🌖", "🌗", "🌘", "🌚"],
|
||||
["🕛", "🕐", "🕑", "🕒", "🕓", "🕔", "🕕", "🕖", "🕗", "🕘", "🕙", "🕚"]
|
||||
]
|
||||
*/
|
||||
|
||||
int main() {
|
||||
|
||||
// Hide cursor
|
||||
std::cout << "\e[?25l";
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// PROGRESS BAR 1
|
||||
//
|
||||
@@ -108,20 +148,24 @@ int main() {
|
||||
ProgressBar p5;
|
||||
p5.bar_width(100);
|
||||
p5.start_with("🌏");
|
||||
p5.fill_progress_with("·");
|
||||
p5.fill_progress_with("-");
|
||||
p5.lead_progress_with("🛸");
|
||||
p5.fill_remainder_with(" ");
|
||||
p5.end_with("🌑");
|
||||
p5.show_percentage(true);
|
||||
p5.color(ProgressBar::Color::WHITE);
|
||||
auto job5 = [&p5]() {
|
||||
std::atomic<int> trail_index{0};
|
||||
std::vector<std::string> trail {"■", "□", "▪", "▫"};
|
||||
auto job5 = [&p5, &trail, &trail_index]() {
|
||||
while (true) {
|
||||
if (p5.current() % 5 == 0) {
|
||||
p5.fill_progress_with("·");
|
||||
} else {
|
||||
p5.fill_progress_with(" ");
|
||||
}
|
||||
p5.lead_progress_with(
|
||||
trail[(trail_index - 3) % trail.size()] +
|
||||
trail[(trail_index - 2) % trail.size()] +
|
||||
trail[(trail_index - 1) % trail.size()] +
|
||||
trail[trail_index % trail.size()] +
|
||||
"🛸");
|
||||
p5.tick();
|
||||
trail_index += 1;
|
||||
if (p5.completed()) {
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user