A collection of helper crates for Bevy game development. These tools provide asset management, code generation, and UI utilities.
Note: This package is not yet published to crates.io. You must import it via Git.
Add the following to your Cargo.toml:
[dependencies]
assets_generator = { git = "https://codeberg.org/dracks/bevy_tools.git" }
assets_helper = { git = "https://codeberg.org/dracks/bevy_tools.git" }
ui_helpers = { git = "https://codeberg.org/dracks/bevy_tools.git" }Step 1: Create a build.rs file:
use assets_generator::build_assets_enum;
use std::path::Path;
fn main() {
build_assets_enum(&Path::new("src").join("assets.rs"), None, None);
}This scans your assets/ folder and generates an enum with all your assets.
Step 2: Use the generated enum in your code:
use bevy::prelude::*;
use crate::assets::FileAssets;
fn load_player(mut commands: Commands, asset_server: Res<AssetServer>) {
let handle: Handle<Image> = FileAssets::PlayerPng.load(&asset_server);
commands.spawn(Sprite { image: handle, ..default() });
}Step 1: Add the plugin to handle automatic state switching:
.add_plugins(LoadingPlugin::<AppState>::new())Step 2: Insert the LoadFiles resource with assets to load and minimum display time:
let mut load_files = LoadFiles::default();
load_files.push_asset(FileAssets::PlayerPng.load::<Image>(&asset_server));
// Or wait a fixed duration: LoadFiles::from_duration(3.0)
commands.insert_resource(load_files);Step 3: Add the Loading component to specify which state to transition to when complete:
commands.spawn((
LoadingMarker,
Loading::new(AppState::MainMenu), // Jumps to MainMenu when loading completes
Text::new("Loading..."),
));| Crate | Description |
|---|---|
assets_generator |
Auto-generates Rust enums from your assets folder |
assets_helper |
Provides AssetsTrait for type-safe asset loading |
ui_helpers |
Loading screens, button interactions, and menu utilities |
- Loading Screen: See
examples/loader.rs
See the LICENSE file.