Expand description
§firefly-rust
Rust SDK for making Firefly Zero games.
§Installation
cargo add firefly_rust§Cargo features
std: required if you don’t build your project with#![no_std]. It will remove from the crate the custom panic handler to avoid conflicts with the standard library.alloc: required if you want to useFileBuf. Allows the crate to do memory allocations. If you enableallocbut notstd, you have to also provide a global allocator. The easiest way to do so is to activate thetalcfeature (see below).talc: enable a global talc-powered allocator. The same as theallocfeature but you don’t have to configure an allocator yourself.panic-info: if app panics, show panic info (message, file name, line number). Very useful for debugging but significantly increases the binary size.sudo: required if you want to usesudomodule. Enables privileged access to the Firefly Zero device.firefly-toml: use firefly-toml macro. Activating the feature will provide static access to boards, badges, cheats, and other data fromfirefly.tomviafirefly_rust::tomlmodule.nalgebra: can be activated if you use nalgebra. Enables type conversion to and from nalgebra vectors.
§License
MIT License. You can do whatever you want with the SDK, modify it, embed into any apps and games. Have fun!
Re-exports§
pub use graphics::*;
Modules§
- audio
- graphics
- Draw shapes, images, and text on the screen.
- math
- A few useful math (trigonometric) functions for f32.
- shapes
- Structs for working with shapes as values.
Structs§
- Badge
- Board
- Buttons
- State of the buttons.
- DPad8
- 8-directional DPad-like representation of the
Pad. - File
- A file loaded from ROM or data dir into the memory.
- FileBuf
- Like File but owns the buffer.
- Me
- The peer representing the current device.
- Pad
- A finger position on the touch pad.
- Peer
- The peer ID.
- Peers
- The list of peers online.
- Peers
Iter - Progress
- Settings
- System settings. Can be requested using
get_settings. - Theme
- The preferred color scheme of the peer.
Enums§
Traits§
Functions§
- add_
menu_ item - Add a custom item on the app menu.
- add_
progress - Add the given value to the progress for the badge.
- add_
score - Add the given score to the board.
- dump_
file - Write the buffer into the given file in the data dir.
- get_
file_ size - Get a file size in the data dir.
- get_me
- Get the peer corresponding to the local device.
- get_
name - Get the Peer’s name.
- get_
name_ buf - Get the Peer’s name.
- get_
peers - Get the list of peers online.
- get_
progress - Get the progress of earning the badge.
- get_
random - Get a random value.
- get_
score - Get the personal best of the player.
- get_
settings - Get the peer’s system settings.
- load_
file - Read the whole file with the given name into the given buffer.
- load_
file_ buf - Read the whole file with the given name.
- load_
stash - Read the stash of the given peer using the passed buffer.
- load_
stash_ buf - Similar to
load_stashbut statically allocates the stash of the right size. - log_
debug - Log a debug message.
- log_
error - Log an error message.
- open_
menu - Open the app menu.
- quit
- Exit the app after the current update is finished.
- read_
buttons - Get the currently pressed buttons.
- read_
pad - Get the current touch pad state.
- remove_
file - Remove file (if exists) with the given name from the data dir.
- remove_
menu_ item - Remove a custom menu item with the given index.
- save_
stash - Save the given [
Stash]. - set_
seed - Set the random seed.