Allows to start multiple scenes at editor start up

This commit is contained in:
Daniel Simon
2024-01-18 21:08:33 +01:00
parent 6af00df1a9
commit 077ba35a2b
2 changed files with 7 additions and 5 deletions
+6 -4
View File
@@ -274,14 +274,13 @@ pub struct GameLoopData {
clock: Instant,
lag: f32,
}
pub struct StartupData {
/// Working directory that should be set when starting the editor. If it is empty, then
/// current working directory won't be changed.
pub working_directory: PathBuf,
/// A scene to load at the editor start. If it is empty, no scene will be loaded.
pub scene: PathBuf,
pub scenes: Vec<PathBuf>,
}
#[derive(Debug)]
@@ -921,9 +920,12 @@ impl Editor {
},
});
if data.scene != PathBuf::default() {
editor.message_sender.send(Message::LoadScene(data.scene));
for scene in data.scenes {
if scene != PathBuf::default() {
editor.message_sender.send(Message::LoadScene(scene));
}
}
} else {
// Open configurator as usual.
editor
+1 -1
View File
@@ -418,7 +418,7 @@ fn main() {{
&event_loop,
Some(StartupData {{
working_directory: Default::default(),
scene: "data/scene.rgs".into(),
scenes: vec!["data/scene.rgs".into()],
}}),
);
editor.add_game_plugin(GameConstructor);