Gui window rework (#4307)

* Converted all GuiWindows to the new separate Begin/End format in current LUS except InputViewer, CheckTracker, ItemTracker and Modals.

* Setup Check, Entrance, Item trackers and Input Viewer to override `Draw()` to bypass the ImGui Begin and End, as they're not intended to go in the modern menu.

* Cleanup.
This commit is contained in:
Malkierian 2024-09-10 12:42:57 -07:00 committed by GitHub
parent 48663d74ac
commit b5037a0856
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 754 additions and 807 deletions

View File

@ -424,12 +424,6 @@ void AudioEditor::InitElement() {
void AudioEditor::DrawElement() {
AudioCollection::Instance->InitializeShufflePool();
ImGui::SetNextWindowSize(ImVec2(820, 630), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Audio Editor", &mIsVisible)) {
ImGui::End();
return;
}
float buttonSegments = ImGui::GetContentRegionAvail().x / 4;
if (ImGui::Button("Randomize All Groups", ImVec2(buttonSegments, 30.0f))) {
AudioEditor_RandomizeAll();
@ -700,7 +694,6 @@ void AudioEditor::DrawElement() {
ImGui::EndTabBar();
}
ImGui::End();
}
std::vector<SeqType> allTypes = { SEQ_BGM_WORLD, SEQ_BGM_EVENT, SEQ_BGM_BATTLE, SEQ_OCARINA, SEQ_FANFARE, SEQ_INSTRUMENT, SEQ_SFX, SEQ_VOICE };

View File

@ -61,6 +61,15 @@ void InputViewer::RenderButton(std::string btnTexture, std::string btnOutlineTex
}
}
void InputViewer::Draw() {
if (!IsVisible()) {
return;
}
DrawElement();
// Sync up the IsVisible flag if it was changed by ImGui
SyncVisibilityConsoleVariable();
}
void InputViewer::DrawElement() {
if (CVarGetInteger(CVAR_WINDOW("InputViewer"), 0)) {
static bool sButtonTexturesLoaded = false;
@ -393,12 +402,14 @@ void InputViewer::DrawElement() {
ImGui::PushStyleColor(
ImGuiCol_Text,
color2Vec(CVarGetColor(CVAR_INPUT_VIEWER("AnalogAngles.Range1.Color"), vec2Color(range1Color))));
} else if (CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Range2.Enabled"), 0) &&
}
else if (CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Range2.Enabled"), 0) &&
(rSquared >= (range2Min * range2Min)) && (rSquared < (range2Max * range2Max))) {
ImGui::PushStyleColor(
ImGuiCol_Text,
color2Vec(CVarGetColor(CVAR_INPUT_VIEWER("AnalogAngles.Range2.Color"), vec2Color(range2Color))));
} else {
}
else {
ImGui::PushStyleColor(ImGuiCol_Text, color2Vec(CVarGetColor(CVAR_INPUT_VIEWER("AnalogAngles.TextColor"),
vec2Color(textColor))));
}
@ -425,10 +436,6 @@ InputViewerSettingsWindow::~InputViewerSettingsWindow() {
}
void InputViewerSettingsWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(500, 525), ImGuiCond_FirstUseEver);
if (ImGui::Begin("Input Viewer Settings", &mIsVisible, ImGuiWindowFlags_HorizontalScrollbar)) {
// gInputViewer.Scale
UIWidgets::EnhancementSliderFloat("Input Viewer Scale: %.2f", "##Input", CVAR_INPUT_VIEWER("Scale"), 0.1f, 5.0f, "",
1.0f, false, true);
@ -675,7 +682,4 @@ void InputViewerSettingsWindow::DrawElement() {
}
}
}
ImGui::End();
}
}

View File

@ -21,6 +21,7 @@ class InputViewer : public Ship::GuiWindow {
public:
using GuiWindow::GuiWindow;
void Draw() override;
void InitElement() override {};
void DrawElement() override;
void UpdateElement() override {};

View File

@ -1687,12 +1687,6 @@ static const char* colorSchemes[2] = {
};
void CosmeticsEditorWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(550, 520), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Cosmetics Editor", &mIsVisible)) {
ImGui::End();
return;
}
ImGui::Text("Color Scheme");
ImGui::SameLine();
UIWidgets::EnhancementCombobox(CVAR_COSMETIC("DefaultColorScheme"), colorSchemes, COLORSCHEME_N64);
@ -1811,7 +1805,6 @@ void CosmeticsEditorWindow::DrawElement() {
}
ImGui::EndTabBar();
}
ImGui::End();
}
void RegisterOnLoadGameHook() {

View File

@ -20,11 +20,6 @@ void MessageViewer::InitElement() {
}
void MessageViewer::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Custom Message Debugger", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
ImGui::Text("Table ID");
ImGui::SameLine();
ImGui::InputText("##TableID", mTableIdBuf, MAX_STRING_SIZE, ImGuiInputTextFlags_CallbackCharFilter, UIWidgets::TextFilters::FilterAlphaNum);
@ -74,7 +69,6 @@ void MessageViewer::DrawElement() {
if (ImGui::Button("Display Message##CustomMessage")) {
mDisplayCustomMessageClicked = true;
}
ImGui::End();
// ReSharper restore CppDFAUnreachableCode
}

View File

@ -925,12 +925,6 @@ void ActorViewer_AddTagForAllActors() {
}
void ActorViewerWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Actor Viewer", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
static Actor* display;
static Actor empty{};
static Actor* fetch = NULL;
@ -1235,8 +1229,6 @@ void ActorViewerWindow::DrawElement() {
actors.clear();
}
}
ImGui::End();
}
void ActorViewerWindow::InitElement() {

View File

@ -53,11 +53,6 @@ static std::vector<Vtx> sphereVtx;
// Draws the ImGui window for the collision viewer
void ColViewerWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Collision Viewer", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
UIWidgets::EnhancementCheckbox("Enabled", CVAR_DEVELOPER_TOOLS("ColViewer.Enabled"));
UIWidgets::LabeledRightAlignedEnhancementCombobox("Scene", CVAR_DEVELOPER_TOOLS("ColViewer.Scene"), ColRenderSettingNames, COLVIEW_DISABLED);
@ -95,8 +90,6 @@ void ColViewerWindow::DrawElement() {
} else {
UIWidgets::InsertHelpHoverText(colorHelpText);
}
ImGui::End();
}
// Calculates the normal for a triangle at the 3 specified points

View File

@ -1747,12 +1747,6 @@ void DrawPlayerTab() {
}
void SaveEditorWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Save Editor", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
if (ImGui::BeginTabBar("SaveContextTabBar", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) {
if (ImGui::BeginTabItem("Info")) {
DrawInfoTab();
@ -1786,8 +1780,6 @@ void SaveEditorWindow::DrawElement() {
ImGui::EndTabBar();
}
ImGui::End();
}
void SaveEditorWindow::InitElement() {

View File

@ -90,12 +90,6 @@ void PerformDisplayListSearch() {
}
void DLViewerWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Display List Viewer", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
// Debounce the search field as listing otr files is expensive
if (ImGui::InputText("Search Display Lists", searchString, ARRAY_COUNT(searchString))) {
doSearch = true;
@ -122,7 +116,6 @@ void DLViewerWindow::DrawElement() {
}
if (activeDisplayList == "") {
ImGui::End();
return;
}
@ -131,7 +124,6 @@ void DLViewerWindow::DrawElement() {
if (res->GetInitData()->Type != static_cast<uint32_t>(LUS::ResourceType::DisplayList)) {
ImGui::Text("Resource type is not a Display List. Please choose another.");
ImGui::End();
return;
}
@ -325,11 +317,8 @@ void DLViewerWindow::DrawElement() {
}
} catch (const std::exception& e) {
ImGui::Text("Error displaying DL instructions.");
ImGui::End();
return;
}
ImGui::End();
}
void DLViewerWindow::InitElement() {

View File

@ -102,12 +102,6 @@ extern "C" void ValueViewer_Draw(GfxPrint* printer) {
}
void ValueViewerWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Value Viewer", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
UIWidgets::PaddedEnhancementCheckbox("Enable Printing", CVAR_DEVELOPER_TOOLS("ValueViewerEnablePrinting"));
ImGui::BeginGroup();
@ -212,8 +206,6 @@ void ValueViewerWindow::DrawElement() {
}
ImGui::EndGroup();
}
ImGui::End();
}
void ValueViewerWindow::InitElement() {

View File

@ -625,12 +625,6 @@ void DrawGameplayStatsOptionsTab() {
}
void GameplayStatsWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(480, 550), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Gameplay Stats", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
DrawGameplayStatsHeader();
if (ImGui::BeginTabBar("Stats", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) {
@ -654,8 +648,6 @@ void GameplayStatsWindow::DrawElement() {
}
ImGui::Text("Note: Gameplay stats are saved to the current file and will be\nlost if you quit without saving.");
ImGui::End();
}
void InitStats(bool isDebug) {
gSaveContext.sohStats.heartPieces = isDebug ? 8 : 0;

View File

@ -3137,13 +3137,6 @@ void RandomizerSettingsWindow::DrawElement() {
static int maxKeyringCount;
static bool disableGFKeyring = false;
ImGui::SetNextWindowSize(ImVec2(920, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Randomizer Editor", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
bool disableEditingRandoSettings = CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0) || CVarGetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 0);
if (disableEditingRandoSettings) {
UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f);
@ -5284,7 +5277,6 @@ void RandomizerSettingsWindow::DrawElement() {
if (disableEditingRandoSettings) {
UIWidgets::ReEnableComponent("");
}
ImGui::End();
}
CustomMessage Randomizer::GetWarpSongMessage(u16 textId, bool mysterious) {

View File

@ -867,9 +867,16 @@ void UpdateCheck(uint32_t check, RandomizerCheckTrackerData data) {
UpdateOrdering(area);
}
void CheckTrackerWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(400, 540), ImGuiCond_FirstUseEver);
void CheckTrackerWindow::Draw() {
if (!IsVisible()) {
return;
}
DrawElement();
// Sync up the IsVisible flag if it was changed by ImGui
SyncVisibilityConsoleVariable();
}
void CheckTrackerWindow::DrawElement() {
if (CVarGetInteger(CVAR_TRACKER_CHECK("WindowType"), TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) {
if (CVarGetInteger(CVAR_TRACKER_CHECK("ShowOnlyPaused"), 0) && (gPlayState == nullptr || gPlayState->pauseCtx.state == 0)) {
return;
@ -888,6 +895,8 @@ void CheckTrackerWindow::DrawElement() {
}
}
ImGui::SetNextWindowSize(ImVec2(400, 540), ImGuiCond_FirstUseEver);
BeginFloatWindows("Check Tracker", mIsVisible, ImGuiWindowFlags_NoScrollbar);
if (!GameInteractor::IsSaveLoaded() || !initialized) {
@ -1601,14 +1610,8 @@ static const char* windowType[] = { "Floating", "Window" };
static const char* displayType[] = { "Always", "Combo Button Hold" };
static const char* buttonStrings[] = { "A Button", "B Button", "C-Up", "C-Down", "C-Left", "C-Right", "L Button",
"Z Button", "R Button", "Start", "D-Up", "D-Down", "D-Left", "D-Right" };
void CheckTrackerSettingsWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(600, 375), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Check Tracker Settings", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, { 8.0f, 8.0f });
ImGui::BeginTable("CheckTrackerSettingsTable", 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV);
ImGui::TableSetupColumn("General settings", ImGuiTableColumnFlags_WidthStretch, 200.0f);
@ -1668,7 +1671,6 @@ void CheckTrackerSettingsWindow::DrawElement() {
ImGui::PopStyleVar(1);
ImGui::EndTable();
ImGui::End();
}
void CheckTrackerWindow::InitElement() {

View File

@ -21,6 +21,7 @@ class CheckTrackerSettingsWindow : public Ship::GuiWindow {
class CheckTrackerWindow : public Ship::GuiWindow {
public:
using GuiWindow::GuiWindow;
void Draw() override;
~CheckTrackerWindow() {};
protected:

View File

@ -636,7 +636,17 @@ void InitEntranceTrackingData() {
SortEntranceListByType(destListSortedByType, 1);
}
void EntranceTrackerWindow::Draw() {
if (!IsVisible()) {
return;
}
DrawElement();
// Sync up the IsVisible flag if it was changed by ImGui
SyncVisibilityConsoleVariable();
}
void EntranceTrackerWindow::DrawElement() {
// Begin tracker settings
ImGui::SetNextWindowSize(ImVec2(600, 375), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Entrance Tracker", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
@ -644,7 +654,6 @@ void EntranceTrackerWindow::DrawElement() {
return;
}
// Begin tracker settings
ImGui::SetNextItemOpen(false, ImGuiCond_Once);
if (ImGui::TreeNode("Tracker Settings")) {
// Reduce indentation from the tree node for the table

View File

@ -89,6 +89,7 @@ class EntranceTrackerWindow : public Ship::GuiWindow {
public:
using GuiWindow::GuiWindow;
void Draw() override;
void InitElement() override;
void DrawElement() override;
void UpdateElement() override {};

View File

@ -1006,6 +1006,15 @@ void ItemTrackerLoadFile() {
}
}
void ItemTrackerWindow::Draw() {
if (!IsVisible()) {
return;
}
DrawElement();
// Sync up the IsVisible flag if it was changed by ImGui
SyncVisibilityConsoleVariable();
}
void ItemTrackerWindow::DrawElement() {
UpdateVectors();
@ -1122,13 +1131,6 @@ static const char* displayTypes[3] = { "Hidden", "Main Window", "Separate" };
static const char* extendedDisplayTypes[4] = { "Hidden", "Main Window", "Misc Window", "Separate" };
void ItemTrackerSettingsWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(733, 472), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Item Tracker Settings", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, { 8.0f, 8.0f });
ImGui::BeginTable("itemTrackerSettingsTable", 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV);
ImGui::TableSetupColumn("General settings", ImGuiTableColumnFlags_WidthStretch, 200.0f);
@ -1255,8 +1257,6 @@ void ItemTrackerSettingsWindow::DrawElement() {
ImGui::PopStyleVar(1);
ImGui::EndTable();
ImGui::End();
}
void ItemTrackerWindow::InitElement() {

View File

@ -42,6 +42,7 @@ class ItemTrackerSettingsWindow : public Ship::GuiWindow {
class ItemTrackerWindow : public Ship::GuiWindow {
public:
using GuiWindow::GuiWindow;
void Draw() override;
protected:
void InitElement() override;

View File

@ -59,8 +59,6 @@ void AdvancedResolutionSettingsWindow::InitElement() {
}
void AdvancedResolutionSettingsWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(497, 599), ImGuiCond_FirstUseEver);
if (ImGui::Begin("Advanced Resolution Settings", &mIsVisible)) {
// Initialise update flags.
bool update[3];
for (uint8_t i = 0; i < sizeof(update); i++)
@ -475,8 +473,6 @@ void AdvancedResolutionSettingsWindow::DrawElement() {
CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".UIComboItem.PixelCount", item_pixelCount);
CVarSave();
}
}
ImGui::End();
}
void AdvancedResolutionSettingsWindow::UpdateElement() {

View File

@ -164,41 +164,41 @@ namespace SohGui {
SPDLOG_ERROR("Could not find input editor window");
}
mAudioEditorWindow = std::make_shared<AudioEditor>(CVAR_WINDOW("AudioEditor"), "Audio Editor");
mAudioEditorWindow = std::make_shared<AudioEditor>(CVAR_WINDOW("AudioEditor"), "Audio Editor", ImVec2(820, 630));
gui->AddGuiWindow(mAudioEditorWindow);
mInputViewer = std::make_shared<InputViewer>(CVAR_WINDOW("InputViewer"), "Input Viewer");
gui->AddGuiWindow(mInputViewer);
mInputViewerSettings = std::make_shared<InputViewerSettingsWindow>(CVAR_WINDOW("InputViewerSettings"), "Input Viewer Settings");
mInputViewerSettings = std::make_shared<InputViewerSettingsWindow>(CVAR_WINDOW("InputViewerSettings"), "Input Viewer Settings", ImVec2(500, 525));
gui->AddGuiWindow(mInputViewerSettings);
mCosmeticsEditorWindow = std::make_shared<CosmeticsEditorWindow>(CVAR_WINDOW("CosmeticsEditor"), "Cosmetics Editor");
mCosmeticsEditorWindow = std::make_shared<CosmeticsEditorWindow>(CVAR_WINDOW("CosmeticsEditor"), "Cosmetics Editor", ImVec2(550, 520));
gui->AddGuiWindow(mCosmeticsEditorWindow);
mActorViewerWindow = std::make_shared<ActorViewerWindow>(CVAR_WINDOW("ActorViewer"), "Actor Viewer");
mActorViewerWindow = std::make_shared<ActorViewerWindow>(CVAR_WINDOW("ActorViewer"), "Actor Viewer", ImVec2(520, 600));
gui->AddGuiWindow(mActorViewerWindow);
mColViewerWindow = std::make_shared<ColViewerWindow>(CVAR_WINDOW("CollisionViewer"), "Collision Viewer");
mColViewerWindow = std::make_shared<ColViewerWindow>(CVAR_WINDOW("CollisionViewer"), "Collision Viewer", ImVec2(520, 600));
gui->AddGuiWindow(mColViewerWindow);
mSaveEditorWindow = std::make_shared<SaveEditorWindow>(CVAR_WINDOW("SaveEditor"), "Save Editor");
mSaveEditorWindow = std::make_shared<SaveEditorWindow>(CVAR_WINDOW("SaveEditor"), "Save Editor", ImVec2(520, 600));
gui->AddGuiWindow(mSaveEditorWindow);
mDLViewerWindow = std::make_shared<DLViewerWindow>(CVAR_WINDOW("DLViewer"), "Display List Viewer");
mDLViewerWindow = std::make_shared<DLViewerWindow>(CVAR_WINDOW("DLViewer"), "Display List Viewer", ImVec2(520, 600));
gui->AddGuiWindow(mDLViewerWindow);
mValueViewerWindow = std::make_shared<ValueViewerWindow>(CVAR_WINDOW("ValueViewer"), "Value Viewer");
mValueViewerWindow = std::make_shared<ValueViewerWindow>(CVAR_WINDOW("ValueViewer"), "Value Viewer", ImVec2(520, 600));
gui->AddGuiWindow(mValueViewerWindow);
mMessageViewerWindow = std::make_shared<MessageViewer>(CVAR_WINDOW("MessageViewer"), "Message Viewer");
mMessageViewerWindow = std::make_shared<MessageViewer>(CVAR_WINDOW("MessageViewer"), "Message Viewer", ImVec2(520, 600));
gui->AddGuiWindow(mMessageViewerWindow);
mGameplayStatsWindow = std::make_shared<GameplayStatsWindow>(CVAR_WINDOW("GameplayStats"), "Gameplay Stats");
mGameplayStatsWindow = std::make_shared<GameplayStatsWindow>(CVAR_WINDOW("GameplayStats"), "Gameplay Stats", ImVec2(480, 550));
gui->AddGuiWindow(mGameplayStatsWindow);
mCheckTrackerWindow = std::make_shared<CheckTracker::CheckTrackerWindow>(CVAR_WINDOW("CheckTracker"), "Check Tracker");
gui->AddGuiWindow(mCheckTrackerWindow);
mCheckTrackerSettingsWindow = std::make_shared<CheckTracker::CheckTrackerSettingsWindow>(CVAR_WINDOW("CheckTrackerSettings"), "Check Tracker Settings");
mCheckTrackerSettingsWindow = std::make_shared<CheckTracker::CheckTrackerSettingsWindow>(CVAR_WINDOW("CheckTrackerSettings"), "Check Tracker Settings", ImVec2(600, 375));
gui->AddGuiWindow(mCheckTrackerSettingsWindow);
mEntranceTrackerWindow = std::make_shared<EntranceTrackerWindow>(CVAR_WINDOW("EntranceTracker"),"Entrance Tracker");
gui->AddGuiWindow(mEntranceTrackerWindow);
mItemTrackerWindow = std::make_shared<ItemTrackerWindow>(CVAR_WINDOW("ItemTracker"), "Item Tracker");
gui->AddGuiWindow(mItemTrackerWindow);
mItemTrackerSettingsWindow = std::make_shared<ItemTrackerSettingsWindow>(CVAR_WINDOW("ItemTrackerSettings"), "Item Tracker Settings");
mItemTrackerSettingsWindow = std::make_shared<ItemTrackerSettingsWindow>(CVAR_WINDOW("ItemTrackerSettings"), "Item Tracker Settings", ImVec2(733, 472));
gui->AddGuiWindow(mItemTrackerSettingsWindow);
mRandomizerSettingsWindow = std::make_shared<RandomizerSettingsWindow>(CVAR_WINDOW("RandomizerSettings"), "Randomizer Settings");
mRandomizerSettingsWindow = std::make_shared<RandomizerSettingsWindow>(CVAR_WINDOW("RandomizerSettings"), "Randomizer Settings", ImVec2(920, 600));
gui->AddGuiWindow(mRandomizerSettingsWindow);
mAdvancedResolutionSettingsWindow = std::make_shared<AdvancedResolutionSettings::AdvancedResolutionSettingsWindow>(CVAR_WINDOW("AdvancedResolutionEditor"), "Advanced Resolution Settings");
mAdvancedResolutionSettingsWindow = std::make_shared<AdvancedResolutionSettings::AdvancedResolutionSettingsWindow>(CVAR_WINDOW("AdvancedResolutionEditor"), "Advanced Resolution Settings", ImVec2(497, 599));
gui->AddGuiWindow(mAdvancedResolutionSettingsWindow);
mModalWindow = std::make_shared<SohModalWindow>(CVAR_WINDOW("ModalWindow"), "Modal Window");
gui->AddGuiWindow(mModalWindow);

View File

@ -19,6 +19,15 @@ struct SohModal {
};
std::vector<SohModal> modals;
void SohModalWindow::Draw() {
if (!IsVisible()) {
return;
}
DrawElement();
// Sync up the IsVisible flag if it was changed by ImGui
SyncVisibilityConsoleVariable();
}
void SohModalWindow::DrawElement() {
if (modals.size() > 0) {
SohModal curModal = modals.at(0);

View File

@ -7,6 +7,7 @@
class SohModalWindow : public Ship::GuiWindow {
public:
using GuiWindow::GuiWindow;
void Draw() override;
void InitElement() override {};
void DrawElement() override;