Hall of Fame: Scores, Combos and Leaderboards Kit
README.md
card
The end of run results card a game hands its own numbers to. Card.show(spec) (also Score.showCard(spec)) puts it on this machine's screen: a title and headline, tallies ({ label, value, hint?, unit?, format?, isNew?, countUp? }) that count up from 0, an optional highlight banner, a scoreKit leaderboard (board = { id, view }) and buttons. It arranges itself for the screen (one column, two columns, a 3x3 grid on a short upright phone, the board beside the tallies on landscape) and shrinks to fit by measuring what it drew with ui.getLayoutInfo. Buttons are at least 48 points tall, the primary one takes gamepad focus, and a press calls onButton(id). Card.render(look, spec, { vw, vh, t }) draws the same card for your own UI; Card.fromResults(results) turns a scoreKit round into a spec.
local card = require("scoreKit.score").showCard({
title = "Run complete", headline = "1,240 points",
tallies = { { label = "Distance", value = 412, unit = "m", hint = "how far you got" }, { label = "Coins", value = 48 } },
board = { id = "depth", view = "top10" },
buttons = { { id = "again", label = "Play again", primary = true } },
onButton = function(id) print("pressed", id) end,
})