2019-12-17 09:31:43 -06:00
|
|
|
#include <chrono>
|
2019-12-16 09:11:25 -06:00
|
|
|
#include <indicators/block_progress_bar.hpp>
|
2020-04-26 18:28:46 +02:00
|
|
|
#include <indicators/cursor_control.hpp>
|
2019-12-16 09:11:25 -06:00
|
|
|
#include <thread>
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
|
|
|
|
|
// Hide cursor
|
2020-04-26 18:28:46 +02:00
|
|
|
indicators::show_console_cursor(false);
|
2019-12-17 09:31:43 -06:00
|
|
|
|
2020-04-06 11:25:54 -07:00
|
|
|
indicators::BlockProgressBar bar{
|
2020-05-24 22:56:57 -05:00
|
|
|
indicators::option::BarWidth{80},
|
|
|
|
|
indicators::option::FontStyles{
|
|
|
|
|
std::vector<indicators::FontStyle>{indicators::FontStyle::bold}}};
|
2019-12-17 09:31:43 -06:00
|
|
|
|
2019-12-16 09:11:25 -06:00
|
|
|
// Update bar state
|
|
|
|
|
auto progress = 0.0f;
|
|
|
|
|
while (true) {
|
|
|
|
|
bar.set_progress(progress);
|
|
|
|
|
progress += 0.25f;
|
|
|
|
|
if (bar.is_completed())
|
|
|
|
|
break;
|
|
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Show cursor
|
2020-04-26 18:28:46 +02:00
|
|
|
indicators::show_console_cursor(true);
|
2019-12-16 09:11:25 -06:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|