1

Embed assets into executable

This commit is contained in:
2024-10-06 03:13:41 +02:00
parent a4bde0ec2e
commit a7f1d3e65c
3 changed files with 30 additions and 12 deletions

30
Cargo.lock generated
View File

@ -177,6 +177,7 @@ name = "ant_sim"
version = "0.1.0"
dependencies = [
"bevy",
"bevy_embedded_assets",
"rand",
]
@ -309,7 +310,6 @@ version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "043c9ad4b6fc4ca52d779873a8ca792a4e37842d07fce95363c9e17e36a1d8a0"
dependencies = [
"bevy_dylib",
"bevy_internal",
]
@ -517,15 +517,6 @@ dependencies = [
"sysinfo",
]
[[package]]
name = "bevy_dylib"
version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c399292fac67682a72666e78872626f3c1c39b34c430b6f02c81d21da91b500"
dependencies = [
"bevy_internal",
]
[[package]]
name = "bevy_ecs"
version = "0.14.2"
@ -559,6 +550,19 @@ dependencies = [
"syn 2.0.79",
]
[[package]]
name = "bevy_embedded_assets"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3f3e7b41a9b01b767ba07c4ebb083b2d8d8055e57ddef7e55e502bbfc961505"
dependencies = [
"bevy",
"cargo-emit",
"futures-io",
"futures-lite",
"thiserror",
]
[[package]]
name = "bevy_encase_derive"
version = "0.14.2"
@ -1291,6 +1295,12 @@ dependencies = [
"wayland-client",
]
[[package]]
name = "cargo-emit"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1582e1c9e755dd6ad6b224dcffb135d199399a4568d454bd89fe515ca8425695"
[[package]]
name = "cc"
version = "1.1.24"

View File

@ -4,7 +4,9 @@ version = "0.1.0"
edition = "2021"
[dependencies]
bevy = { version = "0.14.2", features = ["wayland", "dynamic_linking"] }
# bevy = { version = "0.14.2", features = ["wayland", "dynamic_linking"] }
bevy = { version = "0.14.2", features = ["wayland"] }
bevy_embedded_assets = "0.11.0"
rand = "0.8.5"
# Enable a small amount of optimization in the dev profile.

View File

@ -2,6 +2,7 @@ mod components;
mod systems;
use bevy::prelude::*;
use bevy_embedded_assets::EmbeddedAssetPlugin;
use std::f32::consts::PI;
use systems::{
ant::{
@ -30,7 +31,12 @@ fn main() {
// The DefaultPlugins contain the "Window" plugin.
// ImagePlugin::default_nearest() is supposed to prevent blurry sprites.
app.add_plugins(DefaultPlugins.set(ImagePlugin::default_nearest()));
app.add_plugins((
EmbeddedAssetPlugin {
mode: bevy_embedded_assets::PluginMode::ReplaceDefault,
},
DefaultPlugins.set(ImagePlugin::default_nearest()),
));
// Sets the color used to clear the screen, i.e. the background color.
app.insert_resource(ClearColor(Color::srgb(0.9, 0.9, 0.9)));