16 个版本
0.3.6 | 2024年7月13日 |
---|---|
0.3.5 | 2024年5月30日 |
0.3.4 | 2024年4月9日 |
0.3.2 | 2023年10月27日 |
0.0.0 |
|
#1670 in 游戏开发
138 每月下载量
用于 2 crates
5MB
113K SLoC
PlayDate 控制API
基于 playdate-sys 的高级控制 API。
涵盖组件:按钮、加速度计和摇杆。
先决条件
- Rust nightly 工具链(rustup 可选)
- Playdate SDK
- 遵循官方文档
- 遵循playdate-sys 说明
使用方法
按钮
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") }
加速度计
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}]");
更多示例请见 此处。
本软件未由 Panic 赞助或支持。