Small ui changes to fit the window better.

This commit is contained in:
2026-06-18 08:25:14 +02:00
parent 350a26d1b9
commit 1a6346895a
3 changed files with 37 additions and 27 deletions
+9 -11
View File
@@ -7,7 +7,6 @@ import rl "vendor:raylib"
MEM_INDICATOR_W :: 14
MEM_ADDRESS_W :: 72
MEM_ROW_H :: 20
MEM_HEADER_H :: 24
MEM_BYTES_PER_ROW :: 16
MEM_TOTAL_ROWS :: 256
MEM_FONT_ROWS :: 5
@@ -25,32 +24,32 @@ gui_tab_memory :: proc(rect: rl.Rectangle, sim: ^Simulator) {
rl.DrawRectangleRec(rect, rl.DARKGRAY)
// Header background
rl.DrawRectangle(i32(rect.x), i32(rect.y), i32(rect.width), MEM_HEADER_H, rl.BLACK)
rl.DrawRectangle(i32(rect.x), i32(rect.y), i32(rect.width), i32(PANEL_HEADER), rl.BLACK)
// Header: Address label
rl.DrawTextEx(sim.font, "Address", {rect.x + MEM_INDICATOR_W, rect.y + 4}, 16, 1, rl.GRAY)
rl.DrawTextEx(sim.font, "Address", {rect.x + MEM_INDICATOR_W, rect.y + 4}, 18, 1, rl.WHITE)
// Header: column labels 0-F
col_w := byte_col_w(rect)
for col in 0..<16 {
x := rect.x + MEM_INDICATOR_W + MEM_ADDRESS_W + f32(col) * col_w
label := strings.clone_to_cstring(MEM_COL_LABELS[col], context.temp_allocator)
rl.DrawTextEx(sim.font, label, {x, rect.y + 4}, 16, 1, rl.GRAY)
rl.DrawTextEx(sim.font, label, {x, rect.y + 4}, 18, 1, rl.WHITE)
}
// Header separator
rl.DrawLine(
i32(rect.x), i32(rect.y + MEM_HEADER_H),
i32(rect.x + rect.width), i32(rect.y + MEM_HEADER_H),
i32(rect.x), i32(rect.y + PANEL_HEADER),
i32(rect.x + rect.width), i32(rect.y + PANEL_HEADER),
rl.GRAY,
)
// Scroll panel area (below header)
panel_rect := rl.Rectangle{
rect.x,
rect.y + MEM_HEADER_H,
rect.y + PANEL_HEADER,
rect.width,
rect.height - MEM_HEADER_H,
rect.height - PANEL_HEADER,
}
content_rect := rl.Rectangle{
@@ -66,7 +65,7 @@ gui_tab_memory :: proc(rect: rl.Rectangle, sim: ^Simulator) {
draw_row := 0
// --- Font rows (0x000 - 0x04F) ---
// Font rows (0x000 - 0x04F)
for row in 0..<MEM_FONT_ROWS {
addr := row * MEM_BYTES_PER_ROW
row_y := panel_rect.y + f32(draw_row) * MEM_ROW_H + sim.mem_scroll.y
@@ -74,7 +73,6 @@ gui_tab_memory :: proc(rect: rl.Rectangle, sim: ^Simulator) {
draw_row += 1
}
// --- Divider ---
divider_y := panel_rect.y + f32(draw_row) * MEM_ROW_H + sim.mem_scroll.y
rl.DrawRectangle(i32(rect.x), i32(divider_y), i32(rect.width), MEM_ROW_H, rl.ColorAlpha(rl.BLACK, 0.4))
rl.DrawTextEx(
@@ -85,7 +83,7 @@ gui_tab_memory :: proc(rect: rl.Rectangle, sim: ^Simulator) {
)
draw_row += 1
// --- ROM rows (0x200 onwards) ---
// ROM rows (0x200 onwards)
for i := 0; MEM_ROM_START + i * MEM_BYTES_PER_ROW < 4096; i += 1 {
addr := MEM_ROM_START + i * MEM_BYTES_PER_ROW
row_y := panel_rect.y + f32(draw_row) * MEM_ROW_H + sim.mem_scroll.y