Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Settings to in-game menu, and rewrite it in C++ #14781

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions src/client/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "gui/guiChatConsole.h"
#include "gui/guiFormSpecMenu.h"
#include "gui/guiKeyChangeMenu.h"
#include "gui/guiSettingsMenu.h"
#include "gui/guiPasswordChange.h"
#include "gui/guiOpenURL.h"
#include "gui/guiVolumeChange.h"
Expand Down Expand Up @@ -79,7 +80,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "hud.h"
#include "clientdynamicinfo.h"
#include <IAnimatedMeshSceneNode.h>

#if USE_SOUND
#include "client/sound/sound_openal.h"
#endif
Expand Down Expand Up @@ -159,6 +159,11 @@ struct LocalFormspecHandler : public TextDest
g_gamecallback->keyConfig();
return;
}

if (fields.find("btn_config") != fields.end()) {
g_gamecallback->gameConfig();
return;
}

if (fields.find("btn_exit_menu") != fields.end()) {
g_gamecallback->disconnect();
Expand Down Expand Up @@ -611,7 +616,7 @@ class GameGlobalShaderConstantSetterFactory : public IShaderConstantSetterFactor
}
};

#define SIZE_TAG "size[11,5.5,true]" // Fixed size (ignored in touchscreen mode)
#define SIZE_TAG "size[11,6.2,true]" // Fixed size (ignored in touchscreen mode)

/****************************************************************************
****************************************************************************/
Expand Down Expand Up @@ -1872,6 +1877,24 @@ inline bool Game::handleCallbacks()
&g_menumgr, texture_src))->drop();
g_gamecallback->keyconfig_requested = false;
}

if (g_gamecallback->gameconfig_requested) {
(new GUISettingsMenu(guienv, guiroot, -1,
&g_menumgr, texture_src, input, m_rendering_engine,
client, sound_manager.get()))->drop();
g_gamecallback->gameconfig_requested = false;

// FormspecFormSource *fs_src = new FormspecFormSource(os.str());
// LocalFormspecHandler *txt_dst = new LocalFormspecHandler("MT_PAUSE_MENU");

// auto *&formspec = m_game_ui->getFormspecGUI();
// GUIFormSpecMenu::create(formspec, client, m_rendering_engine->get_gui_env(),
// &input->joystick, fs_src, txt_dst, client->getFormspecPrepend(),
// sound_manager.get());
// formspec->setFocus("btn_continue");
// // game will be paused in next step, if in singleplayer (see m_is_paused)
// formspec->doPause = true;
}

if (!g_gamecallback->show_open_url_dialog.empty()) {
(new GUIOpenURLMenu(guienv, guiroot, -1,
Expand Down Expand Up @@ -4488,6 +4511,8 @@ void Game::showPauseMenu()
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_key_config;"
<< strgettext("Controls") << "]";
#endif
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_config;"
<< strgettext("Settings") << "]";
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_exit_menu;"
<< strgettext("Exit to Menu") << "]";
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_exit_os;"
Expand Down
1 change: 1 addition & 0 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ set(gui_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/guiInventoryList.cpp
${CMAKE_CURRENT_SOURCE_DIR}/guiItemImage.cpp
${CMAKE_CURRENT_SOURCE_DIR}/guiKeyChangeMenu.cpp
${CMAKE_CURRENT_SOURCE_DIR}/guiSettingsMenu.cpp
${CMAKE_CURRENT_SOURCE_DIR}/guiOpenURL.cpp
${CMAKE_CURRENT_SOURCE_DIR}/guiPasswordChange.cpp
${CMAKE_CURRENT_SOURCE_DIR}/guiPathSelectMenu.cpp
Expand Down
Loading
Loading