mirror of
https://github.com/MadeOfJelly/MushMachine.git
synced 2025-04-16 16:32:59 +02:00
make scene change take a rvalue
This commit is contained in:
parent
e4b256609a
commit
8c72f4cc36
@ -26,12 +26,12 @@ namespace MM::Services {
|
|||||||
virtual ::MM::Scene& getScene(void) = 0;
|
virtual ::MM::Scene& getScene(void) = 0;
|
||||||
|
|
||||||
// enques a new Scene to be put in place
|
// enques a new Scene to be put in place
|
||||||
virtual void changeScene(std::unique_ptr<::MM::Scene> new_scene) = 0;
|
virtual void changeScene(std::unique_ptr<::MM::Scene>&& new_scene) = 0;
|
||||||
|
|
||||||
// sets the new Scene to be provided.
|
// sets the new Scene to be provided.
|
||||||
// dont use, except for when you know what you are doing!
|
// dont use, except for when you know what you are doing!
|
||||||
// be carefull of that one (lol)
|
// be carefull of that one (lol)
|
||||||
virtual void changeSceneNow(std::unique_ptr<::MM::Scene> new_scene) = 0;
|
virtual void changeSceneNow(std::unique_ptr<::MM::Scene>&& new_scene) = 0;
|
||||||
|
|
||||||
// adds a System to current Scene.
|
// adds a System to current Scene.
|
||||||
// default impl. will use getScene() !
|
// default impl. will use getScene() !
|
||||||
|
@ -72,7 +72,7 @@ void SimpleSceneService::changeSceneFixedUpdate(Engine& engine) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleSceneService::changeScene(std::unique_ptr<Scene> new_scene) {
|
void SimpleSceneService::changeScene(std::unique_ptr<Scene>&& new_scene) {
|
||||||
if (_next_scene) {
|
if (_next_scene) {
|
||||||
LOG_SSS("warn: already next scene enqueued! overwriting...");
|
LOG_SSS("warn: already next scene enqueued! overwriting...");
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@ void SimpleSceneService::changeScene(std::unique_ptr<Scene> new_scene) {
|
|||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleSceneService::changeSceneNow(std::unique_ptr<Scene> new_scene) {
|
void SimpleSceneService::changeSceneNow(std::unique_ptr<Scene>&& new_scene) {
|
||||||
_scene = std::move(new_scene);
|
_scene = std::move(new_scene);
|
||||||
//_scene->set<MM::Engine*>(&engine); // make engine accessible from scene
|
//_scene->set<MM::Engine*>(&engine); // make engine accessible from scene
|
||||||
|
|
||||||
|
@ -25,10 +25,10 @@ namespace MM::Services {
|
|||||||
public:
|
public:
|
||||||
Scene& getScene(void) override { return *_scene; }
|
Scene& getScene(void) override { return *_scene; }
|
||||||
|
|
||||||
void changeScene(std::unique_ptr<Scene> new_scene) override;
|
void changeScene(std::unique_ptr<Scene>&& new_scene) override;
|
||||||
|
|
||||||
// be carefull of that one
|
// be carefull of that one
|
||||||
void changeSceneNow(std::unique_ptr<Scene> new_scene) override;
|
void changeSceneNow(std::unique_ptr<Scene>&& new_scene) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // MM::Services
|
} // MM::Services
|
||||||
|
Loading…
x
Reference in New Issue
Block a user