diff --git a/samples/multiple_bars.cpp b/samples/multiple_bars.cpp index 234ef9a..6318eca 100644 --- a/samples/multiple_bars.cpp +++ b/samples/multiple_bars.cpp @@ -104,7 +104,35 @@ int main() { std::thread thread3(job3); thread3.join(); - std::this_thread::sleep_for(std::chrono::milliseconds(5000)); + // + // PROGRESS BAR 4 + // + std::vector lead_spinner{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}; + ProgressBar p4; + p4.bar_width(50); + p4.start_with("["); + // p4.fill_progress_with(lead_spinner[0]); + p4.fill_progress_with(" "); + p4.lead_progress_with(""); + p4.fill_remainder_with(" "); + p4.end_with("]"); + p4.color(ProgressBar::Color::CYAN); + std::atomic index4{0}; + auto job4 = [&p4, &index4, &lead_spinner]() { + while (true) { + p4.lead_progress_with(lead_spinner[index4 % lead_spinner.size()]); + index4 += 1; + p4.tick(); + if (p4.completed()) { + break; + } + std::this_thread::sleep_for(std::chrono::milliseconds(50)); + } + }; + std::thread thread4(job4); + thread4.join(); + + std::this_thread::sleep_for(std::chrono::milliseconds(5000)); // Show cursor std::cout << "\e[?25h";