Skip to content

Commit 17d84d0

Browse files
committed
Merge branch 'skia_2024'
2 parents d61a5f6 + 729980e commit 17d84d0

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
=============================================================================*/
@@ -16,28 +17,20 @@ auto constexpr bkd_color = rgba(35, 35, 37, 255);
1617
auto background = box(bkd_color);
1718

1819
bool run = false;
19-
template <typename ProgressBar>
20-
void prog_incr(ProgressBar& prog_bar, view& view_)
21-
{
22-
auto val = prog_bar.value();
23-
if (val > 1.0)
24-
{
25-
prog_bar.value(1.0);
26-
run = false;
27-
}
28-
else
29-
{
30-
prog_bar.value(val + 0.005);
31-
}
32-
view_.refresh(prog_bar);
33-
}
34-
35-
template <typename ProgressBar>
36-
void prog_animate(ProgressBar& prog_bar, view& view_)
20+
void prog_animate(concepts::StatusBar auto& prog_bar, view& view_)
3721
{
3822
if (run)
3923
{
40-
prog_incr(prog_bar, view_);
24+
if (auto val = prog_bar.value() + 0.005; val > 1.0)
25+
{
26+
prog_bar.value(1.0);
27+
run = false;
28+
}
29+
else
30+
{
31+
prog_bar.value(val);
32+
}
33+
view_.refresh(prog_bar);
4134
view_.post(10ms,
4235
[&]()
4336
{

0 commit comments

Comments
 (0)