mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-12-24 13:45:47 +00:00
Make RenderObject::moveTo[Front|Back]() work for things that have a parent.
This commit is contained in:
parent
0fdc0e8acc
commit
ba9c37f704
1 changed files with 18 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue