// MARKUS MAIWALD (ARCHITECT) | VOXIS FORGE (AI) // RUMPK HAL // HUD TUI // Minimal ANSI escape code utilities for the NexShell HUD. const uart = @import("uart.zig"); pub const ESC = "\x1b["; pub const CLEAR = "\x1b[2J\x1b[H"; pub const HIDE_CURSOR = "\x1b[?25l"; pub const SHOW_CURSOR = "\x1b[?25h"; pub fn move_to(row: u8, col: u8) void { uart.print(ESC); print_u8(row); uart.print(";"); print_u8(col); uart.print("H"); } pub fn set_color(code: u8) void { uart.print(ESC); print_u8(code); uart.print("m"); } pub fn reset_color() void { uart.print("\x1b[0m"); } pub fn draw_box(x: u8, y: u8, w: u8, h: u8, title: []const u8) void { // Basic ASCII/ANSI box move_to(y, x); uart.print("┌"); var i: u8 = 0; while (i < w - 2) : (i += 1) uart.print("─"); uart.print("┐"); i = 1; while (i < h - 1) : (i += 1) { move_to(y + i, x); uart.print("│"); move_to(y + i, x + w - 1); uart.print("│"); } move_to(y + h - 1, x); uart.print("└"); i = 0; while (i < w - 2) : (i += 1) uart.print("─"); uart.print("┘"); if (title.len > 0) { move_to(y, x + 2); uart.print("[ "); uart.print(title); uart.print(" ]"); } } // Helper to print u8 as text without full fmt fn print_u8(n: u8) void { if (n == 0) { uart.print("0"); return; } var buf: [3]u8 = undefined; var i: u8 = 0; var val = n; while (val > 0) { buf[i] = @as(u8, @intCast(val % 10)) + '0'; val /= 10; i += 1; } while (i > 0) { i -= 1; uart.putc(buf[i]); } }