Skip to content
Snippets Groups Projects
Verified Commit 81f62be4 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

docs: add new comments

parent 99ce5143
No related branches found
No related tags found
No related merge requests found
...@@ -82,12 +82,18 @@ fn main() { ...@@ -82,12 +82,18 @@ fn main() {
let current_time = timer_subsystem.ticks(); let current_time = timer_subsystem.ticks();
let delta_t = current_time - last_update_time; let delta_t = current_time - last_update_time;
if game_loaded && tick_interval > delta_t { if game_loaded && tick_interval > delta_t {
// runs the tick operation in the CHIP-8 system,
// effectively changing the logic state of the machine
chip8.clock(); chip8.clock();
chip8.clock_dt(); chip8.clock_dt();
chip8.clock_st(); chip8.clock_st();
// @todo not sure if the delay should come here
timer_subsystem.delay(tick_interval - delta_t); timer_subsystem.delay(tick_interval - delta_t);
// @todo this looks to be very slow!
// we should use a callback on pixel buffer change
// to make this a faster thing
let mut rgb_pixels = vec![]; let mut rgb_pixels = vec![];
for p in chip8.pixels() { for p in chip8.pixels() {
rgb_pixels.extend_from_slice(&[ rgb_pixels.extend_from_slice(&[
...@@ -97,6 +103,8 @@ fn main() { ...@@ -97,6 +103,8 @@ fn main() {
]) ])
} }
// creates a texture based on the RGB pixel buffer
// and copies that to the canvas for presentation
texture texture
.update(None, &rgb_pixels, SCREEN_PIXEL_WIDTH as usize * 3) .update(None, &rgb_pixels, SCREEN_PIXEL_WIDTH as usize * 3)
.unwrap(); .unwrap();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment