Skip to content

Commit 3cb3ae7

Browse files
committed
add restart gd button to geode menu
1 parent 78f6315 commit 3cb3ae7

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

loader/src/ui/mods/ModsLayer.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,20 @@ bool ModsLayer::init() {
422422
settingsBtn->setID("settings-button");
423423
actionsMenu->addChild(settingsBtn);
424424

425+
auto restartGDSpr = CCSprite::createWithSpriteFrameName("reload.png"_spr);
426+
restartGDSpr->setColor({ 255, 100, 100 });
427+
auto restartGDCircleSpr = createGeodeCircleButton(
428+
restartGDSpr, 1.f,
429+
CircleBaseSize::Medium
430+
);
431+
restartGDCircleSpr->setScale(.8f);
432+
restartGDCircleSpr->setTopOffset(ccp(.5f, 0));
433+
auto restartGDBtn = CCMenuItemSpriteExtra::create(
434+
restartGDCircleSpr, this, menu_selector(ModsLayer::onRestartGD)
435+
);
436+
restartGDBtn->setID("restart-gd-button");
437+
actionsMenu->addChild(restartGDBtn);
438+
425439
auto folderSpr = createGeodeCircleButton(
426440
CCSprite::createWithSpriteFrameName("gj_folderBtn_001.png"), 1.f,
427441
CircleBaseSize::Medium
@@ -848,6 +862,18 @@ void ModsLayer::onTheme(CCObject*) {
848862
void ModsLayer::onSettings(CCObject*) {
849863
openSettingsPopup(Mod::get(), false);
850864
}
865+
void ModsLayer::onRestartGD(CCObject*) {
866+
createQuickPopup(
867+
"Restart Geometry Dash",
868+
"Are you sure you want to restart Geometry Dash?",
869+
"Cancel", "Restart",
870+
[](auto, bool btn2) {
871+
if (btn2) {
872+
game::restart(true);
873+
}
874+
}
875+
);
876+
}
851877

852878
ModsLayer* ModsLayer::create() {
853879
auto ret = new ModsLayer();

0 commit comments

Comments
 (0)