Crate firefly_rust

Source
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 use FileBuf. Allows the crate to do memory allocations. If you enable alloc but not std, you have to also provide a global allocator. The easiest way to do so is to activate the talc feature (see below).
  • talc: enable a global talc-powered allocator. The same as the alloc feature but you don’t have to configure an allocator yourself.
  • sudo: required if you want to use sudo module. Enables privileged access to the Firefly Zero device.
  • 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.
DPad
DPad-like representation of the Pad.
File
A file loaded from ROM or data dir into the memory.
Font
A loaded font file.
Pad
A finger position on the touch pad.
Peer
Peers
The list of peers online.
PeersIter
Progress

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_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.
load_file
Read the whole file with the given name into the given buffer.
load_stash
Read the stash of the given peer using the passed buffer.
load_stash_buf
Similar to load_stash but 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.