mirror of
https://github.com/MadeOfJelly/MushMachine.git
synced 2025-07-05 09:06:45 +02:00
reworked the general update strategy interface
This commit is contained in:
@ -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));
|
||||
}
|
||||
};
|
||||
|
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user