Updated samples/demos to show usage of hide/show time elapsed/remaining

This commit is contained in:
Pranav Srinivas Kumar
2019-12-17 09:31:43 -06:00
parent 8198d8a802
commit 6224a46371
10 changed files with 72 additions and 43 deletions

View File

@@ -11,31 +11,30 @@ int main() {
bar.fill_bar_remainder_with("-");
bar.end_bar_with("]");
bar.set_foreground_color(indicators::Color::YELLOW);
bar.hide_elapsed_time();
bar.hide_remaining_time();
// As configured, the bar will look like this:
//
// [■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■-------------] 70%
//
//
std::atomic<size_t> index{0};
std::vector<std::string> status_text =
{
"Rocket.exe is not responding",
"Finding a replacement engineer",
"Buying more snacks",
"Assimilating the modding community",
"Crossing fingers",
"Porting KSP to a Nokia 3310"
};
std::vector<std::string> status_text = {"Rocket.exe is not responding",
"Finding a replacement engineer",
"Buying more snacks",
"Assimilating the modding community",
"Crossing fingers",
"Porting KSP to a Nokia 3310"};
// Let's say you want to append some status text to the right of the progress bar
// You can use bar.set_postfix_text(...) to append text to the right
//
// [■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■-------------] 70% Finding a replacement engineer
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//
//
//
auto job = [&bar, &index, &status_text]() {
while (true) {
@@ -58,6 +57,6 @@ int main() {
second_job.join();
third_job.join();
last_job.join();
return 0;
}