reworked the general update strategy interface

This commit is contained in:
2021-04-28 19:38:25 +02:00
parent b8a5cd7cf4
commit efad254193
53 changed files with 756 additions and 889 deletions

View File

@ -11,9 +11,11 @@ namespace MM {
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
@ -35,7 +37,7 @@ namespace MM::Services {
// adds a System to current Scene.
// default impl. will use getScene() !
inline virtual void addSystemToScene(::MM::System fn) {
virtual void addSystemToScene(::MM::System fn) {
::MM::AddSystemToScene(getScene(), std::move(fn));
}
};

View File

@ -6,7 +6,7 @@ namespace MM {
class Engine;
namespace UpdateStrategies {
struct UpdateCreationInfo;
struct TaskInfo;
}
namespace Services {
@ -17,14 +17,12 @@ namespace MM {
virtual const char* name(void) = 0;
virtual bool enable(Engine& engine) = 0;
// tasks are to be filled in by the service impl
virtual bool enable(Engine& engine, std::vector<UpdateStrategies::TaskInfo>& task_array) = 0;
virtual void disable(Engine& engine) = 0;
// optional, only if service actually needs to be part of the update loop
virtual std::vector<UpdateStrategies::UpdateCreationInfo> registerUpdates(void) { return {}; }
};
} // Services
} //MM
} // MM