1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-12-25 06:05:45 +00:00

Make RenderObject::moveTo[Front|Back]() work for things that have a parent.

This commit is contained in:
fgenesis 2015-01-14 21:42:54 +01:00
parent 0fdc0e8acc
commit ba9c37f704

View file

@ -468,13 +468,29 @@ void RenderObject::toggleCull(bool value)
void RenderObject::moveToFront()
{
if (layer != -1)
if(RenderObject *p = parent)
{
if(p->children.size() && p->children[0] != this)
{
p->removeChild(this);
p->addChild(this, (ParentManaged)this->pm, RBP_NONE, CHILD_FRONT);
}
}
else if (layer != -1)
core->renderObjectLayers[this->layer].moveToFront(this);
}
void RenderObject::moveToBack()
{
if (layer != -1)
if(RenderObject *p = parent)
{
if(p->children.size() && p->children[p->children.size()-1] != this)
{
p->removeChild(this);
p->addChild(this, (ParentManaged)this->pm, RBP_NONE, CHILD_BACK);
}
}
else if (layer != -1)
core->renderObjectLayers[this->layer].moveToBack(this);
}