Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion loader/include/Geode/UI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "ui/MDTextArea.hpp"
#include "ui/Notification.hpp"
#include "ui/Popup.hpp"
#include "ui/SceneManager.hpp"
#include "ui/OverlayManager.hpp"
#include "ui/Scrollbar.hpp"
#include "ui/ScrollLayer.hpp"
#include "ui/SelectList.hpp"
Expand Down
2 changes: 1 addition & 1 deletion loader/include/Geode/ui/Notification.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "SceneManager.hpp"
#include "OverlayManager.hpp"
#include <cocos2d.h>
#include <cocos-ext.h>
#include <Geode/binding/TextAlertPopup.hpp>
Expand Down
13 changes: 13 additions & 0 deletions loader/include/Geode/ui/OverlayManager.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

#include "../DefaultInclude.hpp"

#include <cocos2d.h>
#include <Geode/utils/cocos.hpp>

namespace geode {
class GEODE_DLL OverlayManager final : public cocos2d::CCNode {
public:
static OverlayManager* get();
};
}
44 changes: 0 additions & 44 deletions loader/include/Geode/ui/SceneManager.hpp

This file was deleted.

29 changes: 12 additions & 17 deletions loader/src/hooks/persist.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <Geode/ui/SceneManager.hpp>
#include <Geode/ui/OverlayManager.hpp>
#include <Geode/modify/CCDirector.hpp>
#include <Geode/modify/CCEGLView.hpp>

using namespace geode::prelude;

Expand All @@ -11,26 +12,19 @@ using namespace geode::prelude;

namespace geode {

#ifdef GEODE_IS_WINDOWS
struct SceneSwitch : Modify<SceneSwitch, AppDelegate> {
struct DrawOverlay : Modify<DrawOverlay, CCEGLView> {
GEODE_FORWARD_COMPAT_DISABLE_HOOKS("persist disabled")
void willSwitchToScene(CCScene* scene) {
AppDelegate::willSwitchToScene(scene);
SceneManager::get()->willSwitchToScene(scene);
static void onModify(auto& self) {
if (auto res = self.setHookPriorityPost("cocos2d::CCEGLView::swapBuffers", Priority::First); !res) {
geode::log::warn("Failed to set hook priority: {}", res.unwrapErr());
}
}
};

#else
struct SceneSwitch : Modify<SceneSwitch, AchievementNotifier> {
GEODE_FORWARD_COMPAT_DISABLE_HOOKS("persist disabled")
void willSwitchToScene(CCScene* scene) {
AchievementNotifier::willSwitchToScene(scene);
SceneManager::get()->willSwitchToScene(scene);
void swapBuffers() {
OverlayManager::get()->visit();
CCEGLView::swapBuffers();
}
};

#endif

struct SceneSwitch2 : Modify<SceneSwitch2, CCDirector> {
GEODE_FORWARD_COMPAT_DISABLE_HOOKS("persist disabled")
// CCDirector does not call willSwitchToScene in these 2 instances,
Expand All @@ -54,4 +48,5 @@ struct SceneSwitch2 : Modify<SceneSwitch2, CCDirector> {
}
};

}

}
4 changes: 2 additions & 2 deletions loader/src/ui/nodes/Notification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void Notification::showNextNotification() {
s_queue = CCArray::create();
s_queue->retain();
}
SceneManager::get()->forget(this);
OverlayManager::get()->removeChild(this);
// remove self from front of queue
s_queue->removeFirstObject();
if (auto obj = s_queue->firstObject()) {
Expand Down Expand Up @@ -180,7 +180,7 @@ void Notification::show() {
this->setPosition(winSize.width / 2, winSize.height / 4);
this->setZOrder(CCScene::get()->getChildrenCount() > 0 ? CCScene::get()->getHighestChildZ() + 2 : 10);
}
SceneManager::get()->keepAcrossScenes(this);
OverlayManager::get()->addChild(this);
m_showing = true;
}
this->runAction(CCSequence::create(
Expand Down
14 changes: 14 additions & 0 deletions loader/src/ui/nodes/OverlayManager.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <Geode/ui/OverlayManager.hpp>
#include <Geode/utils/cocos.hpp>
#include <Geode/utils/ranges.hpp>

using namespace geode::prelude;

OverlayManager* OverlayManager::get() {
static OverlayManager* inst = nullptr;
if (!inst) {
inst = new OverlayManager();
inst->onEnter();
}
return inst;
}
43 changes: 0 additions & 43 deletions loader/src/ui/nodes/SceneManager.cpp

This file was deleted.

Loading