mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-26 21:00:50 -04:00
update a lot of ids
This commit is contained in:
parent
a78bc0c9c8
commit
cb1a6f15ee
10 changed files with 322 additions and 81 deletions
bindings
loader
|
@ -4560,7 +4560,7 @@ class PlayerObject : GameObject, AnimatedSpriteDelegate {
|
|||
void modeDidChange() = mac 0x22bfd0;
|
||||
void placeStreakPoint() = mac 0x21af90, win 0x1f95e0;
|
||||
void playBurstEffect() = mac 0x21c780, win 0x1f6790;
|
||||
void playDeathEffect() = mac 0x225930, win 0x2efbe0;
|
||||
void playDeathEffect() = mac 0x225930, win 0x1efbe0;
|
||||
void playDynamicSpiderRun() = mac 0x222ec0, win 0x1f9d80;
|
||||
void playerDestroyed(bool) = mac 0x2256d0, win 0x1efaa0;
|
||||
bool playerIsFalling() = mac 0x21c730, win 0x1f5d60;
|
||||
|
|
|
@ -410,16 +410,31 @@ namespace geode::cocos {
|
|||
* or nullptr if index exceeds bounds
|
||||
*/
|
||||
template <class Type = cocos2d::CCNode>
|
||||
static Type* getChildOfType(cocos2d::CCNode* node, size_t index) {
|
||||
static Type* getChildOfType(cocos2d::CCNode* node, int index) {
|
||||
size_t indexCounter = 0;
|
||||
|
||||
for (size_t i = 0; i < node->getChildrenCount(); ++i) {
|
||||
auto obj = cast::typeinfo_cast<Type*>(node->getChildren()->objectAtIndex(i));
|
||||
if (obj != nullptr) {
|
||||
if (indexCounter == index) {
|
||||
return obj;
|
||||
// start from end for negative index
|
||||
if (index < 0) {
|
||||
index = -index - 1;
|
||||
for (size_t i = node->getChildrenCount() - 1; i >= 0; i--) {
|
||||
auto obj = cast::typeinfo_cast<Type*>(node->getChildren()->objectAtIndex(i));
|
||||
if (obj != nullptr) {
|
||||
if (indexCounter == index) {
|
||||
return obj;
|
||||
}
|
||||
++indexCounter;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (size_t i = 0; i < node->getChildrenCount(); i++) {
|
||||
auto obj = cast::typeinfo_cast<Type*>(node->getChildren()->objectAtIndex(i));
|
||||
if (obj != nullptr) {
|
||||
if (indexCounter == index) {
|
||||
return obj;
|
||||
}
|
||||
++indexCounter;
|
||||
}
|
||||
++indexCounter;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@ void setIDs(CCNode* node, int startIndex, Args... args) {
|
|||
}
|
||||
|
||||
static void switchToMenu(CCNode* node, CCMenu* menu) {
|
||||
if (!node || !menu) return;
|
||||
|
||||
auto worldPos = node->getParent()->convertToWorldSpace(node->getPosition());
|
||||
|
||||
node->retain();
|
||||
|
@ -56,6 +58,14 @@ static void switchChildrenToMenu(CCNode* parent, CCMenu* menu, Args... args) {
|
|||
|
||||
template <typename T, typename ...Args>
|
||||
static CCMenu* detachAndCreateMenu(CCNode* parent, const char* menuID, Layout* layout, T first, Args... args) {
|
||||
if (!first) {
|
||||
auto menu = CCMenu::create();
|
||||
menu->setID(menuID);
|
||||
menu->setLayout(layout);
|
||||
parent->addChild(menu);
|
||||
return menu;
|
||||
}
|
||||
|
||||
auto oldMenu = first->getParent();
|
||||
|
||||
first->retain();
|
||||
|
@ -78,3 +88,12 @@ static CCMenu* detachAndCreateMenu(CCNode* parent, const char* menuID, Layout* l
|
|||
|
||||
return newMenu;
|
||||
}
|
||||
|
||||
static CCSize getSizeSafe(CCNode* node) {
|
||||
if (node) {
|
||||
return node->getScaledContentSize();
|
||||
}
|
||||
else {
|
||||
return CCSizeZero;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ $register_ids(CreatorLayer) {
|
|||
auto exitBtn = setIDSafe(menu, 0, "exit-button");
|
||||
menu->setPositionY(
|
||||
menu->getPositionY() - 125.f / 2 +
|
||||
exitBtn->getScaledContentSize().height / 2
|
||||
getSizeSafe(exitBtn).height / 2
|
||||
);
|
||||
menu->setContentSize({ 60.f, 125.f });
|
||||
menu->setLayout(
|
||||
|
|
|
@ -77,7 +77,7 @@ $register_ids(EditLevelLayer) {
|
|||
auto backBtn = setIDSafe(menu, 0, "back-button");
|
||||
menu->setPositionX(
|
||||
menu->getPositionX() + 100.f / 2 -
|
||||
backBtn->getScaledContentSize().width / 2
|
||||
getSizeSafe(backBtn).width / 2
|
||||
);
|
||||
menu->setContentSize({ 100.f, 50.f });
|
||||
menu->setLayout(
|
||||
|
|
|
@ -11,6 +11,9 @@ $register_ids(EditorUI) {
|
|||
setIDSafe(this, this->getChildrenCount() - 2, "layer-index-label");
|
||||
setIDSafe(this, this->getChildrenCount() - 1, "object-info-label");
|
||||
|
||||
auto winSize = CCDirector::get()->getWinSize();
|
||||
auto topMenuWidth = winSize.width / 2 - 90.f;
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
menu->setID("toolbar-categories-menu");
|
||||
|
||||
|
@ -28,7 +31,7 @@ $register_ids(EditorUI) {
|
|||
|
||||
"undo-button",
|
||||
"redo-button",
|
||||
"delete-button",
|
||||
"delete-trash-button",
|
||||
|
||||
"music-playback-button",
|
||||
|
||||
|
@ -45,10 +48,11 @@ $register_ids(EditorUI) {
|
|||
auto toolbarTogglesMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"toolbar-toggles-menu",
|
||||
ColumnLayout::create()
|
||||
->setCrossAxisOverflow(false)
|
||||
->setAxisAlignment(AxisAlignment::Even)
|
||||
->setCrossAxisAlignment(AxisAlignment::Even),
|
||||
// ColumnLayout::create()
|
||||
// ->setCrossAxisOverflow(false)
|
||||
// ->setAxisAlignment(AxisAlignment::Even)
|
||||
// ->setCrossAxisAlignment(AxisAlignment::Even),
|
||||
nullptr,
|
||||
menu->getChildByID("swipe-button"),
|
||||
menu->getChildByID("free-move-button"),
|
||||
menu->getChildByID("snap-button"),
|
||||
|
@ -60,42 +64,82 @@ $register_ids(EditorUI) {
|
|||
toolbarTogglesMenu->setContentSize({ 100.f, 100.f });
|
||||
toolbarTogglesMenu->updateLayout();
|
||||
|
||||
detachAndCreateMenu(
|
||||
auto undoMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"top-left-menu",
|
||||
RowLayout::create(),
|
||||
"undo-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
->setGap(10.f),
|
||||
menu->getChildByID("undo-button"),
|
||||
menu->getChildByID("redo-button"),
|
||||
menu->getChildByID("delete-button")
|
||||
menu->getChildByID("delete-trash-button")
|
||||
);
|
||||
|
||||
detachAndCreateMenu(
|
||||
this, "playback-menu", RowLayout::create(), menu->getChildByID("music-playback-button")
|
||||
undoMenu->setContentSize({ topMenuWidth, 50.f });
|
||||
undoMenu->setPositionX(
|
||||
undoMenu->getPositionX() + topMenuWidth / 2 -
|
||||
getSizeSafe(undoMenu->getChildByID("undo-button")).width / 2
|
||||
);
|
||||
undoMenu->updateLayout();
|
||||
|
||||
detachAndCreateMenu(
|
||||
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(),
|
||||
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();
|
||||
|
||||
detachAndCreateMenu(
|
||||
auto zoomMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"zoom-menu",
|
||||
ColumnLayout::create(),
|
||||
menu->getChildByID("zoom-in-button"),
|
||||
menu->getChildByID("zoom-out-button")
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
menu->getChildByID("zoom-out-button"),
|
||||
menu->getChildByID("zoom-in-button")
|
||||
);
|
||||
zoomMenu->setPositionY(
|
||||
zoomMenu->getPositionY() + 75.f / 2 -
|
||||
getSizeSafe(zoomMenu->getChildByID("zoom-out-button")).height / 2
|
||||
);
|
||||
zoomMenu->setContentSize({ 50.f, 75.f });
|
||||
zoomMenu->updateLayout();
|
||||
|
||||
detachAndCreateMenu(
|
||||
auto linkMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"link-menu",
|
||||
ColumnLayout::create(),
|
||||
menu->getChildByID("link-button"),
|
||||
menu->getChildByID("unlink-button")
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
->setGrowCrossAxis(true),
|
||||
menu->getChildByID("unlink-button"),
|
||||
menu->getChildByID("link-button")
|
||||
);
|
||||
linkMenu->setPositionY(
|
||||
linkMenu->getPositionY() + 75.f / 2 -
|
||||
getSizeSafe(linkMenu->getChildByID("unlink-button")).height / 2
|
||||
);
|
||||
linkMenu->setContentSize({ 125.f, 75.f });
|
||||
linkMenu->updateLayout();
|
||||
}
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
|
@ -119,10 +163,11 @@ $register_ids(EditorUI) {
|
|||
auto deleteButtonMenu = detachAndCreateMenu(
|
||||
menu,
|
||||
"delete-button-menu",
|
||||
ColumnLayout::create()
|
||||
->setCrossAxisOverflow(false)
|
||||
->setAxisAlignment(AxisAlignment::Even)
|
||||
->setCrossAxisAlignment(AxisAlignment::Even),
|
||||
// ColumnLayout::create()
|
||||
// ->setCrossAxisOverflow(false)
|
||||
// ->setAxisAlignment(AxisAlignment::Even)
|
||||
// ->setCrossAxisAlignment(AxisAlignment::Even),
|
||||
nullptr,
|
||||
menu->getChildByID("delete-button"),
|
||||
menu->getChildByID("delete-all-of-button"),
|
||||
menu->getChildByID("delete-startpos-button")
|
||||
|
@ -136,10 +181,11 @@ $register_ids(EditorUI) {
|
|||
auto deleteFilterMenu = detachAndCreateMenu(
|
||||
menu,
|
||||
"delete-filter-menu",
|
||||
ColumnLayout::create()
|
||||
->setCrossAxisOverflow(false)
|
||||
->setAxisAlignment(AxisAlignment::Even)
|
||||
->setCrossAxisAlignment(AxisAlignment::Even),
|
||||
// ColumnLayout::create()
|
||||
// ->setCrossAxisOverflow(false)
|
||||
// ->setAxisAlignment(AxisAlignment::Even)
|
||||
// ->setCrossAxisAlignment(AxisAlignment::Even),
|
||||
nullptr,
|
||||
menu->getChildByID("delete-filter-none"),
|
||||
menu->getChildByID("delete-filter-static"),
|
||||
menu->getChildByID("delete-filter-detail"),
|
||||
|
@ -200,44 +246,58 @@ $register_ids(EditorUI) {
|
|||
|
||||
auto topRightMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"top-right-menu",
|
||||
"settings-menu",
|
||||
RowLayout::create()
|
||||
->setAxisReverse(true)
|
||||
->setAxisAlignment(AxisAlignment::End),
|
||||
menu->getChildByID("pause-button"),
|
||||
menu->getChildByID("settings-button")
|
||||
);
|
||||
topRightMenu->setContentSize({ 60.f, 125.f });
|
||||
topRightMenu->setPositionX(topRightMenu->getPositionX() - 125.f / 2);
|
||||
topRightMenu->setContentSize({ topMenuWidth, 60.f });
|
||||
topRightMenu->setPositionX(
|
||||
topRightMenu->getPositionX() - topMenuWidth / 2 +
|
||||
getSizeSafe(topRightMenu->getChildByID("pause-button")).width / 2
|
||||
);
|
||||
topRightMenu->updateLayout();
|
||||
|
||||
auto rightMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"editor-buttons-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Even)
|
||||
->setAxisAlignment(AxisAlignment::Center)
|
||||
->setCrossAxisAlignment(AxisAlignment::End)
|
||||
->setGap(-3.5f)
|
||||
->setGrowCrossAxis(true)
|
||||
->setCrossAxisOverflow(false)
|
||||
->setCrossAxisReverse(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("paste-button"),
|
||||
menu->getChildByID("copy-paste-button"),
|
||||
menu->getChildByID("edit-special-button"),
|
||||
menu->getChildByID("edit-group-button"),
|
||||
menu->getChildByID("edit-object-button"),
|
||||
menu->getChildByID("copy-values-button"),
|
||||
menu->getChildByID("hsv-button")
|
||||
menu->getChildByID("paste-state-button"),
|
||||
menu->getChildByID("paste-color-button"),
|
||||
menu->getChildByID("hsv-button"),
|
||||
menu->getChildByID("go-to-layer-button"),
|
||||
menu->getChildByID("deselect-button")
|
||||
);
|
||||
for (auto btn : CCArrayExt<CCNode>(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 + 50.f
|
||||
);
|
||||
rightMenu->setContentSize({ 125.f, 125.f });
|
||||
rightMenu->setPosition(rightMenu->getPosition() - CCPoint { 125.f, 125.f });
|
||||
rightMenu->updateLayout();
|
||||
|
||||
detachAndCreateMenu(
|
||||
this,
|
||||
"layer-menu",
|
||||
RowLayout::create(),
|
||||
// RowLayout::create(),
|
||||
nullptr,
|
||||
menu->getChildByID("all-layers-button"),
|
||||
menu->getChildByID("prev-layer-button"),
|
||||
this->getChildByID("layer-index-label"),
|
||||
|
|
|
@ -10,8 +10,10 @@ $register_ids(GJGarageLayer) {
|
|||
setIDSafe(this, 2, "username-label");
|
||||
setIDSafe(this, 6, "player-icon");
|
||||
|
||||
auto winSize = CCDirector::get()->getWinSize();
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
menu->setID("icon-select-menu");
|
||||
menu->setID("category-menu");
|
||||
|
||||
setIDs(
|
||||
menu,
|
||||
|
@ -26,6 +28,13 @@ $register_ids(GJGarageLayer) {
|
|||
"trail-button",
|
||||
"death-effect-button"
|
||||
);
|
||||
|
||||
menu->setContentSize({ 320.f, 50.f });
|
||||
menu->setLayout(
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
->setGap(-4.f)
|
||||
);
|
||||
}
|
||||
|
||||
setIDs(
|
||||
|
@ -47,15 +56,62 @@ $register_ids(GJGarageLayer) {
|
|||
"color-selection-menu"
|
||||
);
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 11)) {
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
menu->setID("top-left-menu");
|
||||
|
||||
setIDs(menu, 0, "back-button", "shop-button", "shards-button");
|
||||
|
||||
detachAndCreateMenu(
|
||||
menu, "shards-button-menu", ColumnLayout::create(), menu->getChildByID("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);
|
||||
}
|
||||
|
||||
struct GJGarageLayerIDs : Modify<GJGarageLayerIDs, GJGarageLayer> {
|
||||
|
|
|
@ -7,9 +7,20 @@
|
|||
USE_GEODE_NAMESPACE();
|
||||
|
||||
$register_ids(LevelBrowserLayer) {
|
||||
auto winSize = CCDirector::get()->getWinSize();
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
menu->setID("back-menu");
|
||||
setIDSafe(menu, 0, "back-button");
|
||||
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) {
|
||||
|
@ -26,10 +37,10 @@ $register_ids(LevelBrowserLayer) {
|
|||
myLevelsBtn
|
||||
);
|
||||
menu->setPositionY(
|
||||
menu->getPositionY() + 100.f / 2 -
|
||||
menu->getPositionY() + 125.f / 2 -
|
||||
myLevelsBtn->getScaledContentSize().height / 2
|
||||
);
|
||||
menu->setContentSize({ 50.f, 100.f });
|
||||
menu->setContentSize({ 50.f, 125.f });
|
||||
menu->updateLayout();
|
||||
}
|
||||
|
||||
|
@ -39,7 +50,7 @@ $register_ids(LevelBrowserLayer) {
|
|||
);
|
||||
menu->setPositionY(
|
||||
menu->getPositionY() + 130.f / 2 -
|
||||
newLvlBtn->getScaledContentSize().height / 2
|
||||
getSizeSafe(newLvlBtn).height / 2
|
||||
);
|
||||
menu->setContentSize({ 50.f, 130.f });
|
||||
menu->updateLayout();
|
||||
|
@ -101,8 +112,47 @@ $register_ids(LevelBrowserLayer) {
|
|||
);
|
||||
pageMenu->updateLayout();
|
||||
}
|
||||
|
||||
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({ 90.f, 40.f });
|
||||
navMenu->setPositionX(
|
||||
navMenu->getPositionX() + 90.f / 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({ 90.f, 40.f });
|
||||
menu->setPositionX(
|
||||
winSize.width - 90.f / 2 - 5.f
|
||||
);
|
||||
menu->updateLayout();
|
||||
}
|
||||
}
|
||||
|
||||
auto bottomMenu = CCMenu::create();
|
||||
bottomMenu->setID("bottom-menu");
|
||||
bottomMenu->setContentSize({ 375.f, 50.f });
|
||||
bottomMenu->setPosition(winSize.width / 2, 28.f);
|
||||
bottomMenu->setZOrder(15);
|
||||
bottomMenu->setLayout(RowLayout::create());
|
||||
this->addChild(bottomMenu);
|
||||
}
|
||||
|
||||
struct LevelBrowserLayerIDs : Modify<LevelBrowserLayerIDs, LevelBrowserLayer> {
|
||||
|
|
|
@ -35,8 +35,22 @@ $register_ids(LevelInfoLayer) {
|
|||
setIDSafe<CustomSongWidget>(this, 0, "custom-songs-widget");
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
menu->setID("exit-menu");
|
||||
setIDSafe(menu, 0, "exit-button");
|
||||
menu->setID("play-menu");
|
||||
setIDSafe(menu, 0, "play-button");
|
||||
}
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(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<CCMenu>(this, 1)) {
|
||||
|
@ -47,18 +61,23 @@ $register_ids(LevelInfoLayer) {
|
|||
this,
|
||||
"creator-info-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
->setAxisReverse(true)
|
||||
->setAxisAlignment(AxisAlignment::End),
|
||||
name
|
||||
);
|
||||
menu->setPositionY(menu->getPositionY() + 100.f / 2);
|
||||
menu->setContentSize({ 60.f, 100.f });
|
||||
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(winSize / 2 + ccp(-254.f, 30.f));
|
||||
leftSideMenu->setPosition(winSize / 2 + ccp(-254.f, 0.f));
|
||||
leftSideMenu->setLayout(ColumnLayout::create());
|
||||
leftSideMenu->setID("left-side-menu");
|
||||
leftSideMenu->setContentSize({ 50.f, 225.f });
|
||||
this->addChild(leftSideMenu);
|
||||
|
||||
menu->setPosition(winSize / 2 + ccp(254.f, 0.f));
|
||||
|
@ -80,6 +99,20 @@ $register_ids(LevelInfoLayer) {
|
|||
setIDSafe(menu, 4, "like-button");
|
||||
setIDSafe(menu, 5, "rate-button");
|
||||
|
||||
menu->setPosition(
|
||||
menu->getPositionX() + static_cast<CCNode*>(
|
||||
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();
|
||||
|
|
|
@ -46,9 +46,9 @@ $register_ids(MenuLayer) {
|
|||
->setAxisAlignment(AxisAlignment::Start),
|
||||
pfp
|
||||
);
|
||||
profileMenu->setContentSize({ 200.f, 50.f });
|
||||
profileMenu->setContentSize({ 150.f, 50.f });
|
||||
profileMenu->setPositionX(
|
||||
profileMenu->getPositionX() + 200.f / 2 -
|
||||
profileMenu->getPositionX() + 150.f / 2 -
|
||||
pfp->getScaledContentSize().height / 2
|
||||
);
|
||||
profileMenu->updateLayout();
|
||||
|
@ -127,7 +127,7 @@ $register_ids(MenuLayer) {
|
|||
menu->setContentSize({ 100.f, 50.f });
|
||||
menu->setPositionX(
|
||||
menu->getPositionX() - 100.f / 2 +
|
||||
moreGamesBtn->getScaledContentSize().width / 2
|
||||
getSizeSafe(moreGamesBtn).width / 2
|
||||
);
|
||||
menu->setLayout(
|
||||
RowLayout::create()
|
||||
|
@ -136,18 +136,26 @@ $register_ids(MenuLayer) {
|
|||
);
|
||||
}
|
||||
|
||||
// add a menu to the top right corner that is empty but prolly a place mods
|
||||
// want to add stuff to since it's symmetrically opposite to the close button
|
||||
auto menu = CCMenu::create();
|
||||
menu->setPosition(winSize.width - 200.f / 2, winSize.height - 50.f / 2);
|
||||
menu->setID("top-right-menu");
|
||||
menu->setContentSize({ 200.f, 50.f });
|
||||
menu->setLayout(
|
||||
// add a menu to the top right corner and middle left that are empty
|
||||
// but prolly a place mods want to add stuff
|
||||
|
||||
auto topRightMenu = CCMenu::create();
|
||||
topRightMenu->setPosition(winSize.width - 200.f / 2, winSize.height - 50.f / 2);
|
||||
topRightMenu->setID("top-right-menu");
|
||||
topRightMenu->setContentSize({ 200.f, 50.f });
|
||||
topRightMenu->setLayout(
|
||||
RowLayout::create()
|
||||
->setAxisReverse(true)
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
);
|
||||
this->addChild(menu);
|
||||
this->addChild(topRightMenu);
|
||||
|
||||
auto middleLeftMenu = CCMenu::create();
|
||||
middleLeftMenu->setPosition(25.f, 215.f);
|
||||
middleLeftMenu->setID("side-menu");
|
||||
middleLeftMenu->setContentSize({ 50.f, 120.f });
|
||||
middleLeftMenu->setLayout(ColumnLayout::create());
|
||||
this->addChild(middleLeftMenu);
|
||||
}
|
||||
|
||||
struct $modify(MenuLayer) {
|
||||
|
|
Loading…
Add table
Reference in a new issue