Couple of assertions
This commit is contained in:
@ -35,6 +35,7 @@ void Scene::update() {
|
|||||||
SceneItem * Scene::createSceneItem() {
|
SceneItem * Scene::createSceneItem() {
|
||||||
sceneitemid_t id = this->nextId++;
|
sceneitemid_t id = this->nextId++;
|
||||||
auto item = new SceneItem(this, id);
|
auto item = new SceneItem(this, id);
|
||||||
|
assertNotNull(item);
|
||||||
this->itemsNotInitialized[id] = item;
|
this->itemsNotInitialized[id] = item;
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,7 @@ namespace Dawn {
|
|||||||
template<class T>
|
template<class T>
|
||||||
T * addComponent() {
|
T * addComponent() {
|
||||||
auto component = new T(this);
|
auto component = new T(this);
|
||||||
|
assertNotNull(component);
|
||||||
this->components.push_back(component);
|
this->components.push_back(component);
|
||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
using namespace Dawn;
|
using namespace Dawn;
|
||||||
|
|
||||||
SceneItemComponent::SceneItemComponent(SceneItem *item) {
|
SceneItemComponent::SceneItemComponent(SceneItem *item) {
|
||||||
|
assertNotNull(item);
|
||||||
this->item = item;
|
this->item = item;
|
||||||
this->transform = &item->transform;
|
this->transform = &item->transform;
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
using namespace Dawn;
|
using namespace Dawn;
|
||||||
|
|
||||||
UIComponent::UIComponent(UICanvas *canvas) {
|
UIComponent::UIComponent(UICanvas *canvas) {
|
||||||
|
assertNotNull(canvas);
|
||||||
this->canvas = canvas;
|
this->canvas = canvas;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +142,7 @@ void UIComponent::addChild(UIComponent *child) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UIComponent::removeChild(UIComponent *child) {
|
void UIComponent::removeChild(UIComponent *child) {
|
||||||
if(child->parent != this) throw "Invalid child";
|
assertTrue(child->parent != this);
|
||||||
auto it = this->children.begin();
|
auto it = this->children.begin();
|
||||||
while(it != this->children.end()) {
|
while(it != this->children.end()) {
|
||||||
if(*it == child) {
|
if(*it == child) {
|
||||||
|
Reference in New Issue
Block a user