MCPcopy Create free account
hub / github.com/axmolengine/axmol / visit

Method visit

core/2d/ParallaxNode.cpp:146–163  ·  view source on GitHub ↗

The positions are updated at visit because: - using a timer is not guaranteed that it will called after all the positions were updated - overriding "draw" will only precise if the children have a z > 0 */

Source from the content-addressed store, hash-verified

144- overriding "draw" will only precise if the children have a z > 0
145*/
146void ParallaxNode::visit(Renderer* renderer, const Mat4& parentTransform, uint32_t parentFlags)
147{
148 // Vec2 pos = position_;
149 // Vec2 pos = [self convertToWorldSpace:Vec2::ZERO];
150 Vec2 pos = this->absolutePosition();
151 if (!pos.equals(_lastPosition))
152 {
153 for (auto item : _parallaxArray)
154 {
155 auto point = static_cast<PointObject*>(item);
156 float x = -pos.x + pos.x * point->getRatio().x + point->getOffset().x;
157 float y = -pos.y + pos.y * point->getRatio().y + point->getOffset().y;
158 point->getChild()->setPosition(x, y);
159 }
160 _lastPosition = pos;
161 }
162 Node::visit(renderer, parentTransform, parentFlags);
163}
164
165}

Callers

nothing calls this directly

Calls 7

absolutePositionMethod · 0.95
visitFunction · 0.85
getOffsetMethod · 0.80
equalsMethod · 0.45
getRatioMethod · 0.45
setPositionMethod · 0.45
getChildMethod · 0.45

Tested by

no test coverage detected