15 releases
0.0.15 | Sep 20, 2023 |
---|---|
0.0.14 | Sep 18, 2023 |
0.0.10 | Aug 29, 2023 |
#161 in Embedded development
312 downloads per month
470KB
13K
SLoC
playdate-rs
Note: Prior to reaching v0.1.0, this is a work in progress. The API is incomplete, and breaking changes can occur frequently across versions.
Safe binding for the Playdate SDK C-API that:
- Is easy to use and well documented.
- Designed with memory safety in mind.
Only works on Linux/macOS with the playdate simulator for now.
Getting Started
- Ensure that the environment variable
PLAYDATE_SDK_PATH
is correctly set.- Skip this step on macOS, as the crate will automatically find the SDK by checking the default installation location.
- Install the CLI tool:
cargo install playdate-cli
- Create a new project:
cargo playdate new hello-world
- Run the project:
cd hello-world && cargo playdate run
Please refer to Playdate CLI docs for all the available CLI commands.
Application Bundling
The cargo playdate build
command will automatically create a target/<profile>/<package_name>.pdx
folder that can run on the simulator. For the device build, it will be located at target/thumbv7em-none-eabihf/<profile>/<package_name>.pdx
.
Game assets bundling
Please put all assets files under the assets
folder in the project's root directory (the folder containing Cargo.toml
). The CLI will automatically copy all contents to the .pdx
folder. All supported resources will be transformed by the pdc
compiler.
For more details, please refer to the examples/hello-world project.
pdxinfo
generation and bundling
The CLI will automatically generate a pdxinfo
file under the .pdx
folder. There are two ways to set the content of the pdxinfo
file:
- Create a pdxinfo file in the project's root directory (the folder containing
Cargo.toml
). The CLI will automatically pick it up. - Create a
[package.metadata.pdxinfo]
section inCargo.toml
:
[package.metadata.pdxinfo]
name = "Your game name" # Default value: package.name
author = "Your Name" # Default value: package.authors
description = "Your game description" # Default value: package.description
bundle_id = "com.your-game.bundle-id" # Default value: "com.example." + package.name
image_path = "image/path" # Default value: empty string
launch_sound_path = "launch/sound/path" # Default value: empty string
content_warning = "Content warning" # Default value: empty string
content_warning2 = "Content warning 2" # Default value: empty string
Note that all fields in [package.metadata.pdxinfo]
are optional. The default value will be derived from other fields in Cargo.toml
. Please refer to the # Default value
comments above.
Example: examples/hello-world/Cargo.toml.
TODO
- Linux / macOS simulator build
- Cortex-M7F build
- Run on real playdate device
- Support all public PlaydateSDK C-API
Dependencies
~1.3–4.5MB
~76K SLoC