Skip to content

Commit

Permalink
ADD getBitmapTableInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
ninovanhooff committed Sep 6, 2024
1 parent 13a06b2 commit 0f81864
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/playdate/bindings/graphics.nim
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ sdktype:
table: LCDBitmapTablePtr; outerr: ptr cstring) {.cdecl, raises: [].}
getTableBitmap {.importc: "getTableBitmap".}: proc (table: LCDBitmapTablePtr;
idx: cint): LCDBitmapPtr {.cdecl, raises: [].}
getBitmapTableInfo {.importc: "getBitmapTableInfo".}: proc (table: LCDBitmapTablePtr;
outCount: ptr cint; outCellsWide: ptr cint) {.cdecl, raises: [].}

loadFont {.importc: "loadFont".}: proc (path: cstring, outErr: ptr cstring): LCDFontPtr {.cdecl, raises: [].}

Expand Down
6 changes: 6 additions & 0 deletions src/playdate/graphics.nim
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,12 @@ proc getBitmap*(this: LCDBitmapTable, index: int): LCDBitmap =
return LCDTableBitmap(resource: resource, free: false, table: this)
return nil

proc getBitmapTableInfo*(this: LCDBitmapTable): tuple[count: int, cellsWide: int] =
privateAccess(PlaydateGraphics)
var count, cellsWide: cint
playdate.graphics.getBitmapTableInfo(this.resource, addr(count), addr(cellsWide))
return (count.int, cellsWide.int)

proc newFont*(this: ptr PlaydateGraphics, path: string): LCDFont {.raises: [IOError]} =
privateAccess(PlaydateGraphics)
privateAccess(LCDFont)
Expand Down

0 comments on commit 0f81864

Please sign in to comment.