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