#playdate-sdk #control-api #playdate #api #sdk #gamedev #api-bindings

nightly no-std playdate-controls

High-level controls API built on-top of Playdate API

14 releases

0.3.4 Apr 9, 2024
0.3.3 Apr 1, 2024
0.3.2 Oct 27, 2023
0.3.0 Sep 30, 2023
0.0.0 Sep 8, 2023

#1340 in Game dev

Download history 3/week @ 2024-02-13 38/week @ 2024-02-20 14/week @ 2024-02-27 6/week @ 2024-03-05 16/week @ 2024-03-12 4/week @ 2024-03-19 53/week @ 2024-03-26 104/week @ 2024-04-02 149/week @ 2024-04-09

311 downloads per month
Used in 2 crates

MIT/Apache

15MB
332K SLoC

Controls API for PlayDate

High-level controls API built on-top of playdate-sys.

Covered components: buttons, accelerometer and crank.

Prerequisites

  1. Rust nightly toolchain (rustup is optional)
  2. Playdate SDK
  3. Follow the official documentation
  4. Follow the instructions for playdate-sys

Usage

Buttons:

extern crate playdate_controls as controls;

// Get buttons state
let buttons = controls::peripherals::Buttons::get();

if buttons.current.a() { println("button A currently is DOWN") }
if buttons.pushed.b() { println("button B was pushed") }
if buttons.released.b() { println("button B was released") }

Accelerometer:

extern crate playdate_controls as controls;

// Turn on the accelerometer
controls::peripherals::Accelerometer::enable();

// Get accelerometer data
let (x, y, z) = controls::peripherals::Accelerometer::get();
println!("[{x:.2},{y:.2},{z:.2}]");

See more in examples.


This software is not sponsored or supported by Panic.

Dependencies