From 13fc1bdbe4be6b088d729ee057698cbf84621736 Mon Sep 17 00:00:00 2001 From: bQUARKz Date: Sat, 16 May 2026 08:36:08 +0100 Subject: [PATCH] fix hub text rendering on home --- .../src/programs/prometeu_hub/prometeu_hub.rs | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/crates/console/prometeu-system/src/programs/prometeu_hub/prometeu_hub.rs b/crates/console/prometeu-system/src/programs/prometeu_hub/prometeu_hub.rs index bc4163de..8b69b441 100644 --- a/crates/console/prometeu-system/src/programs/prometeu_hub/prometeu_hub.rs +++ b/crates/console/prometeu-system/src/programs/prometeu_hub/prometeu_hub.rs @@ -195,11 +195,17 @@ fn activation_input_down(hw: &dyn HardwareBridge) -> bool { fn render_home(gfx: &mut dyn GfxBridge, pointer_x: i32, pointer_y: i32) { gfx.fill_rect(VIEWPORT.x, VIEWPORT.y, VIEWPORT.w, VIEWPORT.h, COLOR_BG); draw_panel(gfx, TITLE_PANEL, COLOR_PANEL_DARK, COLOR_BORDER); - gfx.draw_text(TITLE_PANEL.x + 58, TITLE_PANEL.y + 9, "PROMETEU HUB", COLOR_TEXT); + draw_buffer_text(gfx, TITLE_PANEL.x + 58, TITLE_PANEL.y + 9, "PROMETEU HUB", COLOR_TEXT); draw_panel(gfx, HOME_PANEL, COLOR_PANEL, COLOR_BORDER); - gfx.draw_text(HOME_PANEL.x + 26, HOME_PANEL.y + 22, "Native Shell Apps", COLOR_TEXT); - gfx.draw_text(HOME_PANEL.x + 26, HOME_PANEL.y + 40, "first retro ui slice", COLOR_MUTED); + draw_buffer_text(gfx, HOME_PANEL.x + 26, HOME_PANEL.y + 22, "Native Shell Apps", COLOR_TEXT); + draw_buffer_text( + gfx, + HOME_PANEL.x + 26, + HOME_PANEL.y + 40, + "first retro ui slice", + COLOR_MUTED, + ); for button in HOME_BUTTONS { let hovered = rect_contains(button.rect, pointer_x, pointer_y); @@ -218,14 +224,14 @@ fn render_shell_window( gfx.fill_rect(VIEWPORT.x, VIEWPORT.y, VIEWPORT.w, VIEWPORT.h, COLOR_BG); draw_panel(gfx, viewport, COLOR_PANEL_DARK, COLOR_BORDER); gfx.fill_rect(viewport.x + 4, viewport.y + 24, viewport.w - 8, viewport.h - 28, color); - gfx.draw_text(viewport.x + 10, viewport.y + 8, title, COLOR_TEXT); - gfx.draw_text(viewport.x + 18, viewport.y + 44, "native fake shell", COLOR_PANEL_DARK); + draw_buffer_text(gfx, viewport.x + 10, viewport.y + 8, title, COLOR_TEXT); + draw_buffer_text(gfx, viewport.x + 18, viewport.y + 44, "native fake shell", COLOR_PANEL_DARK); let close_hovered = rect_contains(CLOSE_BUTTON, pointer_x, pointer_y); let close_fill = if close_hovered { COLOR_HILITE } else { COLOR_BUTTON }; gfx.fill_rect(CLOSE_BUTTON.x, CLOSE_BUTTON.y, CLOSE_BUTTON.w, CLOSE_BUTTON.h, close_fill); gfx.draw_rect(CLOSE_BUTTON.x, CLOSE_BUTTON.y, CLOSE_BUTTON.w, CLOSE_BUTTON.h, COLOR_BORDER); - gfx.draw_text(CLOSE_BUTTON.x + 5, CLOSE_BUTTON.y + 4, "x", COLOR_TEXT); + draw_buffer_text(gfx, CLOSE_BUTTON.x + 5, CLOSE_BUTTON.y + 4, "x", COLOR_TEXT); } fn draw_panel(gfx: &mut dyn GfxBridge, rect: Rect, fill: Color, border: Color) { @@ -240,7 +246,17 @@ fn draw_button(gfx: &mut dyn GfxBridge, rect: Rect, label: &str, hovered: bool) gfx.fill_rect(rect.x, rect.y, rect.w, rect.h, fill); gfx.draw_rect(rect.x, rect.y, rect.w, rect.h, border); gfx.draw_rect(rect.x + 3, rect.y + 3, rect.w - 6, rect.h - 6, COLOR_MUTED); - gfx.draw_text(rect.x + 28, rect.y + 18, label, COLOR_TEXT); + gfx.fill_rect(rect.x + 12, rect.y + 12, 16, 24, border); + gfx.draw_rect(rect.x + 34, rect.y + 12, 62, 24, COLOR_PANEL_DARK); + draw_buffer_text(gfx, rect.x + 40, rect.y + 21, label, COLOR_TEXT); +} + +fn draw_buffer_text(gfx: &mut dyn GfxBridge, x: i32, y: i32, text: &str, color: Color) { + let mut cx = x; + for ch in text.chars() { + gfx.draw_char(cx, y, ch, color); + cx += 4; + } } #[cfg(test)]