Totally refactored UILabel
This commit is contained in:
@ -115,17 +115,24 @@ namespace Dawn {
|
||||
return children;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds all children, and children of children, recursively that match
|
||||
* the queried component.
|
||||
*
|
||||
* @tparam T Component Type to find.
|
||||
* @return Array of pointers to matching children components.
|
||||
*/
|
||||
template<class T>
|
||||
std::vector<T*> findChildrenDeep() {
|
||||
std::vector<Transform*> itemsToCheck = this->transform.children;
|
||||
std::vector<Transform*> transformsToCheck = this->transform.children;
|
||||
std::vector<T*> itemsFound;
|
||||
|
||||
while(itemsToCheck.size() > 0) {
|
||||
auto item = itemsToCheck.begin();
|
||||
vectorAppend(&itemsToCheck, (*item)->children);
|
||||
auto component = (*item)->item->getComponent<T>();
|
||||
while(transformsToCheck.size() > 0) {
|
||||
auto tras = transformsToCheck.begin();
|
||||
vectorAppend(&transformsToCheck, (*tras)->children);
|
||||
auto component = (*tras)->item->getComponent<T>();
|
||||
if(component != nullptr) itemsFound.push_back(component);
|
||||
itemsToCheck.erase(item);
|
||||
transformsToCheck.erase(tras);
|
||||
}
|
||||
|
||||
return itemsFound;
|
||||
|
Reference in New Issue
Block a user