| Crates.io | playdate-controls |
| lib.rs | playdate-controls |
| version | 0.3.9 |
| created_at | 2023-09-08 13:01:36.37918+00 |
| updated_at | 2025-03-19 17:20:51.116338+00 |
| description | High-level controls API built on-top of Playdate API |
| homepage | https://github.com/boozook/playdate |
| repository | https://github.com/boozook/playdate.git |
| max_upload_size | |
| id | 967089 |
| size | 58,054 |
High-level controls API built on-top of playdate-sys.
Covered components: buttons, accelerometer and crank.
⚠️ Prior to the version 1.0 API is unstable and can be changed without deprecation period.
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.