mirror of
https://github.com/p-ranav/indicators.git
synced 2025-12-12 17:58:55 +08:00
Added progress bar samples
This commit is contained in:
27
samples/progress_bar_tick.cpp
Normal file
27
samples/progress_bar_tick.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <indicators/progress_bar.hpp>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
int main() {
|
||||
indicators::ProgressBar bar;
|
||||
|
||||
// Configure the bar
|
||||
bar.set_bar_width(50);
|
||||
bar.start_bar_with("[");
|
||||
bar.fill_bar_progress_with("=");
|
||||
bar.lead_bar_progress_with(">");
|
||||
bar.fill_bar_remainder_with(" ");
|
||||
bar.end_bar_with("]");
|
||||
bar.set_postfix_text("Getting started");
|
||||
bar.set_foreground_color(indicators::Color::GREEN);
|
||||
|
||||
// Update bar state
|
||||
while (true) {
|
||||
bar.tick();
|
||||
if (bar.is_completed())
|
||||
break;
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user