Files
playdate-kit/Sources/PlaydateKit/Scoreboards/Structures/Score.swift
T

29 lines
879 B
Swift
Raw Normal View History

internal import CPlaydate
extension Scoreboards {
2026-09-18 13:15:08 +00:00
/// A score on a board. Copied from `PDScore` or `PDListScore`.
public struct Score {
2026-09-18 13:15:08 +00:00
/// Position on the board, from 1.
public let rank: UInt32
public let value: UInt32
2026-09-18 13:15:08 +00:00
/// Name of the player who posted it.
public let player: String
2026-09-18 13:15:08 +00:00
/// `nil` if the C API gave none.
public let boardID: String?
init(_ score: PDScore) {
rank = score.rank
value = score.value
player = String(playdateCString: score.player) ?? ""
boardID = String(playdateCString: score.boardID)
}
init(_ score: PDListScore, boardID: String?) {
rank = score.rank
value = score.value
player = String(playdateCString: score.player) ?? ""
self.boardID = boardID
}
}
}