Skip to content

Commit

Permalink
Default to UTF8 when drawing text
Browse files Browse the repository at this point in the history
  • Loading branch information
Nycto committed Nov 26, 2023
1 parent c7d9bac commit 065a063
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/playdate/graphics.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 065a063

Please sign in to comment.