Skip to main content

Crate firefly_rust

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.
  • 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 use sudo module. 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 from firefly.tom via firefly_rust::toml module.
  • 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.
PeersIter
Progress
Settings
System settings. Can be requested using get_settings.
Theme
The preferred color scheme of the peer.

Enums§

DPad4
4-directional DPad-like representation of the Pad.
Language

Traits§

AnyPeer
A peer obtained either from Peers (get_peers) or from get_me.

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_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.