Engine::create_empty_scene now returns the Scene it just created
This commit is contained in:
parent
2f0d1aace9
commit
c6da6e05ce
3 changed files with 9 additions and 6 deletions
|
@ -122,12 +122,14 @@ namespace prism {
|
||||||
*/
|
*/
|
||||||
Physics* get_physics();
|
Physics* get_physics();
|
||||||
|
|
||||||
/// Creates an empty scene with no path. This will change the current scene.
|
/** Creates an empty scene with no path. This will change the current scene.
|
||||||
void create_empty_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.
|
/** Load a scene from disk. This will change the current scene if successful.
|
||||||
@param path The scene file path.
|
@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);
|
Scene* load_scene(const prism::path& path);
|
||||||
|
|
||||||
|
|
|
@ -139,13 +139,15 @@ Physics* engine::get_physics() {
|
||||||
return physics.get();
|
return physics.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void engine::create_empty_scene() {
|
Scene* engine::create_empty_scene() {
|
||||||
auto scene = std::make_unique<Scene>();
|
auto scene = std::make_unique<Scene>();
|
||||||
|
|
||||||
setup_scene(*scene);
|
setup_scene(*scene);
|
||||||
|
|
||||||
scenes.push_back(std::move(scene));
|
scenes.push_back(std::move(scene));
|
||||||
current_scene = scenes.back().get();
|
current_scene = scenes.back().get();
|
||||||
|
|
||||||
|
return current_scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
Scene* engine::load_scene(const prism::path& path) {
|
Scene* engine::load_scene(const prism::path& path) {
|
||||||
|
|
|
@ -12,8 +12,7 @@ void app_main(prism::engine*) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExampleApp::initialize_render() {
|
void ExampleApp::initialize_render() {
|
||||||
engine->create_empty_scene();
|
auto scene = engine->create_empty_scene();
|
||||||
auto scene = engine->get_scene();
|
|
||||||
|
|
||||||
camera_obj = scene->add_object();
|
camera_obj = scene->add_object();
|
||||||
auto& camera = scene->add<Camera>(camera_obj);
|
auto& camera = scene->add<Camera>(camera_obj);
|
||||||
|
|
Reference in a new issue