diff --git a/src/machine/display.odin b/src/machine/display.odin index a2f7f8d..cae5ea8 100644 --- a/src/machine/display.odin +++ b/src/machine/display.odin @@ -1,3 +1,30 @@ package machine +import rl "vendor:raylib" + +// Handle the "display" and all of its required functions +// raylib window, rendering, scale constants + +SCALE :: 20 +SCREEN_WITDH :: 64 * SCALE +SCREEN_HEIGHT :: 32 * SCALE + // Display will handle all the screen drawing with raylib etc +init_display_and_cycle :: 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) + + // Do a cpu cycle + cycle(s) + + rl.EndDrawing() + } + + rl.CloseWindow() +}