Crates.io | crankstart |
lib.rs | crankstart |
version | 0.1.2 |
source | src |
created_at | 2020-06-17 22:52:04.694318 |
updated_at | 2023-09-04 06:35:16.137878 |
description | A barely functional, wildly incomplete and basically undocumented Rust crate whose aim is to let you write games for the [Playdate handheld gaming system](https://play.date) in [Rust](https://www.rust-lang.org). |
homepage | |
repository | https://github.com/pd-rs/crankstart |
max_upload_size | |
id | 255106 |
size | 132,842 |
You've stumbled across a barely functional, wildly incomplete and basically undocumented Rust crate whose aim is to let you write games for the Playdate handheld gaming system in Rust.
This software is not sponsored or supported by Panic.
To use this crate, you'll also need to install the crank command line tool.
From the crankstart directory where you found this README,
crank run --release --example hello_world
Should launch the simulator and load in the hello_world sample.
If you have a device attached to your desktop,
crank run --release --example hello_world --device
Should launch the hello_world sample on the device.
For the sprite_game example one needs to copy the images folder from "PlaydateSDK/C_API/Examples/Sprite Game/Source/images"
to "sprite_game_images"
.
Using this system for your own project requires some setup:
crank
with Rust nightly's no_std
support.cargo new --lib project_name
git clone git@github.com:pd-rs/crankstart.git
at the same depth as your new project.Cargo.toml
:[package.metadata.cargo-xbuild]
memcpy = false
sysroot_path = "target/sysroot"
panic_immediate_abort = false
[profile.dev]
panic = "abort"
opt-level = 'z'
lto = true
[profile.release]
panic = "abort"
opt-level = 'z'
lto = true
[lib]
crate-type = ["staticlib", "cdylib"]
[dependencies]
crankstart = { path = "../crankstart" }
crankstart-sys = { path = "../crankstart/crankstart-sys" }
anyhow = { version = "1.0.31", default-features = false }
euclid = { version = "0.20.13", default-features = false, features = [ "libm" ] }
hashbrown = "0.7.2"
heapless = "0.5.5"
[dependencies.cstr_core]
version = "=0.1.2"
default-features = false
features = [ "alloc" ]
Crank.toml
at the same level as your Cargo.toml
, with this minimum:[[target]]
name = "project_name"
assets = [
]
assets
should be a list of paths to any/all assets you need copied into your project, such as sprites, music, etc.
lib.rs
, you only need to implement the crankstart::Game
trait to your game's core state struct, then call crankstart::crankstart_game!
on that struct. See the examples
folder for examples.crank run
successfully!If you want an example of an independent project following these conventions, go check out Nine Lives.
If there's a newer Playdate SDK available that updates the C API, the crankstart bindings should be updated to match. Here's a guide.
glibc-devel-32bit
.PLAYDATE_SDK_PATH
to where you unzipped it. (This should be the directory that contains C_API
, CoreLibs
, etc.)./scripts/generate_bindings.sh
crankstart-sys/src/bindings_*
- they should reflect the updates to the Playdate C API. If nothing changed, double-check that the C API actually changed and not just the Lua API.