Refactor entry-point functions (#26)

This PR refactors the `studio` project's entry-point functions for
better maintainability and ease of use for local development.

### Overview
* `start_internal` refactored to return a `bevy::app::App` instead of
  calling `App::run`, allowing for finer-grained configuration of unique
  use cases
* Temporary `start` function added for WASM
* `init` function removed
* `main` standalone entry-point refactored to call `start_internal`

### Fixes
* Crash on non-WASM builds due to missing `StudioMode` resource
* Warning on non-WASM builds due to an unused variable
This commit is contained in:
Danny McGee
2024-01-18 15:52:33 -05:00
committed by GitHub
parent 5f62a4024b
commit cc00f197dc
3 changed files with 50 additions and 68 deletions
+17 -1
View File
@@ -1,3 +1,19 @@
use bevy::{app::Update, window::close_on_esc};
use studio::{StudioMode, ViewportSize};
fn main() {
studio::init(Default::default());
// Edit the arguments here to change the default startup scene or skybox
let mut app = studio::start_internal(
"sample-room",
"gum_trees_4k",
"", // ignored for non-WASM
"Storyteller Studio",
ViewportSize::default(),
StudioMode::Editor,
);
// Add any additional systems, resources, etc. for local debugging
app.add_systems(Update, close_on_esc);
app.run();
}