Skip to content

Commit

Permalink
REFACTOR merge type blocks in scoreboard bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
ninovanhooff committed Oct 25, 2024
1 parent 89275b2 commit 29a87f1
Showing 1 changed file with 33 additions and 30 deletions.
63 changes: 33 additions & 30 deletions src/playdate/bindings/scoreboards.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,39 @@

import utils

type PDScoreRaw* {.importc: "PDScore", header: "pd_api.h", bycopy.} = object
rank* {.importc: "rank".}: cuint
value* {.importc: "value".}: cuint
player* {.importc: "player".}: cstring

type PDScorePtr* = ptr PDScoreRaw

type PDScoresListRaw* {.importc: "PDScoresList", header: "pd_api.h", bycopy.} = object
boardID* {.importc: "boardID".}: cstring
count* {.importc: "count".}: cuint
lastUpdated* {.importc: "lastUpdated".}: cuint
playerIncluded* {.importc: "playerIncluded".}: cuint
limit* {.importc: "limit".}: cuint
scores* {.importc: "scores".}: ptr UncheckedArray[PDScoreRaw]
type PDScoresListPtr* = ptr PDScoresListRaw

type PDBoardRaw* {.importc: "PDBoard", header: "pd_api.h", bycopy.} = object
boardID* {.importc: "boardID".}: cstring
name* {.importc: "name".}: cstring

type PDBoardsListRaw* {.importc: "PDBoardsList", header: "pd_api.h", bycopy.} = object
count* {.importc: "count".}: cuint
lastUpdated* {.importc: "lastUpdated".}: cuint
boards* {.importc: "boards".}: ptr UncheckedArray[PDBoardRaw]
type PDBoardsListPtr* = ptr PDBoardsListRaw

type PersonalBestCallbackRaw* {.importc: "PersonalBestCallback", header: "pd_api.h".} = proc (score: PDScorePtr; errorMessage: cstring) {.cdecl.}
type AddScoreCallbackRaw* {.importc: "AddScoreCallback", header: "pd_api.h".} = proc (score: PDScorePtr; errorMessage: cstring) {.cdecl.}
type BoardsListCallbackRaw* = proc (boards: ptr PDBoardsListRaw; errorMessage: cstring) {.cdecl.}
type ScoresCallbackRaw* = proc (scores: ptr PDScoresListRaw; errorMessage: cstring) {.cdecl.}
type
PDScoreRaw* {.importc: "PDScore", header: "pd_api.h", bycopy.} = object
rank* {.importc: "rank".}: cuint
value* {.importc: "value".}: cuint
player* {.importc: "player".}: cstring

PDScorePtr* = ptr PDScoreRaw

PDScoresListRaw* {.importc: "PDScoresList", header: "pd_api.h", bycopy.} = object
boardID* {.importc: "boardID".}: cstring
count* {.importc: "count".}: cuint
lastUpdated* {.importc: "lastUpdated".}: cuint
playerIncluded* {.importc: "playerIncluded".}: cuint
limit* {.importc: "limit".}: cuint
scores* {.importc: "scores".}: ptr UncheckedArray[PDScoreRaw]

PDScoresListPtr* = ptr PDScoresListRaw

PDBoardRaw* {.importc: "PDBoard", header: "pd_api.h", bycopy.} = object
boardID* {.importc: "boardID".}: cstring
name* {.importc: "name".}: cstring

PDBoardsListRaw* {.importc: "PDBoardsList", header: "pd_api.h", bycopy.} = object
count* {.importc: "count".}: cuint
lastUpdated* {.importc: "lastUpdated".}: cuint
boards* {.importc: "boards".}: ptr UncheckedArray[PDBoardRaw]

PDBoardsListPtr* = ptr PDBoardsListRaw

PersonalBestCallbackRaw* {.importc: "PersonalBestCallback", header: "pd_api.h".} = proc (score: PDScorePtr; errorMessage: cstring) {.cdecl.}
AddScoreCallbackRaw* {.importc: "AddScoreCallback", header: "pd_api.h".} = proc (score: PDScorePtr; errorMessage: cstring) {.cdecl.}
BoardsListCallbackRaw* = proc (boards: ptr PDBoardsListRaw; errorMessage: cstring) {.cdecl.}
ScoresCallbackRaw* = proc (scores: ptr PDScoresListRaw; errorMessage: cstring) {.cdecl.}

sdktype:
type PlaydateScoreboards* {.importc: "const struct playdate_scoreboards", header: "pd_api.h".} = object
Expand Down

0 comments on commit 29a87f1

Please sign in to comment.