Crude drawing call for now just to test.

This commit is contained in:
2026-05-19 08:06:46 +02:00
parent 6f4754d235
commit e3d9263ff6
+18 -3
View File
@@ -8,20 +8,35 @@ import rl "vendor:raylib"
SCALE :: 20
SCREEN_WITDH :: 64 * SCALE
SCREEN_HEIGHT :: 32 * SCALE
CYCLES_PER_FRAME :: 12
// Display will handle all the screen drawing with raylib etc
init_display_and_cycle :: proc(s: ^System) {
run_system :: proc(s: ^System) {
rl.InitWindow(SCREEN_WITDH, SCREEN_HEIGHT, "chip8")
// Cap at 60hz/60fps
rl.SetTargetFPS(60)
for !rl.WindowShouldClose() {
rl.BeginDrawing()
rl.ClearBackground(rl.WHITE)
rl.ClearBackground(rl.BLACK)
// Do a cpu cycle
cycle(s)
for _ in 0..<CYCLES_PER_FRAME {
cycle(s)
}
// update display with display buffer bits
// get row
for y in 0..<len(s.display) {
// get cols
for x in 0..<len(s.display[0]) {
if s.display[y][x] == 0x01 {
rl.DrawRectangle(i32(x * SCALE), i32(y * SCALE), SCALE, SCALE, rl.WHITE)
}
}
}
rl.EndDrawing()
}