From b717570cb2c09d52f9be268ce74b6cb7fcbe241e Mon Sep 17 00:00:00 2001 From: Zoe <62722391+juls0730@users.noreply.github.com> Date: Fri, 7 Feb 2025 16:04:37 +0000 Subject: [PATCH] fix(render): FB erased eroneously In the render thread, we cleared the FB to fix the beeper test, but that broke several other tests that drew to the screen before the fb was properly set, this pr fixes that issue, and the render thread works properly for all tests. --- src/main.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index ea30457..9052cc8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -185,7 +185,7 @@ class Chip8 { return this->fb[y][x]; } - bool fb[SCREEN_HEIGHT][SCREEN_WIDTH]; + bool fb[SCREEN_HEIGHT][SCREEN_WIDTH] = {}; std::atomic_uint8_t delay; std::atomic_uint8_t sound_timer; std::mutex key_mutex; @@ -252,8 +252,6 @@ void render_thread(Chip8 *chip8) { SDL_TEXTUREACCESS_STREAMING, SCREEN_WIDTH, SCREEN_HEIGHT); - memset(chip8->fb, 0, SCREEN_WIDTH * SCREEN_HEIGHT); - while (true) { printf("Rendering...\n"); draw(renderer, texture, chip8);