I have a question that i honestly forgot why i wanted to ask
Say you have an ECS framework which has Systems that do work on Components.
Is it smart or even safe to make the ID of these systems be the address of their Update method?
Something like this (no good coding practices applied for simplicity):
class System
{
public:
uint id;
list entities;
void Update(float dt) = 0;
};
class SpecificSystem : public System
{
public:
SpecificSystem() { id = (uint)Update; //or &Update, not sure for the syntax
void Update(float dt) { /* some specific update code*/ }
};
typedef void(*Logic)(float dt, list entities);
class CustomSystem : public System
{
public:
CustomSystem(Logic fn) { id = (uint)fn; }
void Update(float dt) { fn(dt, entities); }
};