mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-19 21:03:42 -07:00
Add Clear Devices button that will erase the controllers block. (#5683)
This commit is contained in:
parent
dfa10383e4
commit
a93b484cf3
2 changed files with 19 additions and 4 deletions
|
@ -71,7 +71,6 @@ std::shared_ptr<SohMenuBar> mSohMenuBar;
|
|||
std::shared_ptr<Ship::GuiWindow> mConsoleWindow;
|
||||
std::shared_ptr<SohStatsWindow> mStatsWindow;
|
||||
std::shared_ptr<Ship::GuiWindow> mGfxDebuggerWindow;
|
||||
std::shared_ptr<Ship::GuiWindow> mInputEditorWindow;
|
||||
|
||||
std::shared_ptr<SohMenu> mSohMenu;
|
||||
std::shared_ptr<AudioEditor> mAudioEditorWindow;
|
||||
|
@ -131,10 +130,10 @@ void SetupGuiElements() {
|
|||
mStatsWindow = std::make_shared<SohStatsWindow>(CVAR_WINDOW("SohStats"), "Stats##Soh", ImVec2(400, 100));
|
||||
gui->AddGuiWindow(mStatsWindow);
|
||||
|
||||
mInputEditorWindow = gui->GetGuiWindow("Controller Configuration");
|
||||
/*mInputEditorWindow = gui->GetGuiWindow("Controller Configuration");
|
||||
if (mInputEditorWindow == nullptr) {
|
||||
SPDLOG_ERROR("Could not find input editor window");
|
||||
}
|
||||
}*/
|
||||
|
||||
mAudioEditorWindow = std::make_shared<AudioEditor>(CVAR_WINDOW("AudioEditor"), "Audio Editor", ImVec2(820, 630));
|
||||
gui->AddGuiWindow(mAudioEditorWindow);
|
||||
|
@ -228,7 +227,6 @@ void Destroy() {
|
|||
mActorViewerWindow = nullptr;
|
||||
mCosmeticsEditorWindow = nullptr;
|
||||
mAudioEditorWindow = nullptr;
|
||||
mInputEditorWindow = nullptr;
|
||||
mStatsWindow = nullptr;
|
||||
mConsoleWindow = nullptr;
|
||||
mGfxDebuggerWindow = nullptr;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "SohMenu.h"
|
||||
#include "soh/Notification/Notification.h"
|
||||
#include "soh/Enhancements/controls/SohInputEditorWindow.h"
|
||||
#include "SohModals.h"
|
||||
#include <soh/GameVersions.h>
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
#include "UIWidgets.hpp"
|
||||
|
@ -13,6 +15,7 @@ extern "C" {
|
|||
namespace SohGui {
|
||||
|
||||
extern std::shared_ptr<SohMenu> mSohMenu;
|
||||
extern std::shared_ptr<SohModalWindow> mModalWindow;
|
||||
using namespace UIWidgets;
|
||||
|
||||
static std::unordered_map<int32_t, const char*> imguiScaleOptions = {
|
||||
|
@ -373,6 +376,20 @@ void SohMenu::AddMenuSettings() {
|
|||
path.sidebarName = "Controls";
|
||||
path.column = SECTION_COLUMN_1;
|
||||
AddSidebarEntry("Settings", "Controls", 2);
|
||||
AddWidget(path, "Clear Devices", WIDGET_BUTTON)
|
||||
.Callback([](WidgetInfo& info) {
|
||||
SohGui::mModalWindow->RegisterPopup(
|
||||
"Clear Config",
|
||||
"This will completely erase the controls config, including registered devices.\nContinue?", "Clear",
|
||||
"Cancel",
|
||||
[]() {
|
||||
Ship::Context::GetInstance()->GetConsoleVariables()->ClearBlock(CVAR_PREFIX_SETTING ".Controllers");
|
||||
uint8_t bits = 0;
|
||||
Ship::Context::GetInstance()->GetControlDeck()->Init(&bits);
|
||||
},
|
||||
nullptr);
|
||||
})
|
||||
.Options(ButtonOptions().Size(Sizes::Inline));
|
||||
AddWidget(path, "Controller Bindings", WIDGET_SEPARATOR_TEXT);
|
||||
AddWidget(path, "Popout Bindings Window", WIDGET_WINDOW_BUTTON)
|
||||
.CVar(CVAR_WINDOW("ControllerConfiguration"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue