mirror of
https://github.com/MadeOfJelly/MushMachine.git
synced 2025-06-19 11:16:37 +02:00
remove simple scene and disable most stuff that used it. TODO: replace with organizer
This commit is contained in:
@ -15,7 +15,6 @@ add_library(engine
|
||||
src/mm/update_strategies/sequential_strategy.cpp
|
||||
|
||||
src/mm/services/scene_service_interface.hpp
|
||||
src/mm/services/scene_service_interface.cpp
|
||||
|
||||
src/mm/services/net_channeled_interface.hpp
|
||||
)
|
||||
|
@ -1,27 +0,0 @@
|
||||
#include "./scene_service_interface.hpp"
|
||||
|
||||
#include <entt/entity/registry.hpp>
|
||||
|
||||
namespace MM {
|
||||
|
||||
struct DefaultSystemsContainer {
|
||||
// list of callables, expecting a Scene (ecs) and a step size (delta)
|
||||
std::vector<std::function<void(Scene&, float)>> systems;
|
||||
};
|
||||
|
||||
void AddSystemToScene(::MM::Scene& scene, ::MM::System fn) {
|
||||
auto& sc = scene.ctx_or_set<DefaultSystemsContainer>();
|
||||
sc.systems.emplace_back(std::move(fn));
|
||||
}
|
||||
|
||||
void EachSystemInScene(::MM::Scene& scene, std::function<void(::MM::Scene&, ::MM::System&)> fn) {
|
||||
auto* sc = scene.try_ctx<DefaultSystemsContainer>();
|
||||
if (sc != nullptr) {
|
||||
for (auto& system : sc->systems) {
|
||||
fn(scene, system);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // MM
|
||||
|
@ -10,14 +10,6 @@ namespace MM {
|
||||
using Scene = entt::basic_registry<::MM::Entity>;
|
||||
using System = std::function<void(::MM::Scene&, float)>;
|
||||
|
||||
// opaque way to add a System to a Scene
|
||||
[[deprecated("use organizer")]]
|
||||
void AddSystemToScene(::MM::Scene& scene, ::MM::System fn);
|
||||
|
||||
// opaque way to iterate over the Systems
|
||||
[[deprecated("use organizer")]]
|
||||
void EachSystemInScene(::MM::Scene& scene, std::function<void(::MM::Scene&, ::MM::System&)> fn);
|
||||
|
||||
} // MM
|
||||
|
||||
namespace MM::Services {
|
||||
@ -34,12 +26,6 @@ namespace MM::Services {
|
||||
// dont use, except for when you know what you are doing!
|
||||
// be carefull of that one (lol)
|
||||
virtual void changeSceneNow(std::unique_ptr<::MM::Scene>&& new_scene) = 0;
|
||||
|
||||
// adds a System to current Scene.
|
||||
// default impl. will use getScene() !
|
||||
virtual void addSystemToScene(::MM::System fn) {
|
||||
::MM::AddSystemToScene(getScene(), std::move(fn));
|
||||
}
|
||||
};
|
||||
|
||||
} // MM::Services
|
||||
|
Reference in New Issue
Block a user