diff --git a/src/machine/display.odin b/src/machine/display.odin index cae5ea8..e2b8876 100644 --- a/src/machine/display.odin +++ b/src/machine/display.odin @@ -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..