diff options
| author | Loic Guegan <loic.guegan@mailbox.org> | 2023-12-25 15:59:36 +0100 |
|---|---|---|
| committer | Loic Guegan <loic.guegan@mailbox.org> | 2023-12-25 15:59:36 +0100 |
| commit | 9550924042ced02c94ddc2af501f135a9f31d492 (patch) | |
| tree | 8bd53f8aa18ccfc8e4133a4e591cbd0ce3042578 /src/screen.c | |
| parent | c6ddcbe2bd529f2310e312559556aedbf896ec33 (diff) | |
Minor changes
Diffstat (limited to 'src/screen.c')
| -rw-r--r-- | src/screen.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/screen.c b/src/screen.c index f4eb7ae..fa4a9c4 100644 --- a/src/screen.c +++ b/src/screen.c @@ -41,10 +41,20 @@ void ScreenUpdate(){ } 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; + char flag=0; + + // Toggle pixel if state is on + if(state){ + if(Screen.pixels[x+y*64]){ + Screen.pixels[x+y*64]=0; + flag=1; + } + else{ + Screen.pixels[x+y*64]=1; + } + } + + return flag; } void ScreenPixelFlip(int x, int y){ |
