summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorDaniel Jones <admin@danieljon.es>2020-08-18 16:20:57 +0930
committerDaniel Jones <admin@danieljon.es>2020-08-18 16:20:57 +0930
commita9eefc680b3c385747a11f9110b35bfed58d6246 (patch)
tree92b5fe63bd57cf425ed19ca85a7058e51af4e0a5 /main.c
parent1afab3de249c6e2740c066f4074459ed048d8306 (diff)
downloadchip8-a9eefc680b3c385747a11f9110b35bfed58d6246.tar.gz
chip8-a9eefc680b3c385747a11f9110b35bfed58d6246.zip
replace magic numbers with constants
Diffstat (limited to 'main.c')
-rw-r--r--main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/main.c b/main.c
index c6fb639..9a81c31 100644
--- a/main.c
+++ b/main.c
@@ -45,7 +45,6 @@ quit()
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
SDL_Quit();
-
}
void
@@ -72,7 +71,7 @@ toggle_pixel(int x, int y)
// TODO: clean
uint32_t dos = video[WIDTH*y+x];
if (dos <= 0)
- video[WIDTH*y+x] = (255<<16)|(255<<8)|255;
+ video[WIDTH*y+x] = PIXEL_COLOR;
else
video[WIDTH*y+x] = 0;
}
@@ -207,7 +206,10 @@ int main(int argc, char *argv[])
chip8_cycle();
if (draw_flag)
+ {
update_video();
+ draw_flag = 0;
+ }
frame_time = SDL_GetTicks() - frame_start;
if (frame_delay > frame_time)