}
#local Component_Vtable :: struct {
- init : (^Component) -> void = null_proc;
- update: (^Component, ^Entity, f32) -> void = null_proc;
+ init : (rawptr) -> void = null_proc;
+ update: (rawptr, ^Entity, f32) -> void = null_proc;
}
Component :: struct {
}
comp.vtable = component_vtables->get(comp.type);
- if comp.vtable.init != null_proc {
- comp.vtable.init(comp);
+ if comp.init != null_proc {
+ comp->init();
}
return comp;
for entities {
for^ entry: it.components.entries {
comp := entry.value;
-
- @CompilerBug // comp->update(it, dt); should be legal here, but it says 'update' is not a member of '^Component'.
- if comp.vtable.update != null_proc {
- comp.vtable.update(comp, it, dt);
+ if comp.update != null_proc {
+ comp->update(it, dt);
}
}
}