feat: complete M2 content workspace and inspector

This commit is contained in:
Rbanh committed 2026-07-17 23:40:49 -04:00
1 parent 931f561e7f
commit cf6eaba534
438 files changed
+59749 -19043

No files matched your search

+31 -3
View File
@@ -6,7 +6,10 @@ use bevy::app::PluginGroupBuilder;
use bevy::asset::AssetPlugin;
use bevy::log::{LogPlugin, DEFAULT_FILTER};
use bevy::prelude::*;
use bevy::window::{CompositeAlphaMode, ExitCondition, PresentMode, WindowMode, WindowPlugin};
use bevy::window::{
CompositeAlphaMode, ExitCondition, PresentMode, WindowMode, WindowPlugin,
WindowResizeConstraints,
};
/// Runtime switch for the HDR camera pass.
///
@@ -53,13 +56,30 @@ pub fn editor_plugins(title: impl Into<String>) -> PluginGroupBuilder {
fn editor_window_plugin(title: impl Into<String>) -> WindowPlugin {
WindowPlugin {
primary_window: Some(primary_window(title)),
primary_window: Some(editor_window(title)),
exit_condition: ExitCondition::DontExit,
close_when_requested: false,
..default()
}
}
fn editor_window(title: impl Into<String>) -> Window {
Window {
// A FIFO swapchain can spend roughly one second in each texture
// acquisition while an NVIDIA Wayland window is being interactively
// resized. Repeated acquire timeouts make the editor appear frozen.
// Prefer Immediate/Mailbox for the authoring host while retaining the
// normal VSync contract for packaged game windows.
present_mode: PresentMode::AutoNoVsync,
resize_constraints: WindowResizeConstraints {
min_width: 960.0,
min_height: 620.0,
..default()
},
..primary_window(title)
}
}
fn configured_plugins(window_plugin: WindowPlugin) -> PluginGroupBuilder {
DefaultPlugins
.set(LogPlugin {
@@ -105,7 +125,7 @@ pub fn hdr_enabled_from_env() -> bool {
#[cfg(test)]
mod tests {
use super::{editor_window_plugin, primary_window, resolve_assets_directory};
use bevy::window::{CompositeAlphaMode, ExitCondition};
use bevy::window::{CompositeAlphaMode, ExitCondition, PresentMode};
#[test]
fn primary_window_is_opaque() {
@@ -113,6 +133,7 @@ mod tests {
assert!(!window.transparent);
assert_eq!(window.composite_alpha_mode, CompositeAlphaMode::Opaque);
assert_eq!(window.present_mode, PresentMode::AutoVsync);
}
#[test]
@@ -121,6 +142,13 @@ mod tests {
assert!(!plugin.close_when_requested);
assert!(matches!(plugin.exit_condition, ExitCondition::DontExit));
assert_eq!(
plugin
.primary_window
.expect("editor primary window")
.present_mode,
PresentMode::AutoNoVsync
);
}
#[test]
+7 -4
View File
@@ -56,7 +56,10 @@ pub struct GameSceneBootstrap {
pub defer_default_level: bool,
}
#[cfg(not(feature = "hot-reload"))]
// Unit tests exercise the deterministic in-process systems even when Cargo's all-feature gate
// enables `hot-reload`; the test binary does not publish the separate `libgame_hot` dylib watched
// by hot-lib-reloader.
#[cfg(any(not(feature = "hot-reload"), test))]
mod systems {
pub use game_hot::{
apply_ambient_light, apply_player_intent, grab_cursor, move_and_slide,
@@ -67,7 +70,7 @@ mod systems {
};
}
#[cfg(feature = "hot-reload")]
#[cfg(all(feature = "hot-reload", not(test)))]
mod systems {
pub use crate::hot::{
apply_ambient_light, apply_player_intent, grab_cursor, move_and_slide,
@@ -78,7 +81,7 @@ mod systems {
};
}
#[cfg(feature = "hot-reload")]
#[cfg(all(feature = "hot-reload", not(test)))]
#[hot_lib_reloader::hot_module(dylib = "game_hot", lib_dir = concat!(env!("CARGO_MANIFEST_DIR"), "/../../target/debug"))]
mod hot {
use avian3d::prelude::*;
@@ -113,7 +116,7 @@ mod hot {
pub fn subscribe() -> hot_lib_reloader::LibReloadObserver {}
}
#[cfg(feature = "hot-reload")]
#[cfg(all(feature = "hot-reload", not(test)))]
pub fn hot_reload_subscribe() -> hot_lib_reloader::LibReloadObserver {
hot::subscribe()
}