ogl_beamforming

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

Commit: 0b2d763a3c8b51dde75ee04b26b17480627d5d4f
Parent: 70a70059764502a8957381eda4f728c4bd043b0d
Author: Randy Palamar
Date:   Fri, 13 Sep 2024 12:02:29 -0600

use small font for drawing axis and reduce number of ticks

Diffstat:
Mbeamformer.h | 5++---
Mmain.c | 6+++---
Mui.c | 8++++----
3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/beamformer.h b/beamformer.h @@ -219,9 +219,8 @@ typedef struct { f32 dt; /* UI Theming */ - Font font; - u32 font_size; - u32 font_spacing; + Font font; + Font small_font; InputState is; diff --git a/main.c b/main.c @@ -185,9 +185,9 @@ main(void) SetWindowState(FLAG_WINDOW_RESIZABLE); SetWindowMinSize(INFO_COLUMN_WIDTH * 2, ctx.window_size.h); - ctx.font_size = 32; - ctx.font_spacing = 0; - ctx.font = LoadFontEx("assets/IBMPlexSans-Bold.ttf", ctx.font_size, 0, 0); + /* TODO: build these into the binary */ + ctx.font = LoadFontEx("assets/IBMPlexSans-Bold.ttf", 28, 0, 0); + ctx.small_font = LoadFontEx("assets/IBMPlexSans-Bold.ttf", 22, 0, 0); ctx.is.cursor_blink_t = 1; diff --git a/ui.c b/ui.c @@ -320,7 +320,7 @@ set_text_input_idx(BeamformerCtx *ctx, BPModifiableValue bmv, Rect r, v2 mouse) * of them we can't know this ahead of time. For now we hardcode this and manually * adjust when needed */ #define LISTING_LEFT_COLUMN_WIDTH 270.0f -#define LISTING_LINE_PAD 10.0f +#define LISTING_LINE_PAD 6.0f static Rect do_value_listing(s8 prefix, s8 suffix, f32 value, Font font, Arena a, Rect r) @@ -680,7 +680,7 @@ draw_ui(BeamformerCtx *ctx, Arena arena) s8 txt = s8alloc(&arena, 64); s8 tmp = txt; tmp.len = snprintf((char *)txt.data, txt.len, "%+0.01f mm", -188.8f); - v2 txt_s = measure_text(ctx->font, tmp); + v2 txt_s = measure_text(ctx->small_font, tmp); rr.pos.x += 0.02 * rr.size.w; rr.pos.y += 0.02 * rr.size.h; @@ -719,7 +719,7 @@ draw_ui(BeamformerCtx *ctx, Arena arena) static f32 txt_colour_t[2]; for (u32 i = 0; i < 2; i++) { - u32 line_count = vr.size.E[i] / txt_s.h; + u32 line_count = vr.size.E[i] / (1.5 * txt_s.h); f32 inc = vr.size.E[i] / line_count; v2 start_pos = vr.pos; start_pos.E[!i] += vr.size.E[!i]; @@ -769,7 +769,7 @@ draw_ui(BeamformerCtx *ctx, Arena arena) DrawLineEx(start_pos.rl, end_pos.rl, 3, colour_from_normalized(FG_COLOUR)); s8 tmp = txt; tmp.len = snprintf((char *)txt.data, txt.len, fmt[i], mm); - draw_text(ctx->font, tmp, txt_pos, rot[i], txt_colour); + draw_text(ctx->small_font, tmp, txt_pos, rot[i], txt_colour); start_pos.E[i] += inc; end_pos.E[i] += inc; txt_pos.E[i] += inc;