Cleaning up ui components making uniform.

This commit is contained in:
2026-06-13 09:31:32 +02:00
parent d28aa8a401
commit 2c664b24a9
4 changed files with 138 additions and 93 deletions
+18 -2
View File
@@ -3,7 +3,9 @@ package simulator
import "core:fmt"
import rl "vendor:raylib"
// @TODO: render status bar text
gui_status_bar :: proc(rect: rl.Rectangle, sim: ^Simulator) {
// Left to right text draws
rl.DrawRectangleLinesEx(rect, 1, rl.DARKGRAY)
cursor: f32 = rect.x + PADDING
@@ -16,7 +18,21 @@ gui_status_bar :: proc(rect: rl.Rectangle, sim: ^Simulator) {
}
status_divider(&cursor, cy)
status_text(&cursor, cy, fmt.ctprintf("FPS: %d", rl.GetFPS()), sim.font)
status_text(&cursor, cy, fmt.ctprintf("Rom Loaded: %v", sim.rom_loaded), sim.font)
// FPS set far right
fps_text := fmt.ctprintf("FPS: %d", rl.GetFPS())
fps_width := rl.MeasureTextEx(sim.font, fps_text, f32(sim.font.baseSize), 1).x
fps_x := rect.x + rect.width - PADDING - fps_width
rl.DrawTextEx(
sim.font,
fps_text,
{fps_x, cy - f32(sim.font.baseSize) * 0.5},
f32(sim.font.baseSize),
1,
rl.RAYWHITE,
)
}
StatusIconShape :: enum { CIRCLE, SQUARE }
@@ -43,4 +59,4 @@ status_divider :: proc(cursor: ^f32, cy: f32) {
status_text :: proc(cursor: ^f32, cy: f32, text: cstring, font: rl.Font) {
rl.DrawTextEx(font, text, {cursor^, cy - f32(font.baseSize) * 0.5}, f32(font.baseSize), 1, rl.RAYWHITE)
cursor^ += rl.MeasureTextEx(font, text, f32(font.baseSize), 1).x + PADDING
}
}