diff options
author | Thales1330 <thaleslima.ufu@gmail.com> | 2016-12-29 19:03:16 -0200 |
---|---|---|
committer | Thales1330 <thaleslima.ufu@gmail.com> | 2016-12-29 19:03:16 -0200 |
commit | 7aed88dbcf9d37a1f40c8cad115f055c4d69e7a9 (patch) | |
tree | f8c67b159a77c61b1a67ffa8ae8f39959cdfbb0f /Project/Element.cpp | |
parent | c5343c718cf80620c2fc7452a4315f7ddb9e5826 (diff) | |
download | PSP.git-7aed88dbcf9d37a1f40c8cad115f055c4d69e7a9.tar.gz PSP.git-7aed88dbcf9d37a1f40c8cad115f055c4d69e7a9.tar.xz PSP.git-7aed88dbcf9d37a1f40c8cad115f055c4d69e7a9.zip |
Parent/child optimization implemented
And others bugfixes.
Diffstat (limited to 'Project/Element.cpp')
-rw-r--r-- | Project/Element.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Project/Element.cpp b/Project/Element.cpp index 4de5ebd..85280d6 100644 --- a/Project/Element.cpp +++ b/Project/Element.cpp @@ -456,6 +456,23 @@ void Element::ReplaceParent(Element* oldParent, Element* newParent) } } +void Element::AddChild(Element* child) { m_childList.push_back(child); } + +void Element::RemoveChild(Element* child) +{ + for(auto it = m_childList.begin(); it != m_childList.end(); ++it) { + Element* element = *it; + if(element == child) m_childList.erase(it--); + } +} + +void Element::ReplaceChild(Element* oldChild, Element* newChild) +{ + for(int i = 0; i < (int)m_childList.size(); i++) { + if(m_childList[i] == oldChild) m_childList[i] = newChild; + } +} + void OpenGLColour::SetRGBA(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha) { rgba[0] = red; |