diff options
Diffstat (limited to 'src/screen.c')
| -rw-r--r-- | src/screen.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/screen.c b/src/screen.c index d312a8d..2744ee1 100644 --- a/src/screen.c +++ b/src/screen.c @@ -15,7 +15,7 @@ void ScreenInit(int width, int height){ SetTraceLogLevel(LOG_ERROR); // Disable anoying raylib logs InitWindow(width, height, "Chip-8 Emulator"); - SetTargetFPS(60); // Set game to run at 60 frames-per-second + SetTargetFPS(80); // Set game to run at 60 frames-per-second } void ScreenClear() { @@ -40,8 +40,11 @@ void ScreenUpdate(){ EndDrawing(); } -void ScreenSetPixel(int x, int y, unsigned char state){ - Screen.pixels[x+y*64]=(state==0) ? 0: 1; +char ScreenPixelApply(int x, int y, unsigned char state){ + if(Screen.pixels[x+y*64] != 0 && state != 0) + return 1; + Screen.pixels[x+y*64]=state; + return 0; } void ScreenPixelFlip(int x, int y){ @@ -51,6 +54,11 @@ void ScreenPixelFlip(int x, int y){ Screen.pixels[x+y*64]=0; } +void ScreenWH(int *width, int *height){ + *width=64; + *height=32; +} + void ScreenClose(){ CloseWindow(); // Close window and OpenGL context } |
