Repository navigation
v0.1.2
Builds on v0.1.1. This release adds two components and changes no existing behavior.
New: LinearProgress and CircularProgress
Two leaf macros in the style of HDivider(...): no id, no child block, safe to use in loops.
LinearProgress(0.4f); // bar, 40% full
LinearProgress(CC_PROGRESS_INFINITE); // bar, animated
CircularProgress(0.75f); // ring, 75% full
CircularProgress(CC_PROGRESS_INFINITE); // ring, animatedThe value
The first argument is required. It is a float from 0 to 1.
| Value | Result |
|---|---|
0 |
Empty track |
0 to 1 |
Filled to that fraction |
Above 1 |
Clamped to full |
CC_PROGRESS_INFINITE, or any negative value |
Animated indicator for work of unknown length |
The infinite animation runs off the backend clock. You keep no state and call nothing per frame beyond the macro itself.
if (download.total > 0)
LinearProgress((float)download.done / download.total);
else
LinearProgress(CC_PROGRESS_INFINITE);Options
LinearProgress(ratio, .length = 240, .thickness = 6,
.color = Color(111, 173, 162, 255),
.trackColor = Color(36, 38, 46, 255));
CircularProgress(ratio, .size = 48, .thickness = 5,
.color = Color(111, 173, 162, 255));| Component | Option | Meaning | Default |
|---|---|---|---|
LinearProgress |
.length |
Track width in pixels | Grows to fill the parent's width |
LinearProgress |
.thickness |
Track height in pixels | 4 |
CircularProgress |
.size |
Diameter in pixels | 40 |
CircularProgress |
.thickness |
Stroke width in pixels | 4 |
| Both | .color |
Fill or arc color | The global font color |
| Both | .trackColor |
Track color | .color at 25% of its alpha |
How they render
LinearProgressis plain layout: a rounded track with a fill sized byPercent(). It emits ordinary rectangle commands, so it works in headless builds (CCOMPOSE_NO_BACKEND). In infinite mode a segment 30% of the track wide sweeps left to right every 1.5 seconds.CircularProgressfills clockwise from 12 o'clock and is painted with raylib through the same slot pool asDraw, so it needs the raylib backend. In infinite mode a 90 degree arc turns once per second. In headless builds it reserves its.sizesquare and draws nothing.
Also new
void CC_LinearProgress(float value, CC_LinearProgressOpts opts)andvoid CC_CircularProgress(float value, CC_CircularProgressOpts opts)are the functions the macros expand into.examples/demo.chas a Progress section at the bottom of the Home page with a looping and an infinite instance of each.
Known limits
- Animation speed is fixed.
LinearProgressis horizontal only.- The ring's arc ends are flat, not rounded.
- With the default grow width, put the bar in a parent that has a width. Inside a
Fit()-width parent it has nothing to fill. - Rings share the per-frame draw-slot limit with
Drawelements. Past that limit a ring reserves its space and draws nothing. - The infinite animations read raylib's
GetTime(), so an app cannot pause or scale them.
Other changes
PROJECT_VERSIONinCMakeLists.txtis now0.1.2.- New headless test
ccompose_progress_testcovers the bar's fill width, clamping, options and defaults, and the ring's reserved size. - Wiki updated: new Progress page, linked from the sidebar.
Verification
All 7 CI checks pass on Linux (gcc + clang), macOS, Windows (MSVC), and Emscripten, plus clang-format and cppcheck. Headless ctest suite: 5/5 pass. No automated test covers the ring's pixels or either animation.
Consuming via FetchContent
include(FetchContent)
FetchContent_Declare(ccompose
GIT_REPOSITORY https://github.com/rizukirr/ccompose.git
GIT_TAG v0.1.2
GIT_SHALLOW TRUE)
FetchContent_MakeAvailable(ccompose)
target_link_libraries(your_target PRIVATE ccompose)