From bf4f9c3aec76edc7d1ed9daacb83c652b1ad2dd9 Mon Sep 17 00:00:00 2001 From: Samuele Zolfanelli Date: Sat, 12 Oct 2024 02:36:07 +0200 Subject: [PATCH] Fix setStencilImage not able to set stencil to nil, give default value to tile argument --- src/playdate/graphics.nim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/playdate/graphics.nim b/src/playdate/graphics.nim index 5691420..76f877f 100644 --- a/src/playdate/graphics.nim +++ b/src/playdate/graphics.nim @@ -411,9 +411,12 @@ proc set*(this: var LCDBitmap, x, y: int, color: LCDSolidColor = kColorBlack) = var data = this.getData data.set(x, y, color) -proc setStencilImage*(this: ptr PlaydateGraphics, bitmap: LCDBitmap, tile: bool) = +proc setStencilImage*(this: ptr PlaydateGraphics, bitmap: LCDBitmap, tile: bool = false) = privateAccess(PlaydateGraphics) - this.setStencilImage(bitmap.resource, if tile: 1 else: 0) + if bitmap == nil: + this.setStencilImage(nil, if tile: 1 else: 0) + else: + this.setStencilImage(bitmap.resource, if tile: 1 else: 0) proc makeFont*(this: LCDFontData, wide: bool): LCDFont = privateAccess(PlaydateGraphics)