Skip to content

Instantly share code, notes, and snippets.

@cleak
Created January 21, 2019 04:43
Show Gist options
  • Save cleak/2dc3b67229f2bbf5e1886ddbda8a3876 to your computer and use it in GitHub Desktop.
Save cleak/2dc3b67229f2bbf5e1886ddbda8a3876 to your computer and use it in GitHub Desktop.
class SceneObject {
public:
virtual ~SceneObject() {}
virtual void Update() {}
virtual void LateUpdate() {}
virtual void PhysicsUpdate() {}
virtual void DrawImmediate() {}
};
struct SceneObject_VTable {
void* dtor;
UpdateFn* update;
UpdateFn* late_update;
UpdateFn* physics_update;
UpdateFn* draw_immediate;
};
SceneObject_VTable* GetVtable(SceneObject* obj) {
SceneObject_VTable** vtable_ptr = (SceneObject_VTable**)obj;
return *vtable_ptr;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment