format src/ids

This commit is contained in:
altalk23 2022-12-31 16:43:29 +03:00
parent 0ee60d2903
commit eb0ef4c045
12 changed files with 462 additions and 474 deletions

View file

@ -1,7 +1,7 @@
#include <cocos2d.h>
#include <Geode/modify/CCFileUtils.hpp>
#include <Geode/utils/ranges.hpp>
#include <cocos2d.h>
USE_GEODE_NAMESPACE();
@ -29,7 +29,7 @@ void CCFileUtils::removeTexturePack(std::string const& id) {
this->updatePaths();
}
void CCFileUtils::addPriorityPath(const char* path) {
void CCFileUtils::addPriorityPath(char const* path) {
PATHS.insert(PATHS.begin(), path);
this->updatePaths();
}
@ -78,12 +78,11 @@ void CCFileUtils::updatePaths() {
this->addSearchPath(path.c_str());
}
DONT_ADD_PATHS = false;
}
#pragma warning(pop)
class $modify(CCFileUtils) {
struct FileUtilsUpdatePaths : Modify<FileUtilsUpdatePaths, CCFileUtils> {
static CCFileUtils* sharedFileUtils() {
static bool doAddPaths = true;
auto ret = CCFileUtils::sharedFileUtils();

View file

@ -1,8 +1,9 @@
#include <Geode/Modify.hpp>
#include <Geode/Bindings.hpp>
#include <Geode/utils/cocos.hpp>
#include "AddIDs.hpp"
#include <Geode/Bindings.hpp>
#include <Geode/Modify.hpp>
#include <Geode/utils/cocos.hpp>
USE_GEODE_NAMESPACE();
$register_ids(CreatorLayer) {
@ -21,11 +22,13 @@ $register_ids(CreatorLayer) {
setIDSafe(menu, 7, "hall-of-fame-button");
setIDSafe(menu, 8, "map-packs-button");
setIDSafe(menu, 9, "search-button");
setIDSafe(menu, 10,"gauntlets-button");
setIDSafe(menu, 10, "gauntlets-button");
// move vault button to its own menu
if (auto lockBtn = setIDSafe(menu, -2, "vault-button")) {
detachAndCreateMenu(this, "top-right-menu",
detachAndCreateMenu(
this,
"top-right-menu",
ColumnLayout::create(5.f, 0.f)->setAlignment(Alignment::Begin),
lockBtn
);
@ -33,7 +36,9 @@ $register_ids(CreatorLayer) {
// move treasure room button to its own menu
if (auto roomBtn = setIDSafe(menu, -1, "treasure-room-button")) {
detachAndCreateMenu(this, "bottom-right-menu",
detachAndCreateMenu(
this,
"bottom-right-menu",
ColumnLayout::create(5.f, 0.f)->setAlignment(Alignment::End),
roomBtn
);
@ -46,11 +51,10 @@ $register_ids(CreatorLayer) {
}
}
class $modify(CreatorLayer) {
struct CreatorLayerIDs : Modify<CreatorLayerIDs, CreatorLayer> {
bool init() {
if (!CreatorLayer::init())
return false;
if (!CreatorLayer::init()) return false;
NodeIDs::get()->provide(this);
return true;

View file

@ -1,12 +1,15 @@
#include <Geode/modify/EditLevelLayer.hpp>
#include <Geode/Bindings.hpp>
#include <Geode/utils/cocos.hpp>
#include "AddIDs.hpp"
#include <Geode/Bindings.hpp>
#include <Geode/modify/EditLevelLayer.hpp>
#include <Geode/utils/cocos.hpp>
USE_GEODE_NAMESPACE();
$register_ids(EditLevelLayer) {
setIDs(this, 0,
setIDs(
this,
0,
"background",
"bottom-left-art",
"bottom-right-art",
@ -27,15 +30,13 @@ $register_ids(EditLevelLayer) {
);
if (auto menu = this->getChildByID("level-action-menu")) {
setIDs(menu, 0,
"edit-button",
"play-button",
"share-button"
);
setIDs(menu, 0, "edit-button", "play-button", "share-button");
}
if (auto menu = this->getChildByID("right-side-menu")) {
setIDs(menu, 0,
setIDs(
menu,
0,
"delete-button",
"help-button",
"duplicate-button",
@ -43,25 +44,20 @@ $register_ids(EditLevelLayer) {
"folder-button"
);
detachAndCreateMenu(menu,
"folder-menu",
ColumnLayout::create(),
menu->getChildByID("folder-button")
detachAndCreateMenu(
menu, "folder-menu", ColumnLayout::create(), menu->getChildByID("folder-button")
);
}
if (auto menu = this->getChildByID("back-button-menu"))
setIDSafe(menu, 0, "back-button");
if (auto menu = this->getChildByID("back-button-menu")) setIDSafe(menu, 0, "back-button");
if (auto menu = this->getChildByID("info-button-menu"))
setIDSafe(menu, 0, "info-button");
if (auto menu = this->getChildByID("info-button-menu")) setIDSafe(menu, 0, "info-button");
}
class $modify(EditLevelLayer) {
struct EditLevelLayerIDs : Modify<EditLevelLayerIDs, EditLevelLayer> {
bool init(GJGameLevel* l) {
if (!EditLevelLayer::init(l))
return false;
if (!EditLevelLayer::init(l)) return false;
NodeIDs::get()->provide(this);
return true;

View file

@ -1,12 +1,12 @@
#include <Geode/modify/EditorUI.hpp>
#include <Geode/Bindings.hpp>
#include <Geode/utils/cocos.hpp>
#include "AddIDs.hpp"
#include <Geode/Bindings.hpp>
#include <Geode/modify/EditorUI.hpp>
#include <Geode/utils/cocos.hpp>
USE_GEODE_NAMESPACE();
$register_ids(EditorUI) {
setIDSafe(this, 0, "position-slider");
setIDSafe(this, this->getChildrenCount() - 2, "layer-index-label");
setIDSafe(this, this->getChildrenCount() - 1, "object-info-label");
@ -14,7 +14,9 @@ $register_ids(EditorUI) {
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
menu->setID("toolbar-categories-menu");
setIDs(menu, 0,
setIDs(
menu,
0,
"build-button",
"edit-button",
"delete-button",
@ -42,7 +44,7 @@ $register_ids(EditorUI) {
detachAndCreateMenu(
this,
"toolbar-toggles-menu",
"toolbar-toggles-menu",
GridLayout::create(2, GridAlignment::Begin, GridDirection::Column),
menu->getChildByID("swipe-button"),
menu->getChildByID("free-move-button"),
@ -60,10 +62,7 @@ $register_ids(EditorUI) {
);
detachAndCreateMenu(
this,
"playback-menu",
RowLayout::create(),
menu->getChildByID("music-playback-button")
this, "playback-menu", RowLayout::create(), menu->getChildByID("music-playback-button")
);
detachAndCreateMenu(
@ -94,7 +93,9 @@ $register_ids(EditorUI) {
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
menu->setID("delete-category-menu");
setIDs(menu, 0,
setIDs(
menu,
0,
"delete-button",
"delete-startpos-button",
"delete-all-of-button",
@ -130,7 +131,9 @@ $register_ids(EditorUI) {
if (auto menu = getChildOfType<CCMenu>(this, 2)) {
menu->setID("build-tabs-menu");
setIDs(menu, 0,
setIDs(
menu,
0,
"static-tab-1",
"static-tab-2",
"static-tab-3",
@ -148,7 +151,9 @@ $register_ids(EditorUI) {
}
if (auto menu = getChildOfType<CCMenu>(this, 3)) {
setIDs(menu, 0,
setIDs(
menu,
0,
"pause-button",
"settings-button",
"copy-paste-button",
@ -194,7 +199,7 @@ $register_ids(EditorUI) {
menu->getChildByID("copy-values-button"),
menu->getChildByID("hsv-button")
);
detachAndCreateMenu(
this,
"layer-menu",
@ -207,11 +212,10 @@ $register_ids(EditorUI) {
}
}
class $modify(EditorUI) {
struct EditorUIIDs : Modify<EditorUIIDs, EditorUI> {
bool init(LevelEditorLayer* lel) {
if (!EditorUI::init(lel))
return false;
if (!EditorUI::init(lel)) return false;
NodeIDs::get()->provide(this);
return true;

View file

@ -1,18 +1,21 @@
#include <Geode/modify/GJGarageLayer.hpp>
#include <Geode/Bindings.hpp>
#include <Geode/utils/cocos.hpp>
#include "AddIDs.hpp"
#include <Geode/Bindings.hpp>
#include <Geode/modify/GJGarageLayer.hpp>
#include <Geode/utils/cocos.hpp>
USE_GEODE_NAMESPACE();
$register_ids(GJGarageLayer) {
setIDSafe(this, 2, "username-label");
setIDSafe(this, 2, "username-label");
setIDSafe(this, 6, "player-icon");
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
menu->setID("icon-select-menu");
setIDs(menu, 0,
setIDs(
menu,
0,
"cube-button",
"ship-button",
"ball-button",
@ -25,7 +28,9 @@ $register_ids(GJGarageLayer) {
);
}
setIDs(this, 10,
setIDs(
this,
10,
"cube-selection-menu",
"ship-selection-menu",
"ball-selection-menu",
@ -45,26 +50,18 @@ $register_ids(GJGarageLayer) {
if (auto menu = getChildOfType<CCMenu>(this, 11)) {
menu->setID("top-left-menu");
setIDs(menu, 0,
"back-button",
"shop-button",
"shards-button"
);
setIDs(menu, 0, "back-button", "shop-button", "shards-button");
detachAndCreateMenu(
menu,
"shards-button-menu",
ColumnLayout::create(),
menu->getChildByID("shards-button")
menu, "shards-button-menu", ColumnLayout::create(), menu->getChildByID("shards-button")
);
}
}
class $modify(GJGarageLayer) {
struct GJGarageLayerIDs : Modify<GJGarageLayerIDs, GJGarageLayer> {
bool init() {
if (!GJGarageLayer::init())
return false;
if (!GJGarageLayer::init()) return false;
NodeIDs::get()->provide(this);
return true;

View file

@ -1,8 +1,9 @@
#include <Geode/Modify.hpp>
#include <Geode/Bindings.hpp>
#include <Geode/utils/cocos.hpp>
#include "AddIDs.hpp"
#include <Geode/Bindings.hpp>
#include <Geode/Modify.hpp>
#include <Geode/utils/cocos.hpp>
USE_GEODE_NAMESPACE();
$register_ids(LevelBrowserLayer) {
@ -17,24 +18,23 @@ $register_ids(LevelBrowserLayer) {
setIDSafe(menu, 0, "new-level-button");
if (auto myLevelsBtn = setIDSafe(menu, 1, "my-levels-button")) {
detachAndCreateMenu(this, "my-levels-menu",
detachAndCreateMenu(
this,
"my-levels-menu",
ColumnLayout::create(5.f, 0.f)->setAlignment(Alignment::End),
myLevelsBtn
);
}
menu->setLayout(
ColumnLayout::create(5.f, 0.f)->setAlignment(Alignment::End)
);
menu->setLayout(ColumnLayout::create(5.f, 0.f)->setAlignment(Alignment::End));
}
}
}
class $modify(LevelBrowserLayer) {
struct LevelBrowserLayerIDs : Modify<LevelBrowserLayerIDs, LevelBrowserLayer> {
bool init(GJSearchObject* obj) {
if (!LevelBrowserLayer::init(obj))
return false;
if (!LevelBrowserLayer::init(obj)) return false;
NodeIDs::get()->provide(this);
return true;

View file

@ -1,4 +1,5 @@
#include "AddIDs.hpp"
#include <Geode/binding/LevelInfoLayer.hpp>
#include <Geode/modify/LevelInfoLayer.hpp>
@ -35,7 +36,7 @@ $register_ids(LevelInfoLayer) {
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
menu->setID("exit-menu");
setIDSafe(menu, 0, "exit-button");
setIDSafe(menu, 0, "exit-button");
}
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
@ -43,9 +44,7 @@ $register_ids(LevelInfoLayer) {
if (auto name = setIDSafe(menu, 0, "creator-name")) {
detachAndCreateMenu(
this, "creator-info-menu",
ColumnLayout::create()->setAlignment(Alignment::Begin),
name
this, "creator-info-menu", ColumnLayout::create()->setAlignment(Alignment::Begin), name
);
}
@ -56,7 +55,7 @@ $register_ids(LevelInfoLayer) {
this->addChild(leftSideMenu);
menu->setPosition(winSize / 2 + ccp(254.f, 0.f));
for (auto child : CCArrayExt<CCNode>(menu->getChildren())) {
if (child->getPositionX() < 0.f) {
child->retain();
@ -81,11 +80,10 @@ $register_ids(LevelInfoLayer) {
}
}
class $modify(LevelInfoLayer) {
struct LevelInfoLayerIDs : Modify<LevelInfoLayerIDs, LevelInfoLayer> {
bool init(GJGameLevel* level) {
if (!LevelInfoLayer::init(level))
return false;
if (!LevelInfoLayer::init(level)) return false;
NodeIDs::get()->provide(this);
return true;

View file

@ -1,78 +1,76 @@
#include "AddIDs.hpp"
#include <Geode/modify/LevelSearchLayer.hpp>
$register_ids(LevelSearchLayer) {
// set the funny ids
setIDSafe(this, 0, "background");
getChildOfType<CCTextInputNode>(this, 0)->setID("search-bar");
getChildOfType<CCScale9Sprite>(this, 0)->setID("level-search-bg");
getChildOfType<CCScale9Sprite>(this, 1)->setID("level-search-bar-bg");
getChildOfType<CCScale9Sprite>(this, 2)->setID("quick-search-bg");
getChildOfType<CCScale9Sprite>(this, 3)->setID("difficulty-filters-bg");
getChildOfType<CCScale9Sprite>(this, 4)->setID("length-filters-bg");
getChildOfType<CCLabelBMFont>(this, 0)->setID("quick-search-title");
getChildOfType<CCLabelBMFont>(this, 1)->setID("filters-title");
getChildOfType<CCSprite>(this, 1)->setID("left-corner");
getChildOfType<CCSprite>(this, 2)->setID("right-corner");
if (auto filtermenu = getChildOfType<CCMenu>(this, 0)) {
filtermenu->setID("other-filter-menu");
setIDSafe(filtermenu, 0, "clear-filters-button");
setIDSafe(filtermenu, 1, "advanced-filters-button");
}
if (auto searchmenu = getChildOfType<CCMenu>(this, 1)) {
searchmenu->setID("search-button-menu");
setIDSafe(searchmenu, 0, "search-level-button");
setIDSafe(searchmenu, 1, "search-user-button");
// set the funny ids
setIDSafe(this, 0, "background");
getChildOfType<CCTextInputNode>(this, 0)->setID("search-bar");
getChildOfType<CCScale9Sprite>(this, 0)->setID("level-search-bg");
getChildOfType<CCScale9Sprite>(this, 1)->setID("level-search-bar-bg");
getChildOfType<CCScale9Sprite>(this, 2)->setID("quick-search-bg");
getChildOfType<CCScale9Sprite>(this, 3)->setID("difficulty-filters-bg");
getChildOfType<CCScale9Sprite>(this, 4)->setID("length-filters-bg");
getChildOfType<CCLabelBMFont>(this, 0)->setID("quick-search-title");
getChildOfType<CCLabelBMFont>(this, 1)->setID("filters-title");
getChildOfType<CCSprite>(this, 1)->setID("left-corner");
getChildOfType<CCSprite>(this, 2)->setID("right-corner");
}
if (auto quickmenu = getChildOfType<CCMenu>(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<CCMenu>(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<CCMenu>(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<CCMenu>(this, 5)) {
backmenu->setID("exit-menu");
setIDSafe(backmenu, 0, "exit-button");
}
if (auto filtermenu = getChildOfType<CCMenu>(this, 0)) {
filtermenu->setID("other-filter-menu");
setIDSafe(filtermenu, 0, "clear-filters-button");
setIDSafe(filtermenu, 1, "advanced-filters-button");
}
if (auto searchmenu = getChildOfType<CCMenu>(this, 1)) {
searchmenu->setID("search-button-menu");
setIDSafe(searchmenu, 0, "search-level-button");
setIDSafe(searchmenu, 1, "search-user-button");
}
if (auto quickmenu = getChildOfType<CCMenu>(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<CCMenu>(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<CCMenu>(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<CCMenu>(this, 5)) {
backmenu->setID("exit-menu");
setIDSafe(backmenu, 0, "exit-button");
}
}
class $modify(LevelSearchLayer) {
struct LevelSearchLayerIDs : Modify<LevelSearchLayerIDs, LevelSearchLayer> {
bool init() {
if (!LevelSearchLayer::init())
return false;
if (!LevelSearchLayer::init()) return false;
NodeIDs::get()->provide(this);
return true;
}
};

View file

@ -1,198 +1,206 @@
#include <Geode/Modify.hpp>
#include <Geode/Bindings.hpp>
#include <Geode/utils/cocos.hpp>
#include "AddIDs.hpp"
#include <Geode/Bindings.hpp>
#include <Geode/Modify.hpp>
#include <Geode/utils/cocos.hpp>
USE_GEODE_NAMESPACE();
$register_ids(LevelSettingsLayer) {
bool startPos = m_mainLayer->getChildrenCount() < 10;
bool startPos = m_mainLayer->getChildrenCount() < 10;
if (startPos) {
setIDSafe(m_mainLayer, 0, "back-button");
}
if (startPos) {
setIDSafe(m_mainLayer, 0, "back-button");
}
if (auto menu = getChildOfType<CCMenu>(m_mainLayer, 0)) {
menu->setID("song-select-menu");
if (auto menu = getChildOfType<CCMenu>(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"
);
}
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,
"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,
"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")
);
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")
);
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,
"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,
"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")
);
detachAndCreateMenu(
this,
"2-player-menu",
ColumnLayout::create(),
menu->getChildByID("2-player-help-button"),
menu->getChildByID("2-player-toggle")
);
detachAndCreateMenu(
this,
"font-button-menu",
RowLayout::create()->setAlignment(Alignment::End),
menu->getChildByID("font-button")
);
}
}
detachAndCreateMenu(
this,
"font-button-menu",
RowLayout::create()->setAlignment(Alignment::End),
menu->getChildByID("font-button")
);
}
}
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"
);
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"
);
}
class $modify(LevelSettingsLayer) {
struct LevelSettingsLayerIDs : Modify<LevelSettingsLayerIDs, LevelSettingsLayer> {
bool init(LevelSettingsObject* levelSettings, LevelEditorLayer* editor) {
if (!LevelSettingsLayer::init(levelSettings, editor))
return false;
//NodeIDs::get()->provide(this);
if (!LevelSettingsLayer::init(levelSettings, editor)) return false;
// NodeIDs::get()->provide(this);
return true;
}

View file

@ -1,90 +1,88 @@
#include "AddIDs.hpp"
#include <Geode/modify/MenuLayer.hpp>
#include <Geode/utils/cocos.hpp>
#include "AddIDs.hpp"
USE_GEODE_NAMESPACE();
$register_ids(MenuLayer) {
// set IDs to everything
setIDSafe(this, 0, "main-menu-bg");
setIDSafe<CCSprite>(this, 0, "main-title");
// set IDs to everything
setIDSafe(this, 0, "main-menu-bg");
setIDSafe<CCSprite>(this, 0, "main-title");
// controller
if (PlatformToolbox::isControllerConnected()) {
setIDSafe<CCSprite>(this, 1, "play-gamepad-icon");
setIDSafe<CCSprite>(this, 2, "editor-gamepad-icon");
setIDSafe<CCSprite>(this, 3, "icon-kit-gamepad-icon");
// controller
if (PlatformToolbox::isControllerConnected()) {
setIDSafe<CCSprite>(this, 1, "play-gamepad-icon");
setIDSafe<CCSprite>(this, 2, "editor-gamepad-icon");
setIDSafe<CCSprite>(this, 3, "icon-kit-gamepad-icon");
setIDSafe<CCSprite>(this, 4, "settings-gamepad-icon");
setIDSafe<CCSprite>(this, 5, "mouse-gamepad-icon");
setIDSafe<CCSprite>(this, 6, "click-gamepad-icon");
setIDSafe<CCSprite>(this, 4, "settings-gamepad-icon");
setIDSafe<CCSprite>(this, 5, "mouse-gamepad-icon");
setIDSafe<CCSprite>(this, 6, "click-gamepad-icon");
setIDSafe<CCLabelBMFont>(this, 0, "mouse-gamepad-label");
setIDSafe<CCLabelBMFont>(this, 1, "click-gamepad-label");
setIDSafe<CCLabelBMFont>(this, 0, "mouse-gamepad-label");
setIDSafe<CCLabelBMFont>(this, 1, "click-gamepad-label");
setIDSafe<CCLabelBMFont>(this, 2, "player-username");
} else {
setIDSafe<CCLabelBMFont>(this, 0, "player-username");
}
// main menu
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
menu->setID("main-menu");
auto playBtn = setIDSafe(menu, 0, "play-button");
auto iconBtn = setIDSafe(menu, 1, "icon-kit-button");
setIDSafe<CCLabelBMFont>(this, 2, "player-username");
}
else {
setIDSafe<CCLabelBMFont>(this, 0, "player-username");
}
// main menu
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
menu->setID("main-menu");
auto playBtn = setIDSafe(menu, 0, "play-button");
auto iconBtn = setIDSafe(menu, 1, "icon-kit-button");
// the buttons are added in order play, icon, editor which doesn't work
// well with setLayout that deals with children in order
menu->swapChildIndices(playBtn, iconBtn);
// the buttons are added in order play, icon, editor which doesn't work
// well with setLayout that deals with children in order
menu->swapChildIndices(playBtn, iconBtn);
setIDSafe(menu, 2, "editor-button");
if (auto pfp = setIDSafe(menu, 3, "profile-button")) {
pfp->setPositionHint(PositionHint::Absolute);
}
setIDSafe(menu, 2, "editor-button");
menu->setLayout(RowLayout::create(18.f, 0.f));
}
// bottom menu
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
menu->setID("bottom-menu");
auto ach = setIDSafe(menu, 0, "achievements-button");
setIDSafe(menu, 1, "settings-button");
setIDSafe(menu, 2, "stats-button");
setIDSafe(menu, 3, "newgrounds-button");
if (auto pfp = setIDSafe(menu, 3, "profile-button")) {
pfp->setPositionHint(PositionHint::Absolute);
}
// move daily chest to its own menu
menu->setLayout(RowLayout::create(18.f, 0.f));
}
// bottom menu
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
menu->setID("bottom-menu");
auto ach = setIDSafe(menu, 0, "achievements-button");
setIDSafe(menu, 1, "settings-button");
setIDSafe(menu, 2, "stats-button");
setIDSafe(menu, 3, "newgrounds-button");
if (auto dailyChest = setIDSafe(menu, -1, "daily-chest-button")) {
detachAndCreateMenu(this, "right-side-menu",
ColumnLayout::create(0.f, 0.f),
dailyChest
);
}
// move daily chest to its own menu
menu->setLayout(RowLayout::create(5.f, ach->getPositionY()));
}
// social media menu
if (auto menu = getChildOfType<CCMenu>(this, 2)) {
menu->setID("social-media-menu");
setIDSafe(menu, 0, "robtop-logo-button");
setIDSafe(menu, 1, "facebook-button");
setIDSafe(menu, 2, "twitter-button");
setIDSafe(menu, 3, "youtube-button");
}
// more games menu
if (auto menu = getChildOfType<CCMenu>(this, 3)) {
menu->setID("more-games-menu");
setIDSafe(menu, 0, "more-games-button");
if (auto dailyChest = setIDSafe(menu, -1, "daily-chest-button")) {
detachAndCreateMenu(this, "right-side-menu", ColumnLayout::create(0.f, 0.f), dailyChest);
}
// move close button to its own menu
menu->setLayout(RowLayout::create(5.f, ach->getPositionY()));
}
// social media menu
if (auto menu = getChildOfType<CCMenu>(this, 2)) {
menu->setID("social-media-menu");
setIDSafe(menu, 0, "robtop-logo-button");
setIDSafe(menu, 1, "facebook-button");
setIDSafe(menu, 2, "twitter-button");
setIDSafe(menu, 3, "youtube-button");
}
// more games menu
if (auto menu = getChildOfType<CCMenu>(this, 3)) {
menu->setID("more-games-menu");
setIDSafe(menu, 0, "more-games-button");
if (auto closeBtn = setIDSafe(menu, 1, "close-button")) {
detachAndCreateMenu(this, "close-menu",
RowLayout::create(5.f, 0.f)->setAlignment(Alignment::Begin),
closeBtn
);
}
}
// move close button to its own menu
if (auto closeBtn = setIDSafe(menu, 1, "close-button")) {
detachAndCreateMenu(
this, "close-menu", RowLayout::create(5.f, 0.f)->setAlignment(Alignment::Begin), closeBtn
);
}
}
}
// MenuLayer::init is hooked in ../hooks/MenuLayer.cpp

View file

@ -1,78 +1,67 @@
#include <Geode/modify/PauseLayer.hpp>
#include <Geode/Bindings.hpp>
#include <Geode/utils/cocos.hpp>
#include "AddIDs.hpp"
#include <Geode/Bindings.hpp>
#include <Geode/modify/PauseLayer.hpp>
#include <Geode/utils/cocos.hpp>
USE_GEODE_NAMESPACE();
$register_ids(PauseLayer) {
setIDs(this, 0,
"background",
"level-name",
setIDs(
this,
0,
"background",
"level-name",
"normal-progress-bar",
"practice-progress-bar",
"normal-progress-label",
"practice-progress-label",
"normal-mode-label",
"practice-mode-label",
"normal-progress-bar",
"practice-progress-bar",
"normal-progress-label",
"practice-progress-label",
"normal-mode-label",
"practice-mode-label",
"center-button-menu",
"center-button-menu",
"auto-retry-label",
"auto-checkpoints-label",
"show-progress-bar-label"
);
"auto-retry-label",
"auto-checkpoints-label",
"show-progress-bar-label"
);
if (auto menu = this->getChildByID("center-button-menu")) {
int start_idx = 0;
if (auto menu = this->getChildByID("center-button-menu")) {
int start_idx = 0;
if (menu->getChildrenCount() == 5) {
setIDSafe(menu, 0, "edit-button");
start_idx = 1;
}
if (menu->getChildrenCount() == 5) {
setIDSafe(menu, 0, "edit-button");
start_idx = 1;
}
setIDs(menu, start_idx,
"practice-button",
"play-button",
"exit-button"
);
setIDs(menu, start_idx, "practice-button", "play-button", "exit-button");
if (menu->getChildrenCount() == 4)
setIDSafe(menu, start_idx + 3, "retry-button");
}
if (menu->getChildrenCount() == 4) setIDSafe(menu, start_idx + 3, "retry-button");
}
// Record toggle on mobile
if (auto label = typeinfo_cast<CCLabelBMFont*>(getChild(this, 12))) {
setIDSafe(this, 12, "record-label");
}
// Record toggle on mobile
if (auto label = typeinfo_cast<CCLabelBMFont*>(getChild(this, 12))) {
setIDSafe(this, 12, "record-label");
}
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
menu->setID("toggle-menu");
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
menu->setID("toggle-menu");
setIDs(menu, 0,
"auto-retry-toggle",
"auto-checkpoints-toggle",
"show-progress-bar-toggle"
);
setIDs(menu, 0, "auto-retry-toggle", "auto-checkpoints-toggle", "show-progress-bar-toggle");
if (menu->getChildrenCount() == 4)
setIDSafe(menu, 3, "record-toggle");
}
if (menu->getChildrenCount() == 4) setIDSafe(menu, 3, "record-toggle");
}
setIDs(this, this->getChildrenCount() - 4,
"music-slider",
"sfx-slider",
"music-label",
"sfx-label"
);
setIDs(
this, this->getChildrenCount() - 4, "music-slider", "sfx-slider", "music-label", "sfx-label"
);
}
class $modify(PauseLayer) {
struct PauseLayerIDs : Modify<PauseLayerIDs, PauseLayer> {
void customSetup() {
PauseLayer::customSetup();
NodeIDs::get()->provide(this);
}
};

View file

@ -1,32 +1,29 @@
#include <Geode/modify/UILayer.hpp>
#include <Geode/Bindings.hpp>
#include <Geode/utils/cocos.hpp>
#include "AddIDs.hpp"
#include <Geode/Bindings.hpp>
#include <Geode/modify/UILayer.hpp>
#include <Geode/utils/cocos.hpp>
USE_GEODE_NAMESPACE();
$register_ids(UILayer) {
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
menu->setID("pause-button-menu");
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
menu->setID("pause-button-menu");
setIDs(menu, 0, "pause-button");
}
setIDs(menu, 0, "pause-button");
}
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
menu->setID("checkpoint-menu");
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
menu->setID("checkpoint-menu");
setIDs(menu, 0,
"add-checkpoint-button",
"remove-checkpoint-button"
);
}
setIDs(menu, 0, "add-checkpoint-button", "remove-checkpoint-button");
}
}
class $modify(UILayer) {
struct UILayerIDs : Modify<UILayerIDs, UILayer> {
bool init() {
if (!UILayer::init())
return false;
if (!UILayer::init()) return false;
NodeIDs::get()->provide(this);
return true;