mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-22 23:48:08 -05:00
asdf
This commit is contained in:
parent
03e8220dfe
commit
bd6bfb661f
2 changed files with 5 additions and 21 deletions
|
@ -14,7 +14,7 @@ namespace geode
|
|||
I added this, a simple class to add nodes to a general notification node so that mods dont interfere with each other.
|
||||
*/
|
||||
|
||||
class GEODE_DLL OverlayManager : public cocos2d::CCNode
|
||||
class GEODE_DLL OverlayManager : private cocos2d::CCNode
|
||||
{
|
||||
private:
|
||||
std::vector<cocos2d::CCNode*> nodes;
|
||||
|
@ -29,9 +29,6 @@ namespace geode
|
|||
/// @brief Removes a node from the overlay manager, stopping it from being drawn. This will release the node
|
||||
void removeNode(cocos2d::CCNode* node);
|
||||
|
||||
/// @brief Sorts all overlays by their ZOrder and draws them
|
||||
virtual void visit();
|
||||
|
||||
/// @brief Util to get the highest ZOrder of all nodes
|
||||
int getHighestOverlayZOrder();
|
||||
|
||||
|
|
|
@ -18,34 +18,21 @@ OverlayManager* OverlayManager::get()
|
|||
|
||||
void OverlayManager::addNode(CCNode* node)
|
||||
{
|
||||
node->retain();
|
||||
this->addChild(node);
|
||||
|
||||
nodes.push_back(node);
|
||||
}
|
||||
|
||||
void OverlayManager::removeNode(CCNode* node)
|
||||
{
|
||||
node->release();
|
||||
this->removeChild(node);
|
||||
|
||||
std::erase(nodes, node);
|
||||
}
|
||||
|
||||
void OverlayManager::visit()
|
||||
{
|
||||
std::sort(nodes.begin(), nodes.end(), [](CCNode* a, CCNode* b)
|
||||
{
|
||||
return a->getZOrder() < b->getZOrder();
|
||||
});
|
||||
|
||||
for (auto node : nodes)
|
||||
{
|
||||
node->visit();
|
||||
}
|
||||
}
|
||||
|
||||
int OverlayManager::getHighestOverlayZOrder()
|
||||
{
|
||||
int z = 0;
|
||||
int z = INT_MIN;
|
||||
|
||||
for (auto node : nodes)
|
||||
{
|
||||
|
@ -58,7 +45,7 @@ int OverlayManager::getHighestOverlayZOrder()
|
|||
|
||||
int OverlayManager::getLowestOverlayZOrder()
|
||||
{
|
||||
int z = 0;
|
||||
int z = INT_MAX;
|
||||
|
||||
for (auto node : nodes)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue