fix(app): point AssetPlugin at workspace assets dir
Bevy resolves AssetPlugin::file_path relative to the binary's
CARGO_MANIFEST_DIR (solitaire_app/), but the assets/ directory lives at
the workspace root. After the switch to AssetServer in fbe984c, every
card face, back, background, and font load failed with "Path not found:
.../solitaire_app/assets/..." and the renderer fell back to Text2d
rank+suit placeholders.
Override file_path to "../assets" so cargo run -p solitaire_app from
anywhere finds the real artwork at <workspace>/assets/. Shipping a
release binary will need to either set the override differently or copy
assets/ next to the binary; that is left for whoever ships first.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+20
-10
@@ -30,19 +30,29 @@ fn main() {
|
|||||||
|
|
||||||
App::new()
|
App::new()
|
||||||
.add_plugins(
|
.add_plugins(
|
||||||
DefaultPlugins.set(WindowPlugin {
|
DefaultPlugins
|
||||||
primary_window: Some(Window {
|
.set(WindowPlugin {
|
||||||
title: "Solitaire Quest".into(),
|
primary_window: Some(Window {
|
||||||
resolution: (1280u32, 800u32).into(),
|
title: "Solitaire Quest".into(),
|
||||||
resize_constraints: bevy::window::WindowResizeConstraints {
|
resolution: (1280u32, 800u32).into(),
|
||||||
min_width: 800.0,
|
resize_constraints: bevy::window::WindowResizeConstraints {
|
||||||
min_height: 600.0,
|
min_width: 800.0,
|
||||||
|
min_height: 600.0,
|
||||||
|
..default()
|
||||||
|
},
|
||||||
..default()
|
..default()
|
||||||
},
|
}),
|
||||||
|
..default()
|
||||||
|
})
|
||||||
|
// The `assets/` directory lives at the workspace root, but
|
||||||
|
// Bevy resolves `AssetPlugin::file_path` relative to the
|
||||||
|
// binary package's `CARGO_MANIFEST_DIR` (`solitaire_app/`).
|
||||||
|
// Point one level up so `cargo run -p solitaire_app` finds
|
||||||
|
// card faces, backs, backgrounds, and the UI font.
|
||||||
|
.set(bevy::asset::AssetPlugin {
|
||||||
|
file_path: "../assets".to_string(),
|
||||||
..default()
|
..default()
|
||||||
}),
|
}),
|
||||||
..default()
|
|
||||||
}),
|
|
||||||
)
|
)
|
||||||
.add_plugins(FontPlugin)
|
.add_plugins(FontPlugin)
|
||||||
.add_plugins(GamePlugin)
|
.add_plugins(GamePlugin)
|
||||||
|
|||||||
Reference in New Issue
Block a user