Skip to content

Commit 729980e

Browse files
committed
Prettify
1 parent faa4109 commit 729980e

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

examples/status_bars/main.cpp

+12-19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*=============================================================================
22
Copyright (c) 2024 Flole
3+
Copyright (c) 2024 Joel de Guzman
34
45
Distributed under the MIT License (https://opensource.org/licenses/MIT)
56
=============================================================================*/
@@ -18,28 +19,20 @@ auto constexpr bkd_color = rgba(35, 35, 37, 255);
1819
auto background = box(bkd_color);
1920

2021
bool run = false;
21-
template <typename ProgressBar>
22-
void prog_incr(ProgressBar& prog_bar, view& view_)
23-
{
24-
auto val = prog_bar.value();
25-
if (val > 1.0)
26-
{
27-
prog_bar.value(1.0);
28-
run = false;
29-
}
30-
else
31-
{
32-
prog_bar.value(val + 0.005);
33-
}
34-
view_.refresh(prog_bar);
35-
}
36-
37-
template <typename ProgressBar>
38-
void prog_animate(ProgressBar& prog_bar, view& view_)
22+
void prog_animate(concepts::StatusBar auto& prog_bar, view& view_)
3923
{
4024
if (run)
4125
{
42-
prog_incr(prog_bar, view_);
26+
if (auto val = prog_bar.value() + 0.005; val > 1.0)
27+
{
28+
prog_bar.value(1.0);
29+
run = false;
30+
}
31+
else
32+
{
33+
prog_bar.value(val);
34+
}
35+
view_.refresh(prog_bar);
4336
view_.post(10ms,
4437
[&]()
4538
{

0 commit comments

Comments
 (0)