diff --git a/loader/include/Geode/utils/NodeIDs.hpp b/loader/include/Geode/utils/NodeIDs.hpp new file mode 100644 index 00000000..9b059b7e --- /dev/null +++ b/loader/include/Geode/utils/NodeIDs.hpp @@ -0,0 +1,109 @@ +#include "cocos.hpp" + +namespace geode::node_ids { + using namespace cocos2d; + + static constexpr int32_t GEODE_ID_PRIORITY = 0x100000; + + template + requires std::is_base_of_v + T* setIDSafe(CCNode* node, int index, char const* id) { + if constexpr (std::is_same_v) { + if (auto child = cocos::getChild(node, index)) { + child->setID(id); + return child; + } + } else { + if (auto child = cocos::getChildOfType(node, index)) { + child->setID(id); + return child; + } + } + return nullptr; + } + + template + void setIDs(CCNode* node, int startIndex, Args... args) { + for (auto i : { args... }) { + setIDSafe(node, startIndex, i); + ++startIndex; + } + } + + static void switchToMenu(CCNode* node, CCNode* menu) { + if (!node || !menu) return; + + auto worldPos = node->getParent() ? + node->getParent()->convertToWorldSpace(node->getPosition()) : + node->getPosition(); + + node->retain(); + node->removeFromParent(); + node->setZOrder(0); + + menu->addChild(node); + node->setPosition(menu->convertToNodeSpace(worldPos)); + } + + static void switchChildToMenu(CCNode* parent, int idx, CCNode* menu) { + switchToMenu(static_cast(parent->getChildren()->objectAtIndex(idx)), menu); + } + + template + static void switchChildrenToMenu(CCNode* parent, CCNode* menu, Args... args) { + for (auto i : { args... }) { + switchChildToMenu(parent, i, menu); + } + } + + template + static N* detachAndCreateNode( + CCNode* parent, char const* menuID, Layout* layout, T first, Args... args + ) { + if (!first) { + auto menu = N::create(); + menu->setID(menuID); + menu->setLayout(layout); + parent->addChild(menu); + return menu; + } + + auto oldMenu = first->getParent(); + + first->retain(); + first->removeFromParent(); + + auto newMenu = N::create(); + newMenu->setPosition(parent->convertToNodeSpace(oldMenu->convertToWorldSpace(first->getPosition()))); + newMenu->setID(menuID); + newMenu->setZOrder(oldMenu->getZOrder()); + parent->addChild(newMenu); + + first->setPosition(0, 0); + first->setZOrder(0); + newMenu->addChild(first); + first->release(); + + (switchToMenu(args, newMenu), ...); + + newMenu->setLayout(layout); + + return newMenu; + } + + template + static CCMenu* detachAndCreateMenu( + CCNode* parent, char const* menuID, Layout* layout, T first, Args... args + ) { + return detachAndCreateNode(parent, menuID, layout, first, args...); + } + + static CCSize getSizeSafe(CCNode* node) { + if (node) { + return node->getScaledContentSize(); + } + else { + return CCSizeZero; + } + } +} \ No newline at end of file diff --git a/loader/src/hooks/MenuLayer.cpp b/loader/src/hooks/MenuLayer.cpp index 27975ad7..e8014bfb 100644 --- a/loader/src/hooks/MenuLayer.cpp +++ b/loader/src/hooks/MenuLayer.cpp @@ -1,10 +1,11 @@ -#include "../ids/AddIDs.hpp" #include "../ui/internal/list/ModListLayer.hpp" #include #include #include +#include +#include #include #include #include @@ -45,7 +46,7 @@ $execute { struct CustomMenuLayer : Modify { static void onModify(auto& self) { - if (!self.setHookPriority("MenuLayer::init", GEODE_ID_PRIORITY)) { + if (!self.setHookPriority("MenuLayer::init", geode::node_ids::GEODE_ID_PRIORITY)) { log::warn("Failed to set MenuLayer::init hook priority, node IDs may not work properly"); } } diff --git a/loader/src/ids/AddIDs.hpp b/loader/src/ids/AddIDs.hpp deleted file mode 100644 index 408bf4aa..00000000 --- a/loader/src/ids/AddIDs.hpp +++ /dev/null @@ -1,110 +0,0 @@ -#pragma once - -#include -#include - -using namespace geode::prelude; - -static constexpr int32_t GEODE_ID_PRIORITY = 0x100000; - -template - requires std::is_base_of_v -T* setIDSafe(CCNode* node, int index, char const* id) { - if constexpr (std::is_same_v) { - if (auto child = getChild(node, index)) { - child->setID(id); - return child; - } - } else { - if (auto child = getChildOfType(node, index)) { - child->setID(id); - return child; - } - } - return nullptr; -} - -template -void setIDs(CCNode* node, int startIndex, Args... args) { - for (auto i : { args... }) { - setIDSafe(node, startIndex, i); - ++startIndex; - } -} - -static void switchToMenu(CCNode* node, CCNode* menu) { - if (!node || !menu) return; - - auto worldPos = node->getParent() ? - node->getParent()->convertToWorldSpace(node->getPosition()) : - node->getPosition(); - - node->retain(); - node->removeFromParent(); - node->setZOrder(0); - - menu->addChild(node); - node->setPosition(menu->convertToNodeSpace(worldPos)); -} - -static void switchChildToMenu(CCNode* parent, int idx, CCNode* menu) { - switchToMenu(static_cast(parent->getChildren()->objectAtIndex(idx)), menu); -} - -template -static void switchChildrenToMenu(CCNode* parent, CCNode* menu, Args... args) { - for (auto i : { args... }) { - switchChildToMenu(parent, i, menu); - } -} - -template -static N* detachAndCreateNode( - CCNode* parent, char const* menuID, Layout* layout, T first, Args... args -) { - if (!first) { - auto menu = N::create(); - menu->setID(menuID); - menu->setLayout(layout); - parent->addChild(menu); - return menu; - } - - auto oldMenu = first->getParent(); - - first->retain(); - first->removeFromParent(); - - auto newMenu = N::create(); - newMenu->setPosition(parent->convertToNodeSpace(oldMenu->convertToWorldSpace(first->getPosition()))); - newMenu->setID(menuID); - newMenu->setZOrder(oldMenu->getZOrder()); - parent->addChild(newMenu); - - first->setPosition(0, 0); - first->setZOrder(0); - newMenu->addChild(first); - first->release(); - - (switchToMenu(args, newMenu), ...); - - newMenu->setLayout(layout); - - return newMenu; -} - -template -static CCMenu* detachAndCreateMenu( - CCNode* parent, char const* menuID, Layout* layout, T first, Args... args -) { - return detachAndCreateNode(parent, menuID, layout, first, args...); -} - -static CCSize getSizeSafe(CCNode* node) { - if (node) { - return node->getScaledContentSize(); - } - else { - return CCSizeZero; - } -} diff --git a/loader/src/ids/CCTextInputNode.cpp b/loader/src/ids/CCTextInputNode.cpp deleted file mode 100644 index 6f4759e8..00000000 --- a/loader/src/ids/CCTextInputNode.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include - -// This doesn't actually add any IDs since those aren't needed for -// CCTextInputNode where everything is accessible through members. -// This is to fix the effects of the epic mistake of Cocos2d inventing -// ignoreAnchorPointForPosition which causes the content size of -// text input nodes to be way off - -// struct $modify(CCTextInputNode) { -// bool init(float width, float height, const char* caption, const char* thonburi, int maxCharCount, const char* font) { -// if (!CCTextInputNode::init(width, height, caption, thonburi, maxCharCount, font)) -// return false; - -// this->ignoreAnchorPointForPosition(false); -// this->fixPosition(); - -// return true; -// } - -// void fixPosition() { -// if (!m_bIgnoreAnchorPointForPosition && m_placeholderLabel) { -// this->setAnchorPoint(m_placeholderLabel->getAnchorPoint()); -// m_placeholderLabel->setPosition(m_obContentSize * m_obAnchorPoint); -// } -// } - -// void updateLabel(gd::string text) { -// CCTextInputNode::updateLabel(text); -// this->fixPosition(); -// } -// }; diff --git a/loader/src/ids/CreatorLayer.cpp b/loader/src/ids/CreatorLayer.cpp deleted file mode 100644 index f0ab32e8..00000000 --- a/loader/src/ids/CreatorLayer.cpp +++ /dev/null @@ -1,137 +0,0 @@ -#include "AddIDs.hpp" - -#include -#include -#include - -using namespace geode::prelude; - -template -static void reorderButtons(Args... args) { - int ooa = 0; - for (auto& arg : { args... }) { - if (arg) { - arg->setOrderOfArrival(ooa); - ooa += 1; - } - } -} - -// $register_ids(CreatorLayer) { -// setIDSafe(this, 0, "background"); - -// auto winSize = CCDirector::get()->getWinSize(); - -// if (auto menu = getChildOfType(this, 0)) { -// menu->setID("creator-buttons-menu"); - -// // move vault button to its own menu -// if (auto lockBtn = setIDSafe(menu, -2, "vault-button")) { -// auto menu = detachAndCreateMenu( -// this, -// "top-right-menu", -// ColumnLayout::create() -// ->setAxisReverse(true) -// ->setAxisAlignment(AxisAlignment::End), -// lockBtn -// ); -// menu->setPositionY( -// menu->getPositionY() - 150.f / 2 + -// lockBtn->getScaledContentSize().height / 2 -// ); -// menu->setContentSize({ 60.f, 150.f }); -// menu->updateLayout(); -// } - -// // move treasure room button to its own menu -// if (auto roomBtn = setIDSafe(menu, -1, "treasure-room-button")) { -// auto menu = detachAndCreateMenu( -// this, -// "bottom-right-menu", -// ColumnLayout::create() -// ->setAxisAlignment(AxisAlignment::Start), -// roomBtn -// ); -// menu->setPositionY( -// menu->getPositionY() + 125.f / 2 - -// roomBtn->getScaledContentSize().height / 2 -// ); -// menu->setContentSize({ 60.f, 125.f }); -// menu->updateLayout(); -// } - -// // row order is inverted because of layout - -// reorderButtons( -// setIDSafe(menu, 6, "featured-button"), -// setIDSafe(menu, 7, "hall-of-fame-button"), -// setIDSafe(menu, 8, "map-packs-button"), - -// setIDSafe(menu, 9, "search-button"), -// setIDSafe(menu, 3, "quests-button"), -// setIDSafe(menu, 4, "daily-button"), -// setIDSafe(menu, 5, "weekly-button"), - -// setIDSafe(menu, 10, "gauntlets-button"), -// setIDSafe(menu, 0, "create-button"), -// setIDSafe(menu, 1, "saved-button"), -// setIDSafe(menu, 2, "scores-button") -// ); - -// if (winSize.width / winSize.height <= 5.1f / 3.f) { -// menu->setContentSize({ winSize.width - 80.f, 310.f }); -// } -// else { -// menu->setContentSize({ winSize.width - 120.f, 310.f }); -// } -// menu->setLayout( -// RowLayout::create() -// ->setGap(12.f) -// ->setCrossAxisReverse(true) -// ->setGrowCrossAxis(true) -// ->setCrossAxisOverflow(false) -// ); -// } - -// if (auto menu = getChildOfType(this, 1)) { -// menu->setID("exit-menu"); -// auto exitBtn = setIDSafe(menu, 0, "exit-button"); -// menu->setPositionY( -// menu->getPositionY() - 125.f / 2 + -// getSizeSafe(exitBtn).height / 2 -// ); -// menu->setContentSize({ 60.f, 125.f }); -// menu->setLayout( -// ColumnLayout::create() -// ->setAxisAlignment(AxisAlignment::End) -// ); -// } - -// // add a menu to the bottom left corner that is empty but prolly a place mods -// // want to add stuff to -// auto menu = CCMenu::create(); -// menu->setPosition(24.f, 0.f + 125.f / 2); -// menu->setID("bottom-left-menu"); -// menu->setContentSize({ 60.f, 125.f }); -// menu->setLayout( -// ColumnLayout::create() -// ->setAxisAlignment(AxisAlignment::Start) -// ); -// this->addChild(menu); -// } - -// struct CreatorLayerIDs : Modify { -// static void onModify(auto& self) { -// if (!self.setHookPriority("CreatorLayer::init", GEODE_ID_PRIORITY)) { -// log::warn("Failed to set CreatorLayer::init hook priority, node IDs may not work properly"); -// } -// } - -// bool init() { -// if (!CreatorLayer::init()) return false; - -// NodeIDs::get()->provide(this); - -// return true; -// } -// }; diff --git a/loader/src/ids/CustomSongWidget.cpp b/loader/src/ids/CustomSongWidget.cpp deleted file mode 100644 index 219460f2..00000000 --- a/loader/src/ids/CustomSongWidget.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "AddIDs.hpp" - -#include -#include -#include - -using namespace geode::prelude; - -// $register_ids(CustomSongWidget) { -// setIDSafe(this, 0, "bg"); -// setIDSafe(this, 0, "loading-bar"); -// setIDSafe(this, 0, "song-name-label"); -// setIDSafe(this, 1, "author-name-label"); -// setIDSafe(this, 2, "id-and-size-label"); -// setIDSafe(this, 3, "error-label"); -// setIDSafe(this, 0, "buttons-menu"); -// auto customSongWidgetMenu = this->getChildByID("buttons-menu"); -// setIDSafe(customSongWidgetMenu, 0, "download-button"); -// setIDSafe(customSongWidgetMenu, 1, "cancel-button"); -// setIDSafe(customSongWidgetMenu, 2, "use-button"); -// setIDSafe(customSongWidgetMenu, 3, "refresh-button"); -// setIDSafe(customSongWidgetMenu, 4, "play-song-button"); -// setIDSafe(customSongWidgetMenu, 5, "more-button"); -// }; - -// struct CustomSongWidgetIDs : Modify { -// static void onModify(auto& self) { -// if (!self.setHookPriority("CustomSongWidget::init", GEODE_ID_PRIORITY)) { -// log::warn("Failed to set CustomSongWidget::init hook priority, node IDs may not work properly"); -// } -// } - -// bool init(SongInfoObject* s, LevelSettingsObject* l, bool b1, bool b2, bool b3, bool b4, bool hideBackground) { -// if (!CustomSongWidget::init(s, l, b1, b2, b3, b4, hideBackground)) return false; - -// NodeIDs::get()->provide(this); - -// return true; -// } -// }; \ No newline at end of file diff --git a/loader/src/ids/CustomizeObjectLayer.cpp b/loader/src/ids/CustomizeObjectLayer.cpp deleted file mode 100644 index 61e9ef85..00000000 --- a/loader/src/ids/CustomizeObjectLayer.cpp +++ /dev/null @@ -1,330 +0,0 @@ -#include "AddIDs.hpp" - -#include - -using namespace geode::prelude; - -// $register_ids(CustomizeObjectLayer) { -// auto winSize = CCDirector::get()->getWinSize(); - -// setIDs( -// m_mainLayer, 0, -// "alert-bg", -// "title-label", -// "button-menu", -// "selected-channel-label", -// "channel-input-bg", -// "channel-input", -// "text-input-bg", -// "text-input", -// "glow-label" -// ); - -// m_buttonMenu->setID("ok-menu"); - -// setIDs( -// m_buttonMenu, -// 0, -// "ok-button", -// "info-button", -// // 2 -// "base-tab-button", -// "detail-tab-button", -// "base-hsv-button", -// "detail-hsv-button", -// "text-tab-button", -// // 7 -// "player-color-1-button", -// "player-color-2-button", -// "light-bg-button", -// "default-button", -// "channel-1-button", -// "channel-2-button", -// "channel-3-button", -// "channel-4-button", -// "channel-5-button", -// "channel-6-button", -// "channel-7-button", -// "channel-8-button", -// "channel-9-button", -// "channel-custom-button", -// // 21 -// "select-channel-up-button", -// "select-channel-down-button", -// "select-channel-button", -// // 24 -// "split-text-button", -// "clear-text-button", -// // 26 -// "next-free-button" -// // 27 -// ); - -// if (m_targetObject) { -// setIDs( -// m_buttonMenu, -// 27, -// "copy-button", -// "paste-button", - -// "browse-button", - -// "glow-toggle" -// ); -// } -// else { -// setIDs( -// m_buttonMenu, -// 27, -// "browse-button", - -// "glow-toggle" -// ); -// } - -// auto tabsLayout = RowLayout::create() -// ->setAxisAlignment(AxisAlignment::Center) -// ->setCrossAxisAlignment(AxisAlignment::Center); -// tabsLayout->ignoreInvisibleChildren(true); -// auto tabsMenu = detachAndCreateMenu( -// m_mainLayer, -// "tabs-menu", -// tabsLayout, -// m_buttonMenu->getChildByID("base-tab-button"), -// m_buttonMenu->getChildByID("detail-tab-button"), -// SpacerNode::create(), -// m_buttonMenu->getChildByID("text-tab-button") -// ); -// tabsMenu->setContentSize({ 360.f, 50.f }); -// tabsMenu->setPositionX(winSize.width / 2); -// tabsMenu->updateLayout(); - -// auto specialChannelsMenu = detachAndCreateMenu( -// m_mainLayer, -// "special-channels-menu", -// RowLayout::create() -// ->setCrossAxisOverflow(false) -// ->setGrowCrossAxis(true) -// ->setAxisAlignment(AxisAlignment::Center) -// ->setCrossAxisAlignment(AxisAlignment::Center) -// ->setGap(14.f), -// m_buttonMenu->getChildByID("player-color-1-button"), -// m_buttonMenu->getChildByID("player-color-2-button"), -// m_buttonMenu->getChildByID("light-bg-button"), -// m_buttonMenu->getChildByID("default-button") -// ); -// specialChannelsMenu->setContentSize({ 350.f, 50.f }); -// specialChannelsMenu->setPositionX(winSize.width / 2); -// specialChannelsMenu->updateLayout(); - -// auto channelsMenu = detachAndCreateMenu( -// m_mainLayer, -// "channels-menu", -// RowLayout::create() -// ->setCrossAxisOverflow(false) -// ->setGrowCrossAxis(true) -// ->setAxisAlignment(AxisAlignment::Center) -// ->setCrossAxisAlignment(AxisAlignment::Center) -// ->setGap(20.f), -// m_buttonMenu->getChildByID("channel-1-button"), -// m_buttonMenu->getChildByID("channel-2-button"), -// m_buttonMenu->getChildByID("channel-3-button"), -// m_buttonMenu->getChildByID("channel-4-button"), -// m_buttonMenu->getChildByID("channel-5-button"), -// m_buttonMenu->getChildByID("channel-6-button"), -// m_buttonMenu->getChildByID("channel-7-button"), -// m_buttonMenu->getChildByID("channel-8-button"), -// m_buttonMenu->getChildByID("channel-9-button"), -// m_buttonMenu->getChildByID("channel-custom-button") -// ); -// channelsMenu->setContentSize({ 350.f, 100.f }); -// channelsMenu->setPosition(winSize.width / 2, winSize.height / 2 - 25.f); -// channelsMenu->updateLayout(); - -// auto selectedChannelMenu = detachAndCreateMenu( -// m_mainLayer, -// "selected-channel-menu", -// nullptr, -// m_buttonMenu->getChildByID("select-channel-button"), -// m_mainLayer->getChildByID("selected-channel-label") -// ); -// selectedChannelMenu->setContentSize({ 120.f, 40.f }); -// selectedChannelMenu->setPosition( -// winSize.width / 2 + 110.f, -// winSize.height / 2 - 90.f -// ); -// if (auto label = selectedChannelMenu->getChildByID("selected-channel-label")) { -// label->setPosition(75.f, 20.f); -// } -// if (auto button = selectedChannelMenu->getChildByID("select-channel-button")) { -// button->setPosition(100.f, 20.f); -// } - -// auto togglesMenu = detachAndCreateMenu( -// m_mainLayer, -// "toggles-menu", -// nullptr, -// m_mainLayer->getChildByID("glow-label"), -// m_buttonMenu->getChildByID("glow-toggle") -// ); -// togglesMenu->setContentSize({ 75.f, 120.f }); -// togglesMenu->setPosition(55.f, 90.f); -// if (auto label = togglesMenu->getChildByID("glow-label")) { -// label->setPosition(57.f, 20.f); -// } -// if (auto toggle = togglesMenu->getChildByID("glow-toggle")) { -// toggle->setPosition(57.f, 5.f); -// } - -// auto baseHSVMenu = detachAndCreateMenu( -// m_mainLayer, -// "base-hsv-menu", -// RowLayout::create() -// ->setAxisAlignment(AxisAlignment::Start), -// m_buttonMenu->getChildByID("base-hsv-button") -// ); -// baseHSVMenu->setContentSize({ 80.f, 60.f }); -// baseHSVMenu->setPositionX(winSize.width / 2 - 132.5f); -// baseHSVMenu->updateLayout(); - -// auto detailHSVMenu = detachAndCreateMenu( -// m_mainLayer, -// "detail-hsv-menu", -// RowLayout::create() -// ->setAxisAlignment(AxisAlignment::Start), -// m_buttonMenu->getChildByID("detail-hsv-button") -// ); -// detailHSVMenu->setContentSize({ 80.f, 60.f }); -// detailHSVMenu->setPositionX(baseHSVMenu->getPositionX()); -// detailHSVMenu->updateLayout(); - -// auto nextFreeMenu = detachAndCreateMenu( -// m_mainLayer, -// "next-free-menu", -// RowLayout::create() -// ->setAxisAlignment(AxisAlignment::Start), -// m_buttonMenu->getChildByID("next-free-button") -// ); -// nextFreeMenu->setContentSize({ 120.f, 60.f }); -// nextFreeMenu->setPositionX(winSize.width / 2 - 110.f); -// nextFreeMenu->updateLayout(); - -// auto textActionsMenu = detachAndCreateMenu( -// m_mainLayer, -// "text-actions-menu", -// RowLayout::create() -// ->setAxisAlignment(AxisAlignment::End) -// ->setAxisReverse(true), -// m_buttonMenu->getChildByID("split-text-button") -// ); -// textActionsMenu->setContentSize({ 120.f, 60.f }); -// textActionsMenu->setPositionX(winSize.width / 2 + 110.f); -// textActionsMenu->updateLayout(); - -// auto clearTextMenu = detachAndCreateMenu( -// m_mainLayer, -// "clear-text-menu", -// nullptr, -// m_buttonMenu->getChildByID("clear-text-button") -// ); - -// auto infoMenu = detachAndCreateMenu( -// m_mainLayer, -// "info-menu", -// RowLayout::create() -// ->setAxisAlignment(AxisAlignment::End) -// ->setAxisReverse(true), -// m_buttonMenu->getChildByID("info-button") -// ); -// infoMenu->setContentSize({ 80.f, 60.f }); -// infoMenu->setPosition(winSize.width / 2 + 132.5f, baseHSVMenu->getPositionY()); -// infoMenu->updateLayout(); - -// auto browseMenu = detachAndCreateMenu( -// m_mainLayer, -// "browse-menu", -// ColumnLayout::create() -// ->setAxisAlignment(AxisAlignment::Start) -// ->setAxisReverse(true), -// m_buttonMenu->getChildByID("browse-button") -// ); -// browseMenu->setContentSize({ 100.f, 140.f }); -// browseMenu->setPositionY(winSize.height / 2 - 70.f); -// browseMenu->updateLayout(); - -// auto copyPasteMenu = detachAndCreateMenu( -// m_mainLayer, -// "copy-paste-menu", -// ColumnLayout::create() -// ->setAxisAlignment(AxisAlignment::End) -// ->setAxisReverse(true), -// m_buttonMenu->getChildByID("copy-button"), -// m_buttonMenu->getChildByID("paste-button") -// ); -// copyPasteMenu->setContentSize({ 100.f, 140.f }); -// copyPasteMenu->setPositionY(winSize.height / 2 + 100.f); -// copyPasteMenu->updateLayout(); - -// auto selectChannelMenu = detachAndCreateMenu( -// m_mainLayer, -// "select-channel-menu", -// nullptr, -// m_buttonMenu->getChildByID("select-channel-up-button"), -// m_buttonMenu->getChildByID("select-channel-down-button") -// ); -// selectChannelMenu->setPosition(m_customColorInputBG->getPosition()); -// selectChannelMenu->setContentSize({ 60.f, 140.f }); -// if (auto btn = selectChannelMenu->getChildByID("select-channel-up-button")) { -// btn->setPosition({ 30.f, 110.f }); -// } -// if (auto btn = selectChannelMenu->getChildByID("select-channel-down-button")) { -// btn->setPosition({ 30.f, 30.f }); -// } -// } - -// struct CustomizeObjectLayerIDs : Modify { -// static void onModify(auto& self) { -// if (!self.setHookPriority("CustomizeObjectLayer::init", GEODE_ID_PRIORITY)) { -// log::warn("Failed to set CustomizeObjectLayer::init hook priority, node IDs may not work properly"); -// } -// } - -// void toggleMenuIf(const char* id, int mode) { -// if (auto menu = m_mainLayer->getChildByID(id)) { -// menu->setVisible(m_selectedMode == mode); -// } -// } - -// void toggleMenuIfNot(const char* id, int mode) { -// if (auto menu = m_mainLayer->getChildByID(id)) { -// menu->setVisible(m_selectedMode != mode); -// } -// } - -// void toggleVisible() { -// CustomizeObjectLayer::toggleVisible(); -// // have to manually toggle menu visibility to allow touches being correctly passed -// this->toggleMenuIf("base-hsv-menu", 1); -// this->toggleMenuIf("detail-hsv-menu", 2); -// this->toggleMenuIf("text-actions-menu", 3); -// this->toggleMenuIf("clear-text-menu", 3); -// this->toggleMenuIfNot("next-free-menu", 3); -// this->toggleMenuIfNot("toggles-menu", 3); -// this->toggleMenuIfNot("channels-menu", 3); -// this->toggleMenuIfNot("special-channels-menu", 3); -// this->toggleMenuIfNot("selected-channel-menu", 3); -// this->toggleMenuIfNot("browse-menu", 3); -// this->toggleMenuIfNot("copy-paste-menu", 3); -// this->toggleMenuIfNot("select-channel-menu", 3); -// } - -// bool init(GameObject* obj, CCArray* objs) { -// if (!CustomizeObjectLayer::init(obj, objs)) -// return false; - -// NodeIDs::get()->provide(this); -// this->toggleVisible(); - -// return true; -// } -// }; diff --git a/loader/src/ids/EditLevelLayer.cpp b/loader/src/ids/EditLevelLayer.cpp deleted file mode 100644 index 714c014a..00000000 --- a/loader/src/ids/EditLevelLayer.cpp +++ /dev/null @@ -1,126 +0,0 @@ -#include "AddIDs.hpp" - -#include -#include -#include -#include - -using namespace geode::prelude; - -// $register_ids(EditLevelLayer) { -// setIDs( -// this, -// 0, -// "background", -// "bottom-left-art", -// "bottom-right-art", -// "level-name-background", -// "level-name-input", -// "description-background", -// "description-input", -// "description-text-area", -// "level-edit-menu", -// "level-length", -// "level-song", -// "level-verified", -// "version-label", -// "level-id-label", -// "level-actions-menu", -// "back-menu", -// "info-button-menu" -// ); - -// auto winSize = CCDirector::get()->getWinSize(); -// auto descBG = this->getChildByID("description-background"); - -// auto descMenu = CCMenu::create(); -// descMenu->setID("description-menu"); -// descMenu->setLayout(ColumnLayout::create()); -// descMenu->setPosition( -// descBG->getPositionX() - descBG->getScaledContentSize().width / 2 - 35.f, -// descBG->getPositionY() -// ); -// descMenu->setContentSize({ 40.f, 80.f }); -// this->addChild(descMenu); - -// if (auto menu = this->getChildByID("level-edit-menu")) { -// setIDs(menu, 0, "edit-button", "play-button", "share-button"); -// if (menu->getChildrenCount() == 4) { -// auto btn = static_cast(menu->getChildren()->objectAtIndex(3)); -// btn->setID("update-desc-button"); -// btn->retain(); -// btn->removeFromParent(); -// descMenu->addChild(btn); -// btn->release(); -// descMenu->updateLayout(); -// } -// menu->setContentSize({ winSize.width - 160.f, 100.f }); -// menu->setLayout(RowLayout::create()->setGap(25.f)); -// } - -// if (auto menu = this->getChildByID("level-actions-menu")) { -// setIDs( -// menu, -// 0, -// "delete-button", -// "help-button", -// "duplicate-button", -// "move-to-top-button", -// "folder-button" -// ); - -// auto folderMenu = detachAndCreateMenu( -// this, "folder-menu", -// ColumnLayout::create(), -// menu->getChildByID("folder-button") -// ); -// folderMenu->setContentSize({ 50.f, 215.f }); -// folderMenu->updateLayout(); - -// menu->setPosition( -// menu->getPositionX() + static_cast( -// menu->getChildren()->firstObject() -// )->getPositionX(), -// winSize.height / 2 -// ); -// menu->setContentSize({ 60.f, winSize.height - 15.f }); -// menu->setLayout( -// ColumnLayout::create() -// ->setGap(7.f) -// ->setAxisAlignment(AxisAlignment::End) -// ->setAxisReverse(true) -// ); -// menu->setZOrder(1); -// } - -// if (auto menu = this->getChildByID("back-menu")) { -// auto backBtn = setIDSafe(menu, 0, "back-button"); -// menu->setPositionX( -// menu->getPositionX() + 100.f / 2 - -// getSizeSafe(backBtn).width / 2 -// ); -// menu->setContentSize({ 100.f, 50.f }); -// menu->setLayout( -// RowLayout::create() -// ->setAxisAlignment(AxisAlignment::Start) -// ); -// } - -// if (auto menu = this->getChildByID("info-button-menu")) setIDSafe(menu, 0, "info-button"); -// } - -// struct EditLevelLayerIDs : Modify { -// static void onModify(auto& self) { -// if (!self.setHookPriority("EditLevelLayer::init", GEODE_ID_PRIORITY)) { -// log::warn("Failed to set EditLevelLayer::init hook priority, node IDs may not work properly"); -// } -// } - -// bool init(GJGameLevel* l) { -// if (!EditLevelLayer::init(l)) return false; - -// NodeIDs::get()->provide(this); - -// return true; -// } -// }; diff --git a/loader/src/ids/EditorPauseLayer.cpp b/loader/src/ids/EditorPauseLayer.cpp deleted file mode 100644 index 9b071bb2..00000000 --- a/loader/src/ids/EditorPauseLayer.cpp +++ /dev/null @@ -1,274 +0,0 @@ -#include "AddIDs.hpp" - -#include - -using namespace geode::prelude; - -// special class for this because making it a CCMenuItemToggler would be very UB -// (not gonna reinterpret_cast that into the members) -// class GuidelinesButton : public CCMenuItemSpriteExtra { -// protected: -// bool init() override { -// if (!CCMenuItemSpriteExtra::init( -// CCSprite::createWithSpriteFrameName("GJ_audioOffBtn_001.png"), -// nullptr, -// this, nullptr -// )) return false; - -// this->updateSprite(); - -// return true; -// } - -// void updateSprite() { -// this->setNormalImage(CCSprite::createWithSpriteFrameName( -// GameManager::get()->m_showSongMarkers ? -// "GJ_audioOnBtn_001.png" : -// "GJ_audioOffBtn_001.png" -// )); -// } - -// void activate() override { -// CCMenuItemSpriteExtra::activate(); -// GameManager::get()->m_showSongMarkers ^= 1; -// this->updateSprite(); -// } - -// public: -// static GuidelinesButton* create() { -// auto ret = new GuidelinesButton(); -// if (ret && ret->init()) { -// ret->autorelease(); -// return ret; -// } -// CC_SAFE_DELETE(ret); -// return nullptr; -// } -// }; - -// $register_ids(EditorPauseLayer) { -// auto winSize = CCDirector::get()->getWinSize(); - -// if (auto menu = getChildOfType(this, 0)) { -// menu->setID("resume-menu"); - -// setIDs( -// menu, 0, -// "resume-button", -// "save-and-play-button", -// "save-and-exit-button", -// "save-button", -// "exit-button" -// ); - -// menu->setContentSize({ 100.f, 220.f }); -// menu->setLayout( -// ColumnLayout::create() -// ->setGap(12.5f) -// ->setAxisReverse(true) -// ); -// } - -// setIDs( -// this, 2, -// "ignore-damage-label", -// "follow-player-label", -// "select-filter-label", -// "show-grid-label", -// "show-object-info-label", -// "show-ground-label", -// "preview-mode-label", - -// "object-count-label", -// "length-label", -// "length-name-label" -// ); - -// if (auto menu = getChildOfType(this, 1)) { -// menu->setID("bottom-menu"); - -// setIDs( -// menu, 0, -// "guidelines-enable-button", -// "help-button", -// "guidelines-disable-button", - -// "uncheck-portals-button", -// "reset-unused-button", -// "create-edges-button", -// "create-outlines-button", -// "create-base-button", -// "build-helper-button", - -// "align-x-button", -// "align-y-button", -// "select-all-button", -// "select-all-left-button", -// "select-all-right-button", - -// "ignore-damage-toggle", -// "follow-player-toggle", -// "select-filter-toggle", -// "show-grid-toggle", -// "show-object-info-toggle", -// "show-ground-toggle", -// "preview-mode-toggle", - -// "keys-button", -// "settings-button" -// ); - -// auto smallActionsMenu = detachAndCreateMenu( -// this, -// "small-actions-menu", -// ColumnLayout::create() -// ->setAxisAlignment(AxisAlignment::Start) -// ->setAxisReverse(true), -// menu->getChildByID("align-x-button"), -// menu->getChildByID("align-y-button"), -// menu->getChildByID("select-all-button"), -// menu->getChildByID("select-all-left-button"), -// menu->getChildByID("select-all-right-button") -// ); -// smallActionsMenu->setContentSize({ 100.f, 240.f }); -// smallActionsMenu->setPositionY(130.f); -// smallActionsMenu->updateLayout(); - -// auto actionsMenu = detachAndCreateMenu( -// this, -// "actions-menu", -// ColumnLayout::create() -// ->setAxisAlignment(AxisAlignment::Start) -// ->setAxisReverse(true), -// menu->getChildByID("keys-button"), -// menu->getChildByID("build-helper-button"), -// menu->getChildByID("create-base-button"), -// menu->getChildByID("create-outlines-button"), -// menu->getChildByID("create-edges-button"), -// menu->getChildByID("reset-unused-button"), -// menu->getChildByID("uncheck-portals-button") -// ); -// if (auto keysBtn = actionsMenu->getChildByID("keys-button")) { -// keysBtn->setLayoutOptions(AxisLayoutOptions::create()->setPrevGap(10.f)); -// } -// actionsMenu->setContentSize({ 100.f, 240.f }); -// actionsMenu->setPositionY(130.f); -// actionsMenu->updateLayout(); - -// auto optionsMenu = detachAndCreateMenu( -// this, -// "options-menu", -// RowLayout::create() -// ->setGap(0.f) -// ->setAxisAlignment(AxisAlignment::Start) -// ->setGrowCrossAxis(true) -// ->setCrossAxisAlignment(AxisAlignment::Start) -// ->setCrossAxisOverflow(false), -// menu->getChildByID("preview-mode-toggle"), -// this->getChildByID("preview-mode-label"), -// menu->getChildByID("show-ground-toggle"), -// this->getChildByID("show-ground-label"), -// menu->getChildByID("show-object-info-toggle"), -// this->getChildByID("show-object-info-label"), -// menu->getChildByID("show-grid-toggle"), -// this->getChildByID("show-grid-label"), -// menu->getChildByID("select-filter-toggle"), -// this->getChildByID("select-filter-label"), -// menu->getChildByID("follow-player-toggle"), -// this->getChildByID("follow-player-label"), -// menu->getChildByID("ignore-damage-toggle"), -// this->getChildByID("ignore-damage-label") -// ); -// for (auto node : CCArrayExt(optionsMenu->getChildren())) { -// if (auto label = typeinfo_cast(node)) { -// label->setLayoutOptions( -// AxisLayoutOptions::create() -// ->setSameLine(true) -// ->setBreakLine(true) -// ->setPrevGap(5.f) -// ->setMinScale(.1f) -// ->setMaxScale(.5f) -// ->setScalePriority(1) -// ); -// } -// } -// optionsMenu->setContentSize({ 120.f, winSize.height - 100.f }); -// optionsMenu->setPosition(70.f, winSize.height / 2 - 50.f + 10.f); -// optionsMenu->updateLayout(); - -// auto settingsMenu = detachAndCreateMenu( -// this, -// "settings-menu", -// RowLayout::create() -// ->setAxisReverse(true), -// menu->getChildByID("settings-button") -// ); -// settingsMenu->setContentSize({ 95.f, 50.f }); -// settingsMenu->updateLayout(); - -// auto guidelinesMenu = menu; - -// // replace the two guidelines buttons with a single toggle -// guidelinesMenu->getChildByID("guidelines-enable-button")->removeFromParent(); -// guidelinesMenu->getChildByID("guidelines-disable-button")->removeFromParent(); - -// auto glToggle = GuidelinesButton::create(); -// glToggle->setID("guidelines-enable-toggle"); -// guidelinesMenu->insertBefore(glToggle, nullptr); -// m_guidelinesOffButton = m_guidelinesOnButton = nullptr; -// // this->updateSongButton(); - -// guidelinesMenu->setID("guidelines-menu"); -// guidelinesMenu->setContentSize({ winSize.width / 2, 50.f }); -// guidelinesMenu->setLayout(RowLayout::create()); - -// auto topMenu = CCMenu::create(); -// topMenu->setContentSize({ winSize.width / 2, 50.f }); -// topMenu->setPosition(winSize.width / 2, winSize.height - 30.f); -// topMenu->setID("top-menu"); -// topMenu->setLayout(RowLayout::create()); -// this->addChild(topMenu); -// } - -// if (auto menu = detachAndCreateMenu( -// this, "info-menu", -// ColumnLayout::create() -// ->setGap(10.f) -// ->setAxisAlignment(AxisAlignment::End) -// ->setAxisReverse(true) -// ->setCrossAxisOverflow(false) -// ->setCrossAxisAlignment(AxisAlignment::Start) -// ->setCrossAxisLineAlignment(AxisAlignment::Start), -// this->getChildByID("object-count-label"), -// this->getChildByID("length-label"), -// this->getChildByID("length-name-label") -// )) { -// for (auto child : CCArrayExt(menu->getChildren())) { -// child->setLayoutOptions( -// AxisLayoutOptions::create() -// ->setMinScale(.1f) -// ->setMaxScale(.5f) -// ->setBreakLine(true) -// ); -// } -// menu->setContentSize({ 180.f, 100.f }); -// menu->setPosition(100.f, winSize.height - 55.f); -// menu->updateLayout(); -// } -// } - -// struct EditorPauseLayerIDs : Modify { -// static void onModify(auto& self) { -// if (!self.setHookPriority("EditorPauseLayer::init", GEODE_ID_PRIORITY)) { -// log::warn("Failed to set EditorPauseLayer::init hook priority, node IDs may not work properly"); -// } -// } - -// bool init(LevelEditorLayer* lel) { -// if (!EditorPauseLayer::init(lel)) return false; - -// NodeIDs::get()->provide(this); - -// return true; -// } -// }; diff --git a/loader/src/ids/EditorUI.cpp b/loader/src/ids/EditorUI.cpp deleted file mode 100644 index 75fd5474..00000000 --- a/loader/src/ids/EditorUI.cpp +++ /dev/null @@ -1,345 +0,0 @@ -#include "AddIDs.hpp" - -#include -#include -#include - -using namespace geode::prelude; - -// $register_ids(EditorUI) { -// setIDSafe(this, 0, "position-slider"); -// setIDSafe(this, this->getChildrenCount() - 2, "layer-index-label"); -// setIDSafe(this, this->getChildrenCount() - 1, "object-info-label"); - -// auto winSize = CCDirector::get()->getWinSize(); - -// if (auto menu = getChildOfType(this, 0)) { -// menu->setID("toolbar-categories-menu"); - -// setIDs( -// menu, -// 0, -// "build-button", -// "edit-button", -// "delete-button", - -// "swipe-button", -// "free-move-button", -// "snap-button", -// "rotate-button", - -// "undo-button", -// "redo-button", -// "delete-trash-button", - -// "music-playback-button", - -// "playtest-button", -// "stop-playtest-button", - -// "zoom-in-button", -// "zoom-out-button", - -// "link-button", -// "unlink-button" -// ); - -// auto toolbarTogglesMenu = detachAndCreateMenu( -// this, -// "toolbar-toggles-menu", -// RowLayout::create() -// ->setCrossAxisOverflow(false) -// ->setGrowCrossAxis(true) -// ->setAxisAlignment(AxisAlignment::Center) -// ->setCrossAxisAlignment(AxisAlignment::Center), -// menu->getChildByID("swipe-button"), -// menu->getChildByID("rotate-button"), -// menu->getChildByID("free-move-button"), -// menu->getChildByID("snap-button") -// ); -// toolbarTogglesMenu->setPosition( -// winSize.width - 47.f, -// 45.f -// ); -// toolbarTogglesMenu->setContentSize({ 90.f, 90.f }); -// toolbarTogglesMenu->updateLayout(); - -// auto undoMenuWidth = winSize.width / 2 - 90.f; -// auto undoMenu = detachAndCreateMenu( -// this, -// "undo-menu", -// RowLayout::create() -// ->setAxisAlignment(AxisAlignment::Start) -// ->setGap(10.f), -// menu->getChildByID("undo-button"), -// menu->getChildByID("redo-button"), -// menu->getChildByID("delete-trash-button") -// ); -// undoMenu->setContentSize({ undoMenuWidth, 50.f }); -// undoMenu->setPositionX( -// undoMenu->getPositionX() + undoMenuWidth / 2 - -// getSizeSafe(undoMenu->getChildByID("undo-button")).width / 2 -// ); -// undoMenu->updateLayout(); - -// auto playBackMenu = detachAndCreateMenu( -// this, -// "playback-menu", -// RowLayout::create() -// ->setAxisAlignment(AxisAlignment::Start), -// menu->getChildByID("music-playback-button") -// ); -// playBackMenu->setContentSize({ 100.f, 50.f }); -// playBackMenu->setPositionX( -// playBackMenu->getPositionX() + 100.f / 2 - -// getSizeSafe(playBackMenu->getChildByID("music-playback-button")).width / 2 -// ); -// playBackMenu->updateLayout(); - -// auto playTestMenu = detachAndCreateMenu( -// this, -// "playtest-menu", -// RowLayout::create() -// ->setAxisAlignment(AxisAlignment::Start), -// menu->getChildByID("playtest-button"), -// menu->getChildByID("stop-playtest-button") -// ); -// playTestMenu->setContentSize({ 100.f, 50.f }); -// playTestMenu->setPositionX( -// playTestMenu->getPositionX() + 100.f / 2 - -// getSizeSafe(playTestMenu->getChildByID("playtest-button")).width / 2 -// ); -// playTestMenu->updateLayout(); - -// auto zoomMenuHeight = winSize.height - 245.f; -// auto zoomMenu = detachAndCreateMenu( -// this, -// "zoom-menu", -// ColumnLayout::create() -// ->setAxisAlignment(AxisAlignment::Start), -// menu->getChildByID("zoom-out-button"), -// menu->getChildByID("zoom-in-button") -// ); -// zoomMenu->setPositionY(150.f * winSize.height / 320); -// zoomMenu->setContentSize({ 50.f, zoomMenuHeight }); -// zoomMenu->updateLayout(); - -// auto linkMenu = detachAndCreateMenu( -// this, -// "link-menu", -// ColumnLayout::create() -// ->setAxisAlignment(AxisAlignment::Start) -// ->setGrowCrossAxis(true), -// menu->getChildByID("unlink-button"), -// menu->getChildByID("link-button") -// ); -// linkMenu->setPositionY(150.f * winSize.height / 320); -// linkMenu->setContentSize({ 125.f, zoomMenuHeight }); -// linkMenu->updateLayout(); - -// menu->setPosition(42.f, 45.f); -// menu->setContentSize({ 100.f, 90.f }); -// menu->setLayout( -// ColumnLayout::create() -// ->setGap(4.f) -// ->setAxisReverse(true) -// ); -// } - -// if (auto menu = getChildOfType(this, 1)) { -// menu->setID("delete-category-menu"); - -// setIDs( -// menu, -// 0, -// "delete-button", -// "delete-startpos-button", -// "delete-all-of-button", - -// "delete-filter-none", -// "delete-filter-static", -// "delete-filter-detail", -// "delete-filter-custom", - -// "delete-help-icon" -// ); - -// auto deleteButtonMenu = detachAndCreateMenu( -// menu, -// "delete-button-menu", -// ColumnLayout::create() -// ->setCrossAxisOverflow(false) -// ->setGrowCrossAxis(true) -// ->setAxisReverse(true) -// ->setCrossAxisReverse(true) -// ->setAxisAlignment(AxisAlignment::End) -// ->setCrossAxisAlignment(AxisAlignment::Center), -// menu->getChildByID("delete-button"), -// menu->getChildByID("delete-all-of-button"), -// menu->getChildByID("delete-startpos-button") -// ); -// deleteButtonMenu->setPosition(-88.5f, 0.f); -// deleteButtonMenu->setContentSize({ winSize.width / 2 - 120.f, 80.f }); -// deleteButtonMenu->updateLayout(); - -// auto filterMenuWidth = winSize.width / 2 - 150.f; -// auto deleteFilterMenu = detachAndCreateMenu( -// menu, -// "delete-filter-menu", -// ColumnLayout::create() -// ->setCrossAxisOverflow(false) -// ->setGrowCrossAxis(true) -// ->setAxisReverse(true) -// ->setCrossAxisReverse(true) -// ->setAxisAlignment(AxisAlignment::End) -// ->setCrossAxisAlignment(AxisAlignment::Start), -// menu->getChildByID("delete-filter-none"), -// menu->getChildByID("delete-filter-static"), -// menu->getChildByID("delete-filter-detail"), -// menu->getChildByID("delete-filter-custom") -// ); -// deleteFilterMenu->setPosition(48.5f + filterMenuWidth / 2, 0.f); -// deleteFilterMenu->setContentSize({ filterMenuWidth, 80.f }); -// deleteFilterMenu->updateLayout(); -// } - -// if (auto menu = getChildOfType(this, 2)) { -// menu->setID("build-tabs-menu"); - -// setIDs( -// menu, -// 0, -// "block-tab", -// "half-block-tab", -// "outline-tab", -// "slope-tab", -// "hazard-tab", -// "3d-tab", -// "portal-tab", -// "ground-deco-tab", -// "air-deco-tab", -// "pulse-deco-tab", -// "sawblade-tab", -// "trigger-tab", -// "custom-tab" -// ); - -// menu->setPosition(winSize.width / 2, 100.f); -// menu->setContentSize({ winSize.width, 50.f }); -// menu->setLayout( -// RowLayout::create() -// ->setGap(-4.f) -// ); -// } - -// if (auto menu = getChildOfType(this, 3)) { -// setIDs( -// menu, -// 0, -// "pause-button", -// "settings-button", -// "copy-paste-button", -// "copy-button", -// "paste-button", -// "hsv-button", -// "edit-special-button", -// "edit-object-button", -// "deselect-button", -// "edit-group-button", -// "portal-check", -// "copy-values-button", -// "paste-state-button", -// "paste-color-button", -// "go-to-layer-button", -// "next-layer-button", -// "prev-layer-button", -// "all-layers-button" -// ); - -// auto topRightMenuWidth = winSize.width / 2 - 140.f; -// auto topRightMenu = detachAndCreateMenu( -// this, -// "settings-menu", -// RowLayout::create() -// ->setAxisReverse(true) -// ->setAxisAlignment(AxisAlignment::End), -// menu->getChildByID("pause-button"), -// menu->getChildByID("settings-button") -// ); -// topRightMenu->setContentSize({ topRightMenuWidth, 60.f }); -// topRightMenu->setPositionX( -// topRightMenu->getPositionX() - topRightMenuWidth / 2 + -// getSizeSafe(topRightMenu->getChildByID("pause-button")).width / 2 -// ); -// topRightMenu->updateLayout(); - -// auto rightMenu = detachAndCreateMenu( -// this, -// "editor-buttons-menu", -// ColumnLayout::create() -// ->setAxisAlignment(AxisAlignment::End) -// ->setCrossAxisAlignment(AxisAlignment::End) -// ->setGap(-3.5f) -// ->setGrowCrossAxis(true) -// ->setCrossAxisOverflow(false) -// ->setAxisReverse(true), -// menu->getChildByID("copy-paste-button"), -// menu->getChildByID("edit-object-button"), -// menu->getChildByID("paste-color-button"), -// menu->getChildByID("deselect-button"), -// menu->getChildByID("paste-button"), -// menu->getChildByID("edit-group-button"), -// menu->getChildByID("paste-state-button"), -// menu->getChildByID("go-to-layer-button"), -// menu->getChildByID("copy-button"), -// menu->getChildByID("edit-special-button"), -// menu->getChildByID("copy-values-button"), -// menu->getChildByID("hsv-button") -// ); -// for (auto btn : CCArrayExt(rightMenu->getChildren())) { -// btn->setContentSize({ 40.f, 40.f }); -// } -// rightMenu->setContentSize({ 210.f, 160.f }); -// rightMenu->setPosition( -// winSize.width - 210.f / 2 - 5.f, -// winSize.height / 2 + 42.5f -// ); -// rightMenu->updateLayout(); - -// this->getChildByID("layer-index-label")->setLayoutOptions( -// AxisLayoutOptions::create() -// ->setAutoScale(false) -// ->setLength(25.f) -// ); - -// auto layerMenu = detachAndCreateMenu( -// this, -// "layer-menu", -// RowLayout::create() -// ->setAxisAlignment(AxisAlignment::Start), -// menu->getChildByID("all-layers-button"), -// menu->getChildByID("prev-layer-button"), -// this->getChildByID("layer-index-label"), -// menu->getChildByID("next-layer-button") -// ); -// layerMenu->setPositionX(winSize.width - 110.f / 2); -// layerMenu->setContentSize({ 110.f, 30.f }); -// layerMenu->updateLayout(); -// } -// } - -// struct EditorUIIDs : Modify { -// static void onModify(auto& self) { -// if (!self.setHookPriority("EditorUI::init", GEODE_ID_PRIORITY)) { -// log::warn("Failed to set EditorUI::init hook priority, node IDs may not work properly"); -// } -// } - -// bool init(LevelEditorLayer* lel) { -// if (!EditorUI::init(lel)) return false; - -// NodeIDs::get()->provide(this); - -// return true; -// } -// }; diff --git a/loader/src/ids/GJGarageLayer.cpp b/loader/src/ids/GJGarageLayer.cpp deleted file mode 100644 index b6160523..00000000 --- a/loader/src/ids/GJGarageLayer.cpp +++ /dev/null @@ -1,177 +0,0 @@ -#include "AddIDs.hpp" - -#include -#include -#include - -using namespace geode::prelude; - -// $register_ids(GJGarageLayer) { -// // the lock does not exist for not logged in users -// auto loggedInOffset = GJAccountManager::get()->m_accountID == GJAccountManager::get()->m_playerID ? -1 : 0; -// if (loggedInOffset == -1 && !GameManager::get()->m_clickedName) { -// // adjusts for the sprite asking for your name -// loggedInOffset++; -// } - -// setIDSafe(this, 0, "username-label"); -// setIDSafe(this, 0, "player-icon"); - -// auto winSize = CCDirector::get()->getWinSize(); - -// if (auto menu = getChildOfType(this, 0)) { -// menu->setID("category-menu"); - -// setIDs( -// menu, -// 0, -// "cube-button", -// "ship-button", -// "ball-button", -// "ufo-button", -// "wave-button", -// "robot-button", -// "spider-button", -// "trail-button", -// "death-effect-button" -// ); - -// menu->setContentSize({ 320.f, 50.f }); -// menu->setLayout( -// RowLayout::create() -// ->setAxisAlignment(AxisAlignment::Start) -// ->setGap(-4.f) -// ); -// } - -// setIDs( -// this, -// 10 + loggedInOffset, -// "cube-selection-menu", -// "ship-selection-menu", -// "ball-selection-menu", -// "ufo-selection-menu", -// "wave-selection-menu", -// "robot-selection-menu", -// "spider-selection-menu", -// "trail-selection-menu", -// "death-effect-selection-menu", - -// "color-1-cursor", -// "color-2-cursor", - -// "color-selection-menu" -// ); - -// if (auto menu = getChildOfType(this, 1)) { -// menu->setID("top-left-menu"); - -// setIDs(menu, 0, "back-button", "shop-button", "shards-button"); - -// auto backBtn = menu->getChildByID("back-button"); -// auto backMenu = detachAndCreateMenu( -// this, -// "back-menu", -// RowLayout::create() -// ->setAxisAlignment(AxisAlignment::Start), -// backBtn -// ); -// backMenu->setContentSize({ 100.f, 50.f }); -// backMenu->setPositionX( -// backMenu->getPositionX() + 100.f / 2 - -// getSizeSafe(backBtn).width / 2 -// ); -// backMenu->updateLayout(); - -// auto shardsBtn = menu->getChildByID("shards-button"); -// auto shardsMenu = detachAndCreateMenu( -// this, -// "shards-menu", -// ColumnLayout::create() -// ->setAxisReverse(true) -// ->setAxisAlignment(AxisAlignment::End), -// shardsBtn -// ); -// shardsMenu->setContentSize({ 50.f, 100.f }); -// shardsMenu->setPositionY( -// shardsMenu->getPositionY() - 100.f / 2 + -// getSizeSafe(shardsBtn).height / 2 -// ); -// shardsMenu->updateLayout(); -// } - -// auto bottomLeftMenu = CCMenu::create(); -// bottomLeftMenu->setID("bottom-left-menu"); -// bottomLeftMenu->setContentSize({ 50.f, 70.f }); -// bottomLeftMenu->setPosition(30.f, 115.f); -// bottomLeftMenu->setLayout( -// ColumnLayout::create() -// ->setAxisAlignment(AxisAlignment::Start) -// ); -// this->addChild(bottomLeftMenu); - -// auto bottomRightMenu = CCMenu::create(); -// bottomRightMenu->setID("bottom-right-menu"); -// bottomRightMenu->setContentSize({ 50.f, 110.f }); -// bottomRightMenu->setPosition(winSize.width - 30.f, 135.f); -// bottomRightMenu->setLayout( -// ColumnLayout::create() -// ->setAxisAlignment(AxisAlignment::Start) -// ); -// this->addChild(bottomRightMenu); - -// // aspect ratio responsiveness -// if (winSize.width / winSize.height <= 5.1f / 3.f) { -// bottomLeftMenu->setPosition(15.f, 115.f); -// bottomRightMenu->setPosition(winSize.width - 15.f, 135.f); - -// if (auto shardsMenu = this->getChildByID("shards-menu")) { -// shardsMenu->setContentSize({ 110.f, 50.f }); -// shardsMenu->setPosition( -// shardsMenu->getPosition() + ccp(50.f, 30.f) -// ); -// shardsMenu->setLayout( -// RowLayout::create() -// ->setAxisAlignment(AxisAlignment::Start) -// ); -// } -// } -// if (winSize.width / winSize.height <= 4.1f / 3.f) { -// bottomLeftMenu->setContentSize({ 90.f, 50.f }); -// bottomLeftMenu->setPosition( -// 15.f + 110.f / 2, -// 85.f -// ); -// bottomLeftMenu->setLayout( -// RowLayout::create() -// ->setAxisAlignment(AxisAlignment::Start) -// ); - -// bottomRightMenu->setContentSize({ 90.f, 50.f }); -// bottomRightMenu->setPosition( -// winSize.width - 15.f - 110.f / 2, -// 85.f -// ); -// bottomRightMenu->setLayout( -// RowLayout::create() -// ->setAxisReverse(true) -// ->setAxisAlignment(AxisAlignment::End) -// ); -// } -// } - -// struct GJGarageLayerIDs : Modify { -// static void onModify(auto& self) { -// if (!self.setHookPriority("GJGarageLayer::init", GEODE_ID_PRIORITY)) { -// log::warn("Failed to set GJGarageLayer::init hook priority, node IDs may not work properly"); -// } -// } - -// bool init() { -// if (!GJGarageLayer::init()) return false; - -// NodeIDs::get()->provide(this); - -// return true; -// } -// }; diff --git a/loader/src/ids/LevelBrowserLayer.cpp b/loader/src/ids/LevelBrowserLayer.cpp deleted file mode 100644 index 45845c20..00000000 --- a/loader/src/ids/LevelBrowserLayer.cpp +++ /dev/null @@ -1,173 +0,0 @@ -#include "AddIDs.hpp" - -#include -#include -#include - -using namespace geode::prelude; - -// $register_ids(LevelBrowserLayer) { -// auto winSize = CCDirector::get()->getWinSize(); - -// if (auto menu = getChildOfType(this, 0)) { -// menu->setID("back-menu"); -// auto btn = setIDSafe(menu, 0, "back-button"); -// menu->setContentSize({ 100.f, 50.f }); -// menu->setPositionX( -// menu->getPositionX() + 100.f / 2 - -// getSizeSafe(btn).width / 2 -// ); -// menu->setLayout( -// RowLayout::create() -// ->setAxisAlignment(AxisAlignment::Start) -// ); -// } - -// if (m_searchObject->m_searchType == SearchType::MyLevels) { -// if (auto menu = getChildOfType(this, 2)) { -// menu->setID("new-level-menu"); -// auto newLvlBtn = setIDSafe(menu, 0, "new-level-button"); - -// if (auto myLevelsBtn = setIDSafe(menu, 1, "my-levels-button")) { -// auto menu = detachAndCreateMenu( -// this, -// "my-levels-menu", -// ColumnLayout::create() -// ->setAxisAlignment(AxisAlignment::Start), -// myLevelsBtn -// ); -// menu->setPositionY( -// menu->getPositionY() + 125.f / 2 - -// myLevelsBtn->getScaledContentSize().height / 2 -// ); -// menu->setContentSize({ 50.f, 125.f }); -// menu->updateLayout(); -// } - -// menu->setLayout( -// ColumnLayout::create() -// ->setAxisAlignment(AxisAlignment::Start) -// ); -// menu->setPositionY( -// menu->getPositionY() + 130.f / 2 - -// getSizeSafe(newLvlBtn).height / 2 -// ); -// menu->setContentSize({ 50.f, 130.f }); -// menu->updateLayout(); -// } - -// if (auto menu = getChildOfType(this, 1)) { -// if (auto searchBtn = setIDSafe(menu, 5, "search-button")) { -// auto clearBtn = setIDSafe(menu, 6, "clear-search-button"); -// // this is a hacky fix because for some reason adding children -// // before the clear button is made visible is inconsistent -// if (clearBtn) { -// searchBtn->setZOrder(-1); -// clearBtn->setZOrder(-1); -// } -// auto searchMenu = detachAndCreateMenu( -// this, -// "search-menu", -// ColumnLayout::create() -// ->setAxisReverse(true) -// ->setCrossAxisReverse(true) -// ->setGrowCrossAxis(true) -// ->setCrossAxisOverflow(false) -// ->setCrossAxisAlignment(AxisAlignment::Start) -// ->setAxisAlignment(AxisAlignment::End), -// searchBtn, -// clearBtn -// ); -// auto width = 45.f * winSize.aspect(); -// searchMenu->setPosition( -// searchMenu->getPositionX() + width / 2 - -// searchBtn->getScaledContentSize().width / 2, -// searchMenu->getPositionY() - 80.f / 2 + -// searchBtn->getScaledContentSize().height / 2 -// ); -// searchMenu->setContentSize({ width, 80.f }); -// searchMenu->updateLayout(); -// } - -// if (auto pageBtn = setIDSafe(menu, 2, "page-button")) { -// auto folderBtn = setIDSafe(menu, 3, "folder-button"); -// auto lastPageBtn = setIDSafe(menu, 4, "last-page-button"); -// auto pageMenu = detachAndCreateMenu( -// this, -// "page-menu", -// ColumnLayout::create() -// ->setAxisReverse(true) -// ->setGrowCrossAxis(true) -// ->setAxisAlignment(AxisAlignment::End), -// pageBtn, -// folderBtn, -// lastPageBtn -// ); -// pageMenu->setContentSize({ 40.f, 110.f }); -// pageMenu->setAnchorPoint({ 1.f, .5f }); -// pageMenu->setPosition( -// pageMenu->getPositionX() + 20.f, -// pageMenu->getPositionY() - 110.f / 2 + 12.5f -// ); -// pageMenu->updateLayout(); -// } - -// auto navMenuWidth = 50.f * winSize.aspect(); - -// if (auto prevPageBtn = setIDSafe(menu, 0, "prev-page-button")) { -// auto navMenu = detachAndCreateMenu( -// this, -// "prev-page-menu", -// RowLayout::create() -// ->setAxisAlignment(AxisAlignment::Start), -// prevPageBtn -// ); -// prevPageBtn->setZOrder(-1); -// navMenu->setContentSize({ navMenuWidth, 40.f }); -// navMenu->setPositionX( -// navMenu->getPositionX() + navMenuWidth / 2 - -// prevPageBtn->getScaledContentSize().width / 2 -// ); -// navMenu->updateLayout(); -// } - -// auto nextPageBtn = setIDSafe(menu, 0, "next-page-button"); - -// menu->setID("next-page-menu"); -// menu->setLayout( -// RowLayout::create() -// ->setAxisReverse(true) -// ->setAxisAlignment(AxisAlignment::End) -// ); -// menu->setContentSize({ navMenuWidth, 40.f }); -// menu->setPositionX( -// winSize.width - navMenuWidth / 2 - 5.f -// ); -// menu->updateLayout(); -// } -// } - -// auto bottomMenu = CCMenu::create(); -// bottomMenu->setID("bottom-menu"); -// bottomMenu->setContentSize({ 325.f + 20.f * winSize.aspect(), 50.f }); -// bottomMenu->setPosition(winSize.width / 2, 28.f); -// bottomMenu->setZOrder(15); -// bottomMenu->setLayout(RowLayout::create()); -// this->addChild(bottomMenu); -// } - -// struct LevelBrowserLayerIDs : Modify { -// static void onModify(auto& self) { -// if (!self.setHookPriority("LevelBrowserLayer::init", GEODE_ID_PRIORITY)) { -// log::warn("Failed to set LevelBrowserLayer::init hook priority, node IDs may not work properly"); -// } -// } - -// bool init(GJSearchObject* obj) { -// if (!LevelBrowserLayer::init(obj)) return false; - -// NodeIDs::get()->provide(this); - -// return true; -// } -// }; \ No newline at end of file diff --git a/loader/src/ids/LevelInfoLayer.cpp b/loader/src/ids/LevelInfoLayer.cpp deleted file mode 100644 index a858a677..00000000 --- a/loader/src/ids/LevelInfoLayer.cpp +++ /dev/null @@ -1,137 +0,0 @@ -#include "AddIDs.hpp" - -#include -#include - -// $register_ids(LevelInfoLayer) { -// auto winSize = CCDirector::get()->getWinSize(); - -// setIDSafe(this, 0, "background"); - -// size_t iconOffset = 0; - -// setIDSafe(this, 1, "bottom-left-art"); -// setIDSafe(this, 2, "bottom-right-art"); - -// if (m_level->m_highObjectsEnabled) { -// setIDSafe(this, 4, "high-object-indicator"); -// iconOffset++; -// } - -// setIDSafe(this, 4 + iconOffset, "length-icon"); -// setIDSafe(this, 5 + iconOffset, "downloads-icon"); -// setIDSafe(this, 6 + iconOffset, "orbs-icon"); -// setIDSafe(this, 7 + iconOffset, "likes-icon"); -// setIDSafe(this, 1, "downloads-label"); -// setIDSafe(this, 2, "length-label"); -// setIDSafe(this, 3, "likes-label"); -// setIDSafe(this, 4, "orbs-label"); - -// if (m_level->m_stars) { -// setIDSafe(this, 8 + iconOffset, "stars-icon"); -// setIDSafe(this, 5, "stars-label"); -// } - -// setIDSafe(this, 0, "custom-songs-widget"); - -// if (auto menu = getChildOfType(this, 0)) { -// menu->setID("play-menu"); -// setIDSafe(menu, 0, "play-button"); -// } - -// if (auto menu = getChildOfType(this, 2)) { -// menu->setID("back-menu"); -// auto backBtn = setIDSafe(menu, 0, "back-button"); -// menu->setPositionX( -// menu->getPositionX() + 100.f / 2 - -// getSizeSafe(backBtn).width / 2 -// ); -// menu->setContentSize({ 100.f, 50.f }); -// menu->setLayout( -// RowLayout::create() -// ->setAxisAlignment(AxisAlignment::Start) -// ); -// } - -// if (auto menu = getChildOfType(this, 1)) { -// menu->setID("right-side-menu"); - -// if (auto name = setIDSafe(menu, 0, "creator-name")) { -// auto menu = detachAndCreateMenu( -// this, -// "creator-info-menu", -// ColumnLayout::create() -// ->setAxisReverse(true) -// ->setAxisAlignment(AxisAlignment::End), -// name -// ); -// menu->setPositionY( -// menu->getPositionY() - 40.f / 2 + -// name->getScaledContentSize().height / 2 -// ); -// menu->setContentSize({ 60.f, 40.f }); -// menu->updateLayout(); -// } - -// auto leftSideMenu = CCMenu::create(); -// leftSideMenu->setPosition(30.f, winSize.height / 2); -// leftSideMenu->setLayout(ColumnLayout::create()); -// leftSideMenu->setID("left-side-menu"); -// leftSideMenu->setContentSize({ 50.f, 225.f }); -// this->addChild(leftSideMenu); - -// menu->setPosition(winSize.width - 30.f, winSize.height / 2); - -// for (auto child : CCArrayExt(menu->getChildren())) { -// if (child->getPositionX() < 0.f) { -// child->retain(); -// child->removeFromParent(); -// leftSideMenu->addChild(child); -// child->release(); -// } -// child->setPositionX(0.f); -// } - -// setIDSafe(menu, 0, "delete-button"); -// setIDSafe(menu, 1, "refresh-button"); -// setIDSafe(menu, 2, "info-button"); -// setIDSafe(menu, 3, "leaderboards-button"); -// setIDSafe(menu, 4, "like-button"); -// setIDSafe(menu, 5, "rate-button"); - -// menu->setPosition( -// menu->getPositionX() + static_cast( -// menu->getChildren()->firstObject() -// )->getPositionX(), -// winSize.height / 2 -// ); -// menu->setContentSize({ 60.f, winSize.height - 15.f }); -// menu->setLayout( -// ColumnLayout::create() -// ->setGap(3.f) -// ->setAxisAlignment(AxisAlignment::End) -// ->setAxisReverse(true) -// ); - -// setIDSafe(leftSideMenu, 0, "copy-button"); - -// menu->updateLayout(); -// leftSideMenu->updateLayout(); -// } -// } - -// struct LevelInfoLayerIDs : Modify { -// static void onModify(auto& self) { -// if (!self.setHookPriority("LevelInfoLayer::init", GEODE_ID_PRIORITY)) { -// log::warn("Failed to set LevelInfoLayer::init hook priority, node IDs may not work properly"); -// } -// } - -// bool init(GJGameLevel* level) { -// if (!LevelInfoLayer::init(level)) return false; - -// NodeIDs::get()->provide(this); - -// return true; -// } -// }; \ No newline at end of file diff --git a/loader/src/ids/LevelSearchLayer.cpp b/loader/src/ids/LevelSearchLayer.cpp deleted file mode 100644 index 3c129f9a..00000000 --- a/loader/src/ids/LevelSearchLayer.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#include "AddIDs.hpp" - -#include - -// $register_ids(LevelSearchLayer) { -// // set the funny ids -// setIDSafe(this, 0, "background"); -// getChildOfType(this, 0)->setID("search-bar"); -// getChildOfType(this, 0)->setID("level-search-bg"); -// getChildOfType(this, 1)->setID("level-search-bar-bg"); -// getChildOfType(this, 2)->setID("quick-search-bg"); -// getChildOfType(this, 3)->setID("difficulty-filters-bg"); -// getChildOfType(this, 4)->setID("length-filters-bg"); -// getChildOfType(this, 0)->setID("quick-search-title"); -// getChildOfType(this, 1)->setID("filters-title"); -// getChildOfType(this, 1)->setID("left-corner"); -// getChildOfType(this, 2)->setID("right-corner"); - -// if (auto filtermenu = getChildOfType(this, 0)) { -// filtermenu->setID("other-filter-menu"); -// setIDSafe(filtermenu, 0, "clear-filters-button"); -// setIDSafe(filtermenu, 1, "advanced-filters-button"); -// } -// if (auto searchmenu = getChildOfType(this, 1)) { -// searchmenu->setID("search-button-menu"); -// setIDSafe(searchmenu, 0, "search-level-button"); -// setIDSafe(searchmenu, 1, "search-user-button"); -// } -// if (auto quickmenu = getChildOfType(this, 2)) { -// quickmenu->setID("quick-search-menu"); -// setIDSafe(quickmenu, 0, "most-downloaded-button"); -// setIDSafe(quickmenu, 1, "most-liked-button"); -// setIDSafe(quickmenu, 2, "trending-button"); -// setIDSafe(quickmenu, 3, "recent-button"); -// setIDSafe(quickmenu, 4, "magic-button"); -// setIDSafe(quickmenu, 5, "awarded-button"); -// setIDSafe(quickmenu, 6, "followed-button"); -// setIDSafe(quickmenu, 7, "friends-button"); -// } -// if (auto filtersmenu = getChildOfType(this, 3)) { -// filtersmenu->setID("difficulty-filter-menu"); -// setIDSafe(filtersmenu, 0, "na-filter-button"); -// setIDSafe(filtersmenu, 1, "easy-filter-button"); -// setIDSafe(filtersmenu, 2, "normal-filter-button"); -// setIDSafe(filtersmenu, 3, "hard-filter-button"); -// setIDSafe(filtersmenu, 4, "harder-filter-button"); -// setIDSafe(filtersmenu, 5, "insane-filter-button"); -// setIDSafe(filtersmenu, 6, "demon-filter-button"); -// setIDSafe(filtersmenu, 7, "auto-filter-button"); -// setIDSafe(filtersmenu, 8, "demon-type-filter-button"); -// } -// if (auto filtersmenu = getChildOfType(this, 4)) { -// filtersmenu->setID("length-filter-menu"); -// setIDSafe(filtersmenu, 0, "clock-icon"); -// setIDSafe(filtersmenu, 1, "tiny-filter-button"); -// setIDSafe(filtersmenu, 2, "short-filter-button"); -// setIDSafe(filtersmenu, 3, "medium-filter-button"); -// setIDSafe(filtersmenu, 4, "long-filter-button"); -// setIDSafe(filtersmenu, 5, "xl-filter-button"); -// setIDSafe(filtersmenu, 6, "star-filter-button"); -// } -// if (auto backmenu = getChildOfType(this, 5)) { -// backmenu->setID("exit-menu"); -// setIDSafe(backmenu, 0, "exit-button"); -// } -// } - -// struct LevelSearchLayerIDs : Modify { -// static void onModify(auto& self) { -// if (!self.setHookPriority("LevelSearchLayer::init", GEODE_ID_PRIORITY)) { -// log::warn("Failed to set LevelSearchLayer::init hook priority, node IDs may not work properly"); -// } -// } - -// bool init() { -// if (!LevelSearchLayer::init()) return false; - -// NodeIDs::get()->provide(this); - -// return true; -// } -// }; diff --git a/loader/src/ids/LevelSettingsLayer.cpp b/loader/src/ids/LevelSettingsLayer.cpp deleted file mode 100644 index 4a85aa92..00000000 --- a/loader/src/ids/LevelSettingsLayer.cpp +++ /dev/null @@ -1,216 +0,0 @@ -#include "AddIDs.hpp" - -#include -#include -#include - -using namespace geode::prelude; - -// $register_ids(LevelSettingsLayer) { -// bool startPos = m_mainLayer->getChildrenCount() < 10; - -// if (startPos) { -// setIDSafe(m_mainLayer, 0, "back-button"); -// } - -// if (auto menu = getChildOfType(m_mainLayer, 0)) { -// menu->setID("song-select-menu"); - -// if (startPos) { -// setIDs( -// menu, -// 0, -// "cube-button", -// "ship-button", -// "ball-button", -// "ufo-button", -// "wave-button", -// "robot-button", -// "spider-button", -// "mini-toggle", -// "dual-toggle", -// "ok-button", -// "flip-gravity-toggle", -// "half-speed-button", -// "normal-speed-button", -// "2x-speed-button", -// "3x-speed-button", -// "4x-speed-button" -// ); -// } -// else { -// setIDs( -// menu, -// 0, -// "bg-color-button", -// "g-color-button", -// "g2-color-button", -// "line-color-button", -// "obj-color-button", -// "more-color-button", -// "3dl-color-button", -// "bg-quick-edit-button", -// "g-quick-edit-button", -// "g2-quick-edit-button", -// "line-quick-edit-button", -// "cube-button", -// "ship-button", -// "ball-button", -// "ufo-button", -// "wave-button", -// "robot-button", -// "spider-button", -// "background-select-button", -// "ground-select-button", -// "mini-toggle", -// "dual-toggle", -// "font-button", -// "ok-button", -// "2-player-toggle", -// "2-player-help-button", -// "prev-song-button", -// "next-song-button", -// "normal-song-button", -// "custom-song-button", -// "select-custom-song-button", -// "new-song-button", -// "half-speed-button", -// "normal-speed-button", -// "2x-speed-button", -// "3x-speed-button", -// "4x-speed-button" -// ); -// } - -// detachAndCreateMenu( -// this, -// "vehicle-selection-menu", -// RowLayout::create(), -// menu->getChildByID("cube-button"), -// menu->getChildByID("ship-button"), -// menu->getChildByID("ball-button"), -// menu->getChildByID("ufo-button"), -// menu->getChildByID("wave-button"), -// menu->getChildByID("robot-button"), -// menu->getChildByID("spider-button") -// ); - -// detachAndCreateMenu( -// this, -// "right-toggle-menu", -// ColumnLayout::create(), -// menu->getChildByID("mini-toggle"), -// menu->getChildByID("dual-toggle") -// ); - -// detachAndCreateMenu( -// this, -// "speed-selection-menu", -// ColumnLayout::create(), -// menu->getChildByID("half-speed-button"), -// menu->getChildByID("normal-song-button"), -// menu->getChildByID("2x-speed-button"), -// menu->getChildByID("3x-speed-button"), -// menu->getChildByID("4x-speed-button") -// ); - -// if (startPos) { -// detachAndCreateMenu( -// this, -// "flip-gravity-menu", -// ColumnLayout::create(), -// menu->getChildByID("flip-gravity-toggle") -// ); -// } -// else { -// detachAndCreateMenu( -// this, -// "color-button-menu", -// RowLayout::create(), -// menu->getChildByID("bg-color-button"), -// menu->getChildByID("g-color-button"), -// menu->getChildByID("g2-color-button"), -// menu->getChildByID("line-color-button"), -// menu->getChildByID("obj-color-button"), -// menu->getChildByID("3dl-color-button"), -// menu->getChildByID("more-color-button") -// ); - -// detachAndCreateMenu( -// this, -// "color-quick-edit-menu", -// RowLayout::create(), -// menu->getChildByID("bg-quick-edit-button"), -// menu->getChildByID("g-quick-edit-button"), -// menu->getChildByID("g2-quick-edit-button"), -// menu->getChildByID("line-quick-edit-button") -// ); - -// detachAndCreateMenu( -// this, -// "scenery-selection-menu", -// ColumnLayout::create(), -// menu->getChildByID("background-select-button"), -// menu->getChildByID("ground-select-button") -// ); - -// detachAndCreateMenu( -// this, -// "2-player-menu", -// ColumnLayout::create(), -// menu->getChildByID("2-player-help-button"), -// menu->getChildByID("2-player-toggle") -// ); - -// auto fontButtonMenu = detachAndCreateMenu( -// this, -// "font-button-menu", -// RowLayout::create() -// ->setAxisAlignment(AxisAlignment::End), -// menu->getChildByID("font-button") -// ); -// fontButtonMenu->setPositionY(fontButtonMenu->getPositionY() - 100.f / 2); -// fontButtonMenu->setContentSize({ 50.f, 100.f }); -// } -// } - -// setIDs( -// m_mainLayer, -// 2, -// "select-color-label", -// "bg-color-label", -// "g-color-label", -// "g2-color-label", -// "3dl-color-label", -// "line-color-label", -// "obj-color-label", -// "more-color-label", -// "select-mode-label", -// "bg-selection-label", -// "g-selection-label", -// "mini-label", -// "dual-label", -// "2-player-label-1", -// "2-player-label-2", -// "select-song-label", -// "default-song-label", -// "custom-song-widget", -// "speed-label" -// ); -// } - -// struct LevelSettingsLayerIDs : Modify { -// static void onModify(auto& self) { -// if (!self.setHookPriority("LevelSettingsLayer::init", GEODE_ID_PRIORITY)) { -// log::warn("Failed to set LevelSettingsLayer::init hook priority, node IDs may not work properly"); -// } -// } - -// bool init(LevelSettingsObject* levelSettings, LevelEditorLayer* editor) { -// if (!LevelSettingsLayer::init(levelSettings, editor)) return false; - -// // NodeIDs::get()->provide(this); - -// return true; -// } -// }; diff --git a/loader/src/ids/MenuLayer.cpp b/loader/src/ids/MenuLayer.cpp index 70f6486f..acaad823 100644 --- a/loader/src/ids/MenuLayer.cpp +++ b/loader/src/ids/MenuLayer.cpp @@ -1,10 +1,11 @@ -#include "AddIDs.hpp" - +#include #include #include +#include #include using namespace geode::prelude; +using namespace geode::node_ids; $register_ids(MenuLayer) { // set IDs to everything diff --git a/loader/src/ids/PauseLayer.cpp b/loader/src/ids/PauseLayer.cpp deleted file mode 100644 index 22b089cf..00000000 --- a/loader/src/ids/PauseLayer.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include "AddIDs.hpp" - -#include -#include -#include - -using namespace geode::prelude; - -// $register_ids(PauseLayer) { -// setIDs( -// this, -// 0, -// "background", -// "level-name", - -// "normal-progress-bar", -// "practice-progress-bar", -// "normal-progress-label", -// "practice-progress-label", -// "normal-mode-label", -// "practice-mode-label", - -// "center-button-menu", - -// "auto-retry-label", -// "auto-checkpoints-label", -// "show-progress-bar-label" -// ); - -// if (auto menu = this->getChildByID("center-button-menu")) { -// int start_idx = 0; - -// if (menu->getChildrenCount() == 5) { -// setIDSafe(menu, 0, "edit-button"); -// start_idx = 1; -// } - -// setIDs(menu, start_idx, "practice-button", "play-button", "exit-button"); - -// if (menu->getChildrenCount() == 4) setIDSafe(menu, start_idx + 3, "retry-button"); -// } - -// // Record toggle on mobile -// if (auto label = typeinfo_cast(getChild(this, 12))) { -// setIDSafe(this, 12, "record-label"); -// } - -// if (auto menu = getChildOfType(this, 1)) { -// menu->setID("toggle-menu"); - -// setIDs(menu, 0, "auto-retry-toggle", "auto-checkpoints-toggle", "show-progress-bar-toggle"); - -// if (menu->getChildrenCount() == 4) setIDSafe(menu, 3, "record-toggle"); -// } - -// setIDs( -// this, this->getChildrenCount() - 4, "music-slider", "sfx-slider", "music-label", "sfx-label" -// ); -// } - -// struct PauseLayerIDs : Modify { -// static void onModify(auto& self) { -// if (!self.setHookPriority("PauseLayer::customSetup", GEODE_ID_PRIORITY)) { -// log::warn("Failed to set PauseLayer::customSetup hook priority, node IDs may not work properly"); -// } -// } - -// void customSetup() { -// PauseLayer::customSetup(); - -// NodeIDs::get()->provide(this); -// } -// }; diff --git a/loader/src/ids/UILayer.cpp b/loader/src/ids/UILayer.cpp deleted file mode 100644 index bbe21498..00000000 --- a/loader/src/ids/UILayer.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "AddIDs.hpp" - -#include -#include -#include - -using namespace geode::prelude; - -// $register_ids(UILayer) { -// if (auto menu = getChildOfType(this, 0)) { -// menu->setID("pause-button-menu"); - -// setIDs(menu, 0, "pause-button"); -// } - -// if (auto menu = getChildOfType(this, 1)) { -// menu->setID("checkpoint-menu"); - -// setIDs(menu, 0, "add-checkpoint-button", "remove-checkpoint-button"); -// } -// } - -// struct UILayerIDs : Modify { -// static void onModify(auto& self) { -// if (!self.setHookPriority("UILayer::init", GEODE_ID_PRIORITY)) { -// log::warn("Failed to set UILayer::init hook priority, node IDs may not work properly"); -// } -// } - -// bool init() { -// if (!UILayer::init()) return false; - -// NodeIDs::get()->provide(this); - -// return true; -// } -// };