MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / updateVisibility

Method updateVisibility

Source/LevelDebugLayer.cpp:474–568  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

472}
473
474void LevelDebugLayer::updateVisibility()
475{
476 auto winSize = ax::Director::getInstance()->getWinSize();
477 auto camPos = Camera::getDefaultCamera()->getPosition();
478
479 float unk = 70.0f;
480
481 int prevSection = floorf((camPos.x - (winSize.width / 2)) / 100) - 1;
482 int nextSection = ceilf((camPos.x) / 100) + 2.0f;
483
484 for (int i = prevSection; i < nextSection; i++)
485 {
486 if (i >= 0)
487 {
488 if (i < _sectionObjects.size())
489 {
490 auto section = _sectionObjects[i];
491 for (size_t j = 0; j < section.size(); j++)
492 {
493 GameObject* obj = section[j];
494 if (!obj)
495 continue;
496
497 if (obj->getParent() == nullptr && obj->_toggledOn)
498 {
499 if (obj->_particle)
500 {
501 addChild(obj->_particle);
502 AX_SAFE_RELEASE(obj->_particle);
503 }
504 if (obj->_glowSprite)
505 {
506 _glowBatchNode->addChild(obj->_glowSprite);
507 AX_SAFE_RELEASE(obj->_glowSprite);
508 }
509
510 reorderLayering(obj, nullptr);
511
512 for (ax::Sprite* child : obj->_childSprites)
513 {
514 reorderLayering(obj, child);
515 }
516 }
517
518 obj->setActive(true);
519 obj->setVisible(true);
520 obj->update();
521 }
522 }
523 }
524 }
525
526 if (_prevSection - 1 >= 0 && _sectionObjects.size() != 0 && _prevSection <= _sectionObjects.size())
527 {
528 auto section = _sectionObjects[_prevSection - 1];
529 for (size_t j = 0; j < section.size(); j++)
530 {
531 if (section[j]->getParent() != nullptr)

Callers

nothing calls this directly

Calls 4

sizeMethod · 0.80
setActiveMethod · 0.80
removeFromGameLayerMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected