diff --git a/engine/core/include/engine.hpp b/engine/core/include/engine.hpp index 2999d3c..b056e74 100755 --- a/engine/core/include/engine.hpp +++ b/engine/core/include/engine.hpp @@ -122,12 +122,14 @@ namespace prism { */ Physics* get_physics(); - /// Creates an empty scene with no path. This will change the current scene. - void create_empty_scene(); + /** Creates an empty scene with no path. This will change the current scene. + * @return Returns a instance of the scene if successful, and nullptr on failure. + */ + Scene* create_empty_scene(); /** Load a scene from disk. This will change the current scene if successful. @param path The scene file path. - @return Returns a instance of the scene is successful, and nullptr on failure. + @return Returns a instance of the scene if successful, and nullptr on failure. */ Scene* load_scene(const prism::path& path); diff --git a/engine/core/src/engine.cpp b/engine/core/src/engine.cpp index 0b936c9..7a41341 100755 --- a/engine/core/src/engine.cpp +++ b/engine/core/src/engine.cpp @@ -139,13 +139,15 @@ Physics* engine::get_physics() { return physics.get(); } -void engine::create_empty_scene() { +Scene* engine::create_empty_scene() { auto scene = std::make_unique(); setup_scene(*scene); scenes.push_back(std::move(scene)); current_scene = scenes.back().get(); + + return current_scene; } Scene* engine::load_scene(const prism::path& path) { diff --git a/example/src/example.cpp b/example/src/example.cpp index 3bbd14b..fa7cbab 100644 --- a/example/src/example.cpp +++ b/example/src/example.cpp @@ -12,8 +12,7 @@ void app_main(prism::engine*) { } void ExampleApp::initialize_render() { - engine->create_empty_scene(); - auto scene = engine->get_scene(); + auto scene = engine->create_empty_scene(); camera_obj = scene->add_object(); auto& camera = scene->add(camera_obj);