MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / removeChildNode

Method removeChildNode

Sources/nCine/Graphics/SceneNode.cpp:135–155  ·  view source on GitHub ↗

! \return True if the node has been removed */

Source from the content-addressed store, hash-verified

133
134 /*! \return True if the node has been removed */
135 bool SceneNode::removeChildNode(SceneNode* childNode)
136 {
137 // Can't remove yourself or a `nullptr` from your children
138 if (childNode == this || childNode == nullptr) {
139 return false;
140 }
141
142 bool hasBeenRemoved = false;
143 if (!children_.empty() && // Avoid checking if this node has no children
144 childNode->parent_ == this) // Avoid checking if the child doesn't belong to this node
145 {
146 for (unsigned int i = 0; i < children_.size(); i++) {
147 if (children_[i] == childNode) {
148 hasBeenRemoved = removeChildNodeAt(i);
149 break;
150 }
151 }
152 }
153
154 return hasBeenRemoved;
155 }
156
157 /*! \return True if the node has been removed */
158 bool SceneNode::removeChildNodeAt(std::uint32_t index)

Callers 2

setParentMethod · 0.80
addChildNodeMethod · 0.80

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected