mirror of
https://github.com/p-ranav/indicators.git
synced 2025-12-13 18:48:53 +08:00
Updated README
This commit is contained in:
32
README.md
32
README.md
@@ -217,6 +217,38 @@ int main() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Smooth Block Progress Bar
|
||||||
|
|
||||||
|
Are you in need of a smooth block progress bar using [unicode block elements](https://en.wikipedia.org/wiki/Block_Elements)? Use `BlockProgressBar` instead of `ProgressBar`.
|
||||||
|
|
||||||
|
`BlockProgressBar` uses unicode block elements that achieve a smooth progress bar experience
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img height="70" src="img/block_progress_bar.gif"/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
`BlockProgressBar` is slighly less configurable compared to `ProgressBar` but you can still set the prefix text, postfix text, color etc.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
indicators::BlockProgressBar bar;
|
||||||
|
|
||||||
|
// Configure the bar
|
||||||
|
bar.set_bar_width(80);
|
||||||
|
bar.start_bar_with("[");
|
||||||
|
bar.end_bar_with("]");
|
||||||
|
bar.set_foreground_color(indicators::Color::WHITE);
|
||||||
|
|
||||||
|
// 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));
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
# Progress Spinner
|
# Progress Spinner
|
||||||
|
|
||||||
To introduce a progress spinner in your application, include `indicators/progress_spinner.hpp` and create a `ProgressSpinner` object.
|
To introduce a progress spinner in your application, include `indicators/progress_spinner.hpp` and create a `ProgressSpinner` object.
|
||||||
|
|||||||
Reference in New Issue
Block a user