Skip to content

Commit 7adb713

Browse files
committed
New update
1 parent a64875a commit 7adb713

File tree

5 files changed

+96
-7
lines changed

5 files changed

+96
-7
lines changed

changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
# ChangeLog
2+
### BetterMenu V2.05
3+
* Fixed incompacts with qol
4+
* Popup when first installing the mod
5+
* Fixed restart buttons squeezeing
6+
* Leaderboard shortcut added
7+
* Overlapping fixes on some ui
8+
* Fixed a few bugs
29
### BetterMenu V2.04-beta.15
310
* fixed more incompats
411
* flipped the eye option

mod.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,12 @@
164164
"type": "bool",
165165
"default": true
166166
},
167+
"Leaderboard-Shortcut": {
168+
"name": "leaderboard Shortcut",
169+
"description": "Adds a Leaderboard button",
170+
"type": "bool",
171+
"default": true
172+
},
167173
"ShortcutSearch": {
168174
"name": "Search Shortcut",
169175
"description": "Removes More games and replaces it with Search button",

src/ModLayers/MenuLayer/FunctionLoader.cpp

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ bool RunAsAdmin(HWND hwnd, LPCSTR lpFile, LPCSTR lpParameters) {
3636
#endif
3737

3838

39-
4039
// separate hook to run tween after pages api updates the menu
4140
class $modify(MenuLayer) {
4241

@@ -128,7 +127,28 @@ class $modify(MenuLayer) {
128127
bool init() {
129128
if (!MenuLayer::init())
130129
return false;
131-
130+
131+
// check to show popup prompting user to change their settings
132+
if (!Mod::get()->setSavedValue("shown-settings-prompt", true)) {
133+
geode::Loader::get()->queueInMainThread([this] {
134+
auto pop = geode::createQuickPopup(
135+
"BetterMenu",
136+
"Thank you for installing the mod! Would you like to open the mod's <cr>Settings</c> to change how the menu looks",
137+
"No", "Yes",
138+
[this](FLAlertLayer* me, bool btn2) {
139+
if (btn2) {
140+
geode::Loader::get()->queueInMainThread([this] {
141+
geode::openSettingsPopup(Mod::get());
142+
});
143+
}
144+
}, false
145+
);
146+
pop->m_scene = this;
147+
pop->show();
148+
});
149+
}
150+
151+
132152
// checks if mod is disabled
133153
if (!Mod::get()->getSettingValue<bool>("RunMainMenu")) {
134154
return true;

src/ModLayers/MenuLayer/ModifyHooks/Shortcuts.hpp

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class TextureLoaderBetterMenu : public CCLayer {
1212
};
1313
static void setupshortcuts(CCNode* layer) {
1414
// setup vars
15+
int menupos = Mod::get()->getSettingValue<SettingPosStruct>("MenuPos-pos").m_pos;
1516
cocos2d::CCSize winSize = CCDirector::get()->getWinSize();
1617
// create the menu
1718
CCMenu* SearchMenu = Build<CCMenu>::create()
@@ -45,6 +46,24 @@ static void setupshortcuts(CCNode* layer) {
4546
.parent(SearchMenu)
4647
.id("search-menu"_spr);
4748
}
49+
50+
if (Mod::get()->getSettingValue<bool>("Leaderboard-Shortcut") && !Loader::get()->isModLoaded("ninxout.redash") && layer->getChildByIDRecursive("right-side-menu")) {
51+
CCSprite* LeaderboardShortcut = CCSprite::createWithSpriteFrameName(
52+
"GJ_highscoreBtn_001.png"
53+
);
54+
LeaderboardShortcut->setScale(0.5);
55+
auto Button = Build(LeaderboardShortcut)
56+
.intoMenuItem([](auto target) {
57+
CreatorLayer::create()->onLeaderboards(target);
58+
//reinterpret_cast<CreatorLayer*>(target)->onLeaderboards(target);
59+
})
60+
.pos(0, 0)
61+
.parent(layer->getChildByIDRecursive("right-side-menu"))
62+
.id("Leaderboard-menu"_spr);
63+
layer->getChildByIDRecursive("right-side-menu")->updateLayout();
64+
}
65+
66+
4867
if (Mod::get()->getSettingValue<bool>("TextureLDR-Shortcut") && (typeinfo_cast<CCMenuItemSpriteExtra*>(layer->getChildByIDRecursive("geode.texture-loader/texture-loader-button"))) && !Loader::get()->isModLoaded("ninxout.redash") ) {
4968
if (layer->getChildByID("more-games-menu")) {
5069
layer->getChildByID("more-games-menu")->setVisible(false);
@@ -57,7 +76,11 @@ static void setupshortcuts(CCNode* layer) {
5776
TextureLDRe->setID("texture-loader-button"_spr);
5877
TextureLDRe->m_pfnSelector = geode_texture_loader_texture_loader_button->m_pfnSelector;
5978
geode_texture_loader_texture_loader_button->setVisible(false); // no crash by hiding it
79+
geode_texture_loader_texture_loader_button->removeFromParent();
6080
SearchMenu->addChild(TextureLDRe);
81+
if (CCNode* Node = layer->getChildByID("right-side-menu")) {
82+
Node->updateLayout();
83+
}
6184
}
6285
CCMenu* shortcutMenu = Build<CCMenu>::create()
6386
.pos(7, 6)
@@ -166,8 +189,40 @@ static void setupshortcuts(CCNode* layer) {
166189
.parent(Menu2_2);
167190
}
168191
Menu2_2->updateLayout();
169-
SearchMenu->updateLayout();
170192
shortcutMenu->updateLayout();
193+
SearchMenu->updateLayout();
194+
//log::debug("SETTING IS ON! {}", menupos);
195+
if(menupos == 1) {
196+
if(CCNode* rightSideMenu = layer->getChildByID("right-side-menu")){
197+
if (!Mod::get()->getSettingValue<bool>("RightSide")) {
198+
rightSideMenu->setPositionY(rightSideMenu->getPositionY() + 40);
199+
rightSideMenu->updateLayout();
200+
};
201+
};
202+
if (SearchMenu->getChildrenCount() > 1) {
203+
SearchMenu->setPositionX(winSize.width - 110);
204+
SearchMenu->setScale(0.425);
205+
};
206+
} else {
207+
if (menupos == 2) {
208+
if(CCNode* rightSideMenu = layer->getChildByID("right-side-menu")){
209+
if (!Mod::get()->getSettingValue<bool>("RightSide")) {
210+
rightSideMenu->setPositionY(rightSideMenu->getPositionY() + 40);
211+
rightSideMenu->updateLayout();
212+
};
213+
};
214+
};
215+
}
216+
217+
if(menupos > 2) {
218+
if(CCNode* rightSideMenu = layer->getChildByID("right-side-menu")) {
219+
if (rightSideMenu->getChildrenCount() > 3) {
220+
SearchMenu->setPositionX(winSize.width - 110);
221+
SearchMenu->setScale(0.425);
222+
rightSideMenu->updateLayout();
223+
};
224+
};
225+
};
171226
// fixes with compact
172227
if (Mod::get()->getSettingValue<bool>("compact-main-menu")) {
173228
if (CCNode* node = layer->getChildByIDRecursive("shortcuts-menu-Fix"_spr)) node->setVisible(Loader::get()->isModLoaded("ninxout.redash"));

src/ModLayers/Settings/Settings.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,20 +182,21 @@ class SettingPosNode : public SettingNode {
182182

183183
this->addChild(menu);
184184
auto label = CCLabelBMFont::create("Menu Position", "bigFont.fnt");
185-
label->setScale(0.750);
185+
label->setScale(0.700);
186186
label->setPositionX(94);
187187
label->setPositionY(36);
188188
int pos = label->getPositionX();
189-
auto infoBtn = Build<CCSprite>::createSpriteName("GJ_infoIcon_001.png")
189+
CCSprite* infoicon = CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png");
190+
infoicon->setScale(0.75);
191+
auto infoBtn = Build(infoicon)
190192
.intoMenuItem([](auto target) {
191193
FLAlertLayer::create(
192194
"Menu Position",
193195
"Where the menu should be placed.",
194196
"OK"
195197
)->show();
196198
})
197-
.scale(0.750)
198-
.pos(-102 , 11)
199+
.pos(-90 , 11)
199200
.id("Pos_Info"_spr)
200201
.parent(menu);
201202

0 commit comments

Comments
 (0)