mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-05-12 03:53:52 +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()
|
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);
|
core->renderObjectLayers[this->layer].moveToFront(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderObject::moveToBack()
|
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);
|
core->renderObjectLayers[this->layer].moveToBack(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue