Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
oir committed Nov 15, 2023
1 parent 77af288 commit 3d808b2
Showing 1 changed file with 42 additions and 39 deletions.
81 changes: 42 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ including `meanwhile.h` in your project.
---

- Display a waiting animation with a message:

```C++
using namespace std::chrono_literals;
using namespace mew;
Expand All @@ -26,7 +27,9 @@ including `meanwhile.h` in your project.
<source media="(prefers-color-scheme: light)" srcset="docs/anim1-light.svg" width="700">
<img src="docs/anim1-light.svg" width="700">
</picture>
- Supports several styles:
```C++
auto anim = Animation().message("Downloading...").style(Earth);
```
Expand All @@ -36,48 +39,48 @@ including `meanwhile.h` in your project.
<img src="docs/anim2-light.svg" width="700">
</picture>

- Display a counter to monitor a numeric variable while waiting:

Display a counter to monitor a numeric variable while waiting:
```C++
int work{0};
auto c = Counter(work)
.message("Reading lines")
.speed(Speed::Last)
.unit_of_speed("line/s");
c.start();
for (int i = 0; i < 505; i++) {
std::this_thread::sleep_for(13ms); // read & process line
work++;
}
c.done();
```
<picture>
<source media="(prefers-color-scheme: dark)" srcset="docs/counter-dark.svg" width="700">
<source media="(prefers-color-scheme: light)" srcset="docs/counter-light.svg" width="700">
<img src="docs/counter-light.svg" width="700">
</picture>
```C++
int work{0};
auto c = Counter(work)
.message("Reading lines")
.speed(Speed::Last)
.unit_of_speed("line/s");
c.start();
for (int i = 0; i < 505; i++) {
std::this_thread::sleep_for(13ms); // read & process line
work++;
}
c.done();
```
<picture>
<source media="(prefers-color-scheme: dark)" srcset="docs/counter-dark.svg" width="700">
<source media="(prefers-color-scheme: light)" srcset="docs/counter-light.svg" width="700">
<img src="docs/counter-light.svg" width="700">
</picture>
Display a progress bar to monitor a numeric variable and measure its completion by comparing against a total:
- Display a progress bar to monitor a numeric variable and measure its completion by comparing against a total:
```C++
int work{0};
auto bar = ProgressBar(work)
.message("Reading lines")
.speed(Speed::Last)
.unit_of_speed("line/s")
.total(505);
bar.start();
for (int i = 0; i < 505; i++) {
std::this_thread::sleep_for(13ms); // read & process line
work++;
}
bar.done();
```
<picture>
<source media="(prefers-color-scheme: dark)" srcset="docs/bar-dark.svg" width="700">
<source media="(prefers-color-scheme: light)" srcset="docs/bar-light.svg" width="700">
<img src="docs/bar-light.svg" width="700">
</picture>
```C++
int work{0};
auto bar = ProgressBar(work)
.message("Reading lines")
.speed(Speed::Last)
.unit_of_speed("line/s")
.total(505);
bar.start();
for (int i = 0; i < 505; i++) {
std::this_thread::sleep_for(13ms); // read & process line
work++;
}
bar.done();
```
<picture>
<source media="(prefers-color-scheme: dark)" srcset="docs/bar-dark.svg" width="700">
<source media="(prefers-color-scheme: light)" srcset="docs/bar-light.svg" width="700">
<img src="docs/bar-light.svg" width="700">
</picture>

Combine diplays using `|` operator to monitor multiple variables:
```C++
Expand Down

0 comments on commit 3d808b2

Please sign in to comment.