ogl_beamforming

Ultrasound Beamforming Implemented with OpenGL
git clone anongit@rnpnr.xyz:ogl_beamforming.git
Log | Files | Refs | Feed | Submodules | LICENSE

Commit: 3c15024686afa2e88b236230314e6b3ca6fd904b
Parent: ac7b64eba8356574a00c77fbf623bfef6d4efd67
Author: Randy Palamar
Date:   Tue, 25 Mar 2025 06:43:08 -0600

ui: fix some progress bar jank

This can't be fully fixed using raylib's rounded rectangle drawing
code because it is too broken - filled versus lines for the same
rectangle give inconsistent output.

Diffstat:
Mui.c | 14++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/ui.c b/ui.c @@ -1386,15 +1386,13 @@ draw_compute_progress_bar(BeamformerUI *ui, Arena arena, ComputeProgressBar *sta state->display_t = CLAMP01(state->display_t); if (state->display_t > (1.0 / 255.0)) { - Rect prect = {.pos = r.pos, .size = {.w = r.size.w, .h = ui->font.baseSize}}; - prect = scale_rect_centered(prect, (v2){.x = 1, .y = 0.7}); - Rect fprect = prect; - fprect.size.w *= *state->progress; - DrawRectangleRounded(fprect.rl, 2, 0, fade(colour_from_normalized(HOVERED_COLOUR), + Rect outline = {.pos = r.pos, .size = {.w = r.size.w, .h = ui->font.baseSize}}; + outline = scale_rect_centered(outline, (v2){.x = 0.96, .y = 0.7}); + Rect filled = outline; + filled.size.w *= *state->progress; + DrawRectangleRounded(filled.rl, 2, 0, fade(colour_from_normalized(HOVERED_COLOUR), state->display_t)); - DrawRectangleRoundedLinesEx(prect.rl, 2, 0, 4.0, colour_from_normalized(BG_COLOUR)); - prect = scale_rect_centered(prect, (v2){.x = 0.99, .y = 1}); - DrawRectangleRoundedLinesEx(prect.rl, 2, 0, 2.5, fade(BLACK, state->display_t)); + DrawRectangleRoundedLinesEx(outline.rl, 2, 0, 3, fade(BLACK, state->display_t)); } v2 result = {.x = r.size.w, .y = ui->font.baseSize};