Small cleanup formatting and new rom locations.
This commit is contained in:
+23
-24
@@ -12,38 +12,37 @@ CYCLES_PER_FRAME :: 12
|
||||
|
||||
// Display will handle all the screen drawing with raylib etc
|
||||
run_system :: proc(s: ^System) {
|
||||
rl.InitWindow(SCREEN_WITDH, SCREEN_HEIGHT, "chip8")
|
||||
rl.InitWindow(SCREEN_WITDH, SCREEN_HEIGHT, "chip8")
|
||||
|
||||
// Cap at 60hz/60fps
|
||||
rl.SetTargetFPS(60)
|
||||
rl.SetTargetFPS(60)
|
||||
|
||||
for !rl.WindowShouldClose() {
|
||||
rl.BeginDrawing()
|
||||
for !rl.WindowShouldClose() {
|
||||
rl.BeginDrawing()
|
||||
rl.ClearBackground(rl.BLACK)
|
||||
|
||||
rl.ClearBackground(rl.BLACK)
|
||||
// Do a cpu cycle
|
||||
// Cap at 60hz/60fps
|
||||
for _ in 0..<CYCLES_PER_FRAME {
|
||||
cycle(s)
|
||||
}
|
||||
|
||||
// Do a cpu cycle
|
||||
for _ in 0..<CYCLES_PER_FRAME {
|
||||
cycle(s)
|
||||
}
|
||||
render_display_buffer(&s.display)
|
||||
|
||||
render_display_buffer(&s.display)
|
||||
rl.EndDrawing()
|
||||
}
|
||||
|
||||
rl.EndDrawing()
|
||||
}
|
||||
|
||||
rl.CloseWindow()
|
||||
rl.CloseWindow()
|
||||
}
|
||||
|
||||
// update display with display buffer bits
|
||||
render_display_buffer :: proc(display_buffer: ^[32][64]u8) {
|
||||
// get row
|
||||
for y in 0..<len(display_buffer) {
|
||||
// get cols
|
||||
for x in 0..<len(display_buffer[0]) {
|
||||
if display_buffer[y][x] == 0x01 {
|
||||
rl.DrawRectangle(i32(x * SCALE), i32(y * SCALE), SCALE, SCALE, rl.WHITE)
|
||||
}
|
||||
}
|
||||
}
|
||||
// get row
|
||||
for y in 0..<len(display_buffer) {
|
||||
// get cols
|
||||
for x in 0..<len(display_buffer[0]) {
|
||||
if display_buffer[y][x] == 0x01 {
|
||||
rl.DrawRectangle(i32(x * SCALE), i32(y * SCALE), SCALE, SCALE, rl.WHITE)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user