Quiz
Quiz
Quiz is a trivia game: four answers A–D, Open Trivia DB questions (with caching), solo or two-player rounds. The phone is the remote; questions can display on TV via AirPlay.
How you play
- Connect + calibrate.
- Open Quiz — pick category, language, solo/duo in the flow.
- Tilt to highlight A–D (
posX→ four slots). - Press the cap button to confirm the highlighted answer (like a remote OK).
- Feedback shows correct/wrong; next question after a short pause.
- Touch on the phone still submits immediately (tap any answer).
Category pick (before the round) uses Triki UI with preferButtonConfirm: true — tilt to focus, button to pick (no hold auto-select).
VeltoKit mapping
| Setting | Value |
|---|---|
MotionMode | .paddle |
| Selection | posX → TrikiSlotMath.slotIndex (4 answers) |
| Confirm | TrikiButtonConfirmGate on primaryAction (BLE edge + ~0.65 s cooldown) |
| Not used | Hold timer, velocity triggers, shotTriggered, sensors.click as confirm |
Same mode as Pong, different game logic — good example of reusing .paddle for menus.
Integrate in your app
let motion = MotionSDK()
motion.setMode(.paddle) // primaryAction = BLE button only in this mode
motion.connect()
var selected = 0
var confirmGate = TrikiButtonConfirmGate() // sample app helper
func tick(dt: TimeInterval) {
let input = motion.pollInput(deltaTime: dt)
let slot = TrikiSlotMath.slotIndex(posX: input.posX, slots: 4)
if slot != selected { selected = slot }
if confirmGate.consume(input: input, deltaTime: dt) {
submit(answer: selected)
}
}
Copy TrikiButtonConfirmGate from app/UI/TrikiUI/ or implement your own edge + cooldown on primaryAction.
Sample app source
| File | Role |
|---|---|
app/Games/QuizGame.swift | Rounds, slot selection, TrikiButtonConfirmGate |
app/UI/TrikiUI/TrikiButtonConfirmGate.swift | Debounced BLE confirm |
app/UI/Quiz/QuizFlowView.swift | Category pick + preferButtonConfirm |
app/UI/QuizGameView.swift | Question UI |
app/UI/Quiz/QuizExternalDisplay.swift | TV / second screen |
app/Quiz/QuizSession.swift | Loader, categories, cache |
TV: Enable AirPlay in the quiz flow; external display shows the question card, phone shows controls only.
Tips
- Tune
lateralDeadzoneif the highlight jitters between A and B — Configuration. - Questions require network on first load; see
QuizCachefor offline rounds.
← Bowling · Triki UI navigation · Configuration · Demo · Help