Skip to content

Commit 720c7ee

Browse files
committed
add menu buttons to geometry dash page
1 parent e6d3195 commit 720c7ee

1 file changed

Lines changed: 43 additions & 1 deletion

File tree

src/pages/GeometryDash.cpp

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <Geode/binding/GJDropDownLayer.hpp>
77
#include <Geode/ui/Layout.hpp>
88
#include <Geode/ui/SimpleAxisLayout.hpp>
9+
#include "../fonts/FeatherIcons.hpp"
910

1011
void drawRowAxisArrow(
1112
ImDrawList& foreground,
@@ -384,7 +385,48 @@ void DevTools::drawGD(GLRenderCtx* gdCtx) {
384385
"Geometry Dash ({}x{})###devtools/geometry-dash",
385386
winSize.width, winSize.height
386387
);
387-
if (ImGui::Begin(title.c_str())) {
388+
bool gameStayAlive = true;
389+
if (ImGui::Begin(title.c_str(), &gameStayAlive, ImGuiWindowFlags_MenuBar)) {
390+
391+
if (!gameStayAlive) game::exit(true);
392+
393+
if (ImGui::BeginMenuBar()) {
394+
if (ImGui::MenuItem(U8STR(FEATHER_SAVE " Save"))) {
395+
AppDelegate::get()->trySaveGame(0);
396+
}
397+
398+
ImGui::SameLine();
399+
400+
static float time;
401+
auto currentTime = CCDirector::get()->getScheduler()->getTimeScale();
402+
time = currentTime > 0 ? currentTime : time;
403+
404+
if (ImGui::MenuItem(U8STR(
405+
m_pauseGame ? FEATHER_LOCK " Resume" : FEATHER_UNLOCK " Pause"
406+
))) {
407+
m_pauseGame ^= 1;
408+
if (m_pauseGame) {
409+
FMODAudioEngine::sharedEngine()->pauseAllAudio();
410+
CCDirector::get()->getScheduler()->setTimeScale(0.0f);
411+
}
412+
else {
413+
FMODAudioEngine::sharedEngine()->resumeAllAudio();
414+
CCDirector::get()->getScheduler()->setTimeScale(time);
415+
}
416+
}
417+
418+
ImGui::SameLine();
419+
if (ImGui::MenuItem(U8STR(FEATHER_PACKAGE " Reload"))) {
420+
GameManager::get()->reloadAll(0, 0, 0);
421+
}
422+
423+
ImGui::SameLine();
424+
if (ImGui::MenuItem(U8STR(FEATHER_REFRESH_CW " Restart"))) {
425+
game::restart(true);
426+
}
427+
}
428+
ImGui::EndMenuBar();
429+
388430
auto list = ImGui::GetWindowDrawList();
389431
auto ratio = gdCtx->size().x / gdCtx->size().y;
390432

0 commit comments

Comments
 (0)