From 065a0636a6d435fcfc06dac7ce3d0b3d753e2e61 Mon Sep 17 00:00:00 2001 From: Nycto Date: Sat, 25 Nov 2023 15:22:39 -0800 Subject: [PATCH] Default to UTF8 when drawing text --- src/playdate/graphics.nim | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/playdate/graphics.nim b/src/playdate/graphics.nim index 8e70248..eb86a76 100644 --- a/src/playdate/graphics.nim +++ b/src/playdate/graphics.nim @@ -94,9 +94,14 @@ proc drawScaled*(this: LCDBitmap, x: int, y: int, xScale: float, yScale: float) privateAccess(PlaydateGraphics) playdate.graphics.drawScaledBitmap(this.resource, x.cint, y.cint, xScale.cfloat, yScale.cfloat) -proc drawText*(this: ptr PlaydateGraphics, text: string, x: int, y: int): int {.discardable.} = - privateAccess(PlaydateGraphics) - return playdate.graphics.drawText(text.cstring, len(text).csize_t, kASCIIEncoding, x.cint, y.cint).int +proc drawText*( + this: ptr PlaydateGraphics; + text: string; + x, y: int; + encoding: PDStringEncoding = kUTF8Encoding +): int {.discardable.} = + privateAccess(PlaydateGraphics) + return playdate.graphics.drawText(text.cstring, len(text).csize_t, encoding, x.cint, y.cint).int proc newBitmap*(this: ptr PlaydateGraphics, width: int, height: int, color: LCDColor): LCDBitmap = privateAccess(PlaydateGraphics)