more layouts

This commit is contained in:
hjfod 2023-02-11 23:14:04 +02:00
parent ef9e741bf9
commit a78bc0c9c8
2 changed files with 40 additions and 6 deletions

View file

@ -26,7 +26,7 @@ $register_ids(EditLevelLayer) {
"version-label",
"level-id-label",
"level-actions-menu",
"back-button-menu",
"back-menu",
"info-button-menu"
);
@ -35,7 +35,7 @@ $register_ids(EditLevelLayer) {
if (auto menu = this->getChildByID("level-edit-menu")) {
setIDs(menu, 0, "edit-button", "play-button", "share-button");
menu->setContentSize({ winSize.width - 160.f, 100.f });
menu->setLayout(RowLayout::create()->setGap(10.f));
menu->setLayout(RowLayout::create()->setGap(25.f));
}
if (auto menu = this->getChildByID("level-actions-menu")) {
@ -73,7 +73,18 @@ $register_ids(EditLevelLayer) {
menu->setZOrder(1);
}
if (auto menu = this->getChildByID("back-button-menu")) setIDSafe(menu, 0, "back-button");
if (auto menu = this->getChildByID("back-menu")) {
auto backBtn = setIDSafe(menu, 0, "back-button");
menu->setPositionX(
menu->getPositionX() + 100.f / 2 -
backBtn->getScaledContentSize().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");
}

View file

@ -8,7 +8,7 @@ USE_GEODE_NAMESPACE();
$register_ids(LevelBrowserLayer) {
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
menu->setID("go-back-menu");
menu->setID("back-menu");
setIDSafe(menu, 0, "back-button");
}
@ -38,10 +38,10 @@ $register_ids(LevelBrowserLayer) {
->setAxisAlignment(AxisAlignment::Start)
);
menu->setPositionY(
menu->getPositionY() + 150.f / 2 -
menu->getPositionY() + 130.f / 2 -
newLvlBtn->getScaledContentSize().height / 2
);
menu->setContentSize({ 50.f, 150.f });
menu->setContentSize({ 50.f, 130.f });
menu->updateLayout();
}
@ -78,6 +78,29 @@ $register_ids(LevelBrowserLayer) {
searchMenu->setContentSize({ 80.f, 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();
}
}
}
}