From 39aad7f9ca931342f58bf638b5aadd1923db0f50 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Thu, 16 Jan 2025 19:09:09 +0100 Subject: Graphics fixes --- examples/graph.c | 2 +- examples/julia_set.c | 2 +- examples/ui.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'examples') diff --git a/examples/graph.c b/examples/graph.c index 99f916d..f196d3d 100644 --- a/examples/graph.c +++ b/examples/graph.c @@ -502,7 +502,7 @@ void update_and_render_frame(void) { // Render - fill_rectangle((Brush) { .color = { .7f, .8f, .9f, 1.f } }, 0, 0, g_platform.frame_width, g_platform.frame_height); + fill_rectangle((Brush) { .color = { .7f, .8f, .9f, 1.f } }, 0, 0, g_platform.real_width, g_platform.real_height); if (adding_edge) { f64 x0 = world.nodes[adding_src].x; diff --git a/examples/julia_set.c b/examples/julia_set.c index c7f7e9b..a5b733e 100644 --- a/examples/julia_set.c +++ b/examples/julia_set.c @@ -71,7 +71,7 @@ void update_and_render_frame(void) { for (i32 jj = 0; jj < p; ++jj) for (i32 ii = 0; ii < p; ++ii) - g_platform.pixels[(j + jj) * g_platform.frame_width + (i + ii)] = with_alpha(rgb_f32_from_u32(c), 1.f); + g_platform.pixels[(j + jj) * g_platform.frame_width + (i + ii)] = vec4_from_vec3_f32(rgb_f32_from_u32(c), 1.f); } p_render_frame(); diff --git a/examples/ui.c b/examples/ui.c index 8375e4d..c10a9c6 100644 --- a/examples/ui.c +++ b/examples/ui.c @@ -60,11 +60,11 @@ void update_and_render_frame(void) { f64 x0 = w / 2.0; f64 y0 = h / 2.0; - vec3_f32 color = { 1.f, .5f, .5f }; + vec4_f32 color = { 1.f, .5f, .5f, 1.f }; if (g_platform.cursor_x >= x0 && g_platform.cursor_x < x0 + w && g_platform.cursor_y >= y0 && g_platform.cursor_y < y0 + h) - color = (vec3_f32) { 1.f, 1.f, 1.f }; + color = (vec4_f32) { 1.f, 1.f, 1.f, 1.f }; for (i64 i = 0; i < g_platform.input_size; ++i) if (g_platform.input[i].ctrl) @@ -223,8 +223,8 @@ void update_and_render_frame(void) { } draw_text_area(RGB(0.f, 0.f, 0.f), x0 + 8, y0 - 8, w, h, 10., 10., text_len, text); - draw_text_area((Brush) { .color = with_alpha(color, 1.f) }, x0, y0, w, h, 10., 10., text_len, text); - draw_text_cursor((Brush) { .xor_color = 1, .color = { 1.f, 1.f, 1.f, 1.f } }, x0, y0, w, h, 10., 10., cursor, selection, text_len, text); + draw_text_area((Brush) { .color = color, }, x0, y0, w, h, 10., 10., text_len, text); + draw_text_cursor((Brush) { .xor_color = 1, .color = { 1.f, 1.f, 1.f, 1.f }, }, x0, y0, w, h, 10., 10., cursor, selection, text_len, text); p_render_frame(); } -- cgit v1.2.3