diff options
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){ |
