idk if I like this structure.

This commit is contained in:
2024-09-13 09:26:21 -05:00
parent b309478922
commit b4c2ce16a0
20 changed files with 195 additions and 111 deletions

View File

@ -45,11 +45,10 @@ void SceneComponent::dispose() {
this->listeners.clear();
this->onDispose();
this->item.reset();
this->item = nullptr;
}
std::shared_ptr<SceneItem> SceneComponent::getItem() {
auto item = this->item.lock();
assertNotNull(item, "Item cannot be null?");
return item;
}

View File

@ -17,7 +17,7 @@ namespace Dawn {
class SceneComponent : std::enable_shared_from_this<SceneComponent> {
private:
std::weak_ptr<SceneItem> item;
std::shared_ptr<SceneItem> item;
uint_fast8_t sceneComponentState = 0;
protected:

View File

@ -44,4 +44,5 @@ SceneItem::~SceneItem() {
component->dispose();
}
);
this->components.clear();
}