From cb1183751aa25069560923948a0a6de300e6ac9c Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Fri, 2 May 2025 12:22:30 -0400 Subject: color.h --- ui.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'ui.c') diff --git a/ui.c b/ui.c index 77daf2a..10466dd 100644 --- a/ui.c +++ b/ui.c @@ -12,6 +12,7 @@ #include "engine.h" #include "ui.h" #include "eprintf.h" +#include "color.h" #define DEFAULT_DISPLACEMENT (litre(1.5)) @@ -24,6 +25,10 @@ #define DEFAULT_INTERCOOLER_EFFICIENCY (percent(90)) #define DEFAULT_INTERCOOLER_DELTAP (psi(0.2)) +enum { POINT_RADIUS = 8 }; + +static const mu_Color POINT_COLOR = RED; + static void init_displacement(UI *ui); static void init_ambient_temperature(UI *ui); @@ -48,6 +53,8 @@ static void compute_manifold_temperature(UI *ui, int idx); static void compute_volume_flow_rate(UI *ui, int idx); static void compute_mass_flow_rate(UI *ui, int idx); static void compute_mass_flow_rate_corrected(UI *ui, int idx); +static void draw_point(UI *ui, int idx, mu_Color color); +static void point_coords(UI *ui, int idx, int *x, int *y); /* Returns non-zero on error. The renderer must already be initialized. */ @@ -427,12 +434,16 @@ set_intercooler_deltap_unit(UI *ui) { void compute(UI *ui, int idx) { + draw_point(ui, idx, TRANSPARENT); + compute_pressure_ratio(ui, idx); compute_comp_outlet_temperature(ui, idx); compute_manifold_temperature(ui, idx); compute_volume_flow_rate(ui, idx); compute_mass_flow_rate(ui, idx); compute_mass_flow_rate_corrected(ui, idx); + + draw_point(ui, idx, POINT_COLOR); } void @@ -522,6 +533,19 @@ compute_mass_flow_rate_corrected(UI *ui, int idx) { w_set_number(ui->mass_flow_rate_corrected[idx], v); } +static void +draw_point(UI *ui, int idx, mu_Color color) { + int x, y; + + point_coords(ui, idx, &x, &y); + w_canvas_draw_circle(&ui->comp_img, x, y, POINT_RADIUS, color); +} + +static void +point_coords(UI *ui, int idx, int *x, int *y) { + /* TODO */ +} + void insert_point(UI *ui, int idx) { int i; -- cgit v1.2.3