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 2023年9月8日

#1670 in 游戏开发

Download history 149/week @ 2024-04-09 1/week @ 2024-05-14 9/week @ 2024-05-21 165/week @ 2024-05-28 13/week @ 2024-06-04 6/week @ 2024-06-11 19/week @ 2024-07-02 110/week @ 2024-07-09 9/week @ 2024-07-16

138 每月下载量
用于 2 crates

MIT/Apache

5MB
113K SLoC

PlayDate 控制API

基于 playdate-sys 的高级控制 API。

涵盖组件:按钮、加速度计和摇杆。

先决条件

  1. Rust nightly 工具链(rustup 可选)
  2. Playdate SDK
  3. 遵循官方文档
  4. 遵循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 赞助或支持。

依赖项