summaryrefslogtreecommitdiff
path: root/src/screen.c
diff options
context:
space:
mode:
authorLoic Guegan <loic.guegan@mailbox.org>2023-12-25 10:01:40 +0100
committerLoic Guegan <loic.guegan@mailbox.org>2023-12-25 10:01:40 +0100
commit7642efad5ad58c4aec26eec3c8bb879f69272eaf (patch)
treea8af12fc0f51855b6b1b4008453bc91198c096f8 /src/screen.c
parent8fd3d27abe8e5da08ce99adcf02616324eef4e79 (diff)
Minor changes
Diffstat (limited to 'src/screen.c')
-rw-r--r--src/screen.c14
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
}