Skip to content

Commit

Permalink
More preliminary setup
Browse files Browse the repository at this point in the history
  • Loading branch information
aMannus committed Jan 30, 2025
1 parent 00a31c8 commit f666cf9
Show file tree
Hide file tree
Showing 9 changed files with 494 additions and 411 deletions.
25 changes: 14 additions & 11 deletions soh/soh/SohGui/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,10 @@
#include "soh/OTRGlobals.h"
#include "soh/Enhancements/controls/SohInputEditorWindow.h"
#include "window/gui/GuiMenuBar.h"
#include "window/gui/GuiElement.h"/*
#include "DeveloperTools/SaveEditor.h"
#include "DeveloperTools/ActorViewer.h"
#include "DeveloperTools/CollisionViewer.h"
#include "DeveloperTools/EventLog.h"
#include "2s2h/Enhancements/GfxPatcher/AuthenticGfxPatches.h"
#include "HudEditor.h"
#include "Notification.h"*/
#include "window/gui/GuiElement.h"
#include <variant>
#include <spdlog/fmt/fmt.h>
#include "variables.h"
#include <variant>
#include <tuple>

extern "C" {
Expand Down Expand Up @@ -549,7 +541,7 @@ void Menu::DrawElement() {
float headerWidth = style.ItemSpacing.x;
bool headerSearch = !CVarGetInteger("gSettings.Menu.SidebarSearch", 0);
if (headerSearch) {
headerWidth += 200.0f + style.ItemSpacing.x + style.FramePadding.x;
headerWidth += 220.0f + style.ItemSpacing.x + style.FramePadding.x;
}
for (auto& label : menuOrder) {
ImVec2 size = ImGui::CalcTextSize(label.c_str());
Expand All @@ -559,7 +551,18 @@ void Menu::DrawElement() {
headerWidth += style.ItemSpacing.x;
}
}

// Full screen menu with widths below 1280, heights below 800.
// Up to 100 pixel padding when up to 1700 width, 1050 height.
// Everything above that, fixed size of 1600x950.
ImVec2 menuSize = { std::fminf(1280, windowWidth), std::fminf(800, windowHeight) };
if (windowWidth > 1380) {
menuSize.x = std::fminf(1600, windowWidth - 100);
}
if (windowHeight > 900) {
menuSize.y = std::fminf(950, windowHeight - 100);
}

pos += window->WorkRect.GetSize() / 2 - menuSize / 2;
ImGui::SetNextWindowPos(pos);
ImGui::BeginChild("Menu Block", menuSize,
Expand Down Expand Up @@ -672,7 +675,7 @@ void Menu::DrawElement() {
UIWidgets2::ButtonOptions options3 = {};
options3.color = UIWidgets2::Colors::Red;
options3.size = UIWidgets2::Sizes::Inline;
options3.tooltip = "Quit 2S2H";
options3.tooltip = "Quit SoH";
if (UIWidgets2::Button(ICON_FA_POWER_OFF, options3)) {
if (!popped) {
ToggleVisibility();
Expand Down
2 changes: 1 addition & 1 deletion soh/soh/SohGui/MenuTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ using OptionsVariant =
// `type` is the WidgetType for the widget, which is what determines how the information is used in the draw func
// `options` is a variant that holds the UIWidgetsOptions struct for the widget type
// blank objects need to be initialized with specific typing matching the expected Options struct for the widget
// `callback` is a lambda used for running code on widget change. may need `BenGui::GetMenu()` for specific menu actions
// `callback` is a lambda used for running code on widget change. may need `SohGui::GetMenu()` for specific menu actions
// `preFunc` is a lambda called before drawing code starts. It can be used to determine a widget's status,
// whether disabled or hidden, as well as update pointers for non-CVar widget types.
// `postFunc` is a lambda called after all drawing code is finished, for reacting to states other than
Expand Down
399 changes: 7 additions & 392 deletions soh/soh/SohGui/SohMenu.cpp

Large diffs are not rendered by default.

16 changes: 9 additions & 7 deletions soh/soh/SohGui/SohMenu.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef BENMENU_H
#define BENMNEU_H
#ifndef SOHMENU_H
#define SOHMENU_H

#include <libultraship/libultraship.h>
#include "UIWidgets2.hpp"
Expand Down Expand Up @@ -63,10 +63,12 @@ class SohMenu : public Ship::Menu {

void AddSidebarEntry(std::string sectionName, std::string sidbarName, uint32_t columnCount);
WidgetInfo& AddWidget(WidgetPath& pathInfo, std::string widgetName, WidgetType widgetType);
void AddSettings();
void AddEnhancements();
void AddDevTools();
void AddMenuSettings();
void AddMenuEnhancements();
void AddMenuDevTools();
void AddMenuRandomizer();
void AddMenuNetwork();
};
} // namespace BenGui
} // namespace SohGui

#endif // BENMENU_H
#endif // SOHMENU_H
76 changes: 76 additions & 0 deletions soh/soh/SohGui/SohMenuDevTools.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#include "SohMenu.h"

namespace SohGui {

extern std::shared_ptr<SohMenu> mSohMenu;
using namespace UIWidgets2;

void SohMenu::AddMenuDevTools() {
// Add Dev Tools Menu
AddMenuEntry("Dev Tools", "gSettings.Menu.DevToolsSidebarSection");

// Menu 1
AddSidebarEntry("Dev Tools", "General", 3);
WidgetPath path = { "Dev Tools", "General", SECTION_COLUMN_1 };

AddWidget(path, "Filler1", WIDGET_TEXT);

// AddWidget(path, "Popout Menu", WIDGET_CVAR_CHECKBOX)
// .CVar("gSettings.Menu.Popout")
// .Options(CheckboxOptions().Tooltip("Changes the menu display from overlay to windowed."));
//
//// dev tools windows
// path = { "Developer Tools", "Collision Viewer", SECTION_COLUMN_1 };
// AddSidebarEntry("Developer Tools", "Collision Viewer", 1);
// AddWidget(path, "Popout Collision Viewer", WIDGET_WINDOW_BUTTON)
// .CVar("gWindows.CollisionViewer")
// .Options(ButtonOptions().Tooltip("Makes collision visible on screen").Size(Sizes::Inline))
// .WindowName("Collision Viewer");

// path = { "Developer Tools", "Stats", SECTION_COLUMN_1 };
// AddSidebarEntry("Developer Tools", "Stats", 1);
// AddWidget(path, "Popout Stats", WIDGET_WINDOW_BUTTON)
// .CVar("gOpenWindows.Stats")
// .Options(ButtonOptions().Tooltip(
// "Shows the stats window, with your FPS and frametimes, and the OS you're playing on"))
// .WindowName("Stats");

// path = { "Developer Tools", "Console", SECTION_COLUMN_1 };
// AddSidebarEntry("Developer Tools", "Console", 1);
// AddWidget(path, "Popout Console", WIDGET_WINDOW_BUTTON)
// .CVar("gOpenWindows.Console")
// .Options(ButtonOptions().Tooltip(
// "Enables the console window, allowing you to input commands. Type help for some examples"))
// .WindowName("Console");

// path = { "Developer Tools", "Gfx Debugger", SECTION_COLUMN_1 };
// AddSidebarEntry("Developer Tools", "Gfx Debugger", 1);
// AddWidget(path, "Popout Gfx Debugger", WIDGET_WINDOW_BUTTON)
// .CVar("gOpenWindows.GfxDebugger")
// .Options(ButtonOptions().Tooltip(
// "Enables the Gfx Debugger window, allowing you to input commands, type help for some examples"))
// .WindowName("GfxDebuggerWindow");

// path = { "Developer Tools", "Save Editor", SECTION_COLUMN_1 };
// AddSidebarEntry("Developer Tools", "Save Editor", 1);
// AddWidget(path, "Popout Save Editor", WIDGET_WINDOW_BUTTON)
// .CVar("gWindows.SaveEditor")
// .Options(ButtonOptions().Tooltip("Enables the Save Editor window, allowing you to edit your save file"))
// .WindowName("Save Editor");

// path = { "Developer Tools", "Actor Viewer", SECTION_COLUMN_1 };
// AddSidebarEntry("Developer Tools", "Actor Viewer", 1);
// AddWidget(path, "Popout Actor Viewer", WIDGET_WINDOW_BUTTON)
// .CVar("gWindows.ActorViewer")
// .Options(ButtonOptions().Tooltip("Enables the Actor Viewer window, allowing you to view actors in the
// world.")) .WindowName("Actor Viewer");

// path = { "Developer Tools", "Event Log", SECTION_COLUMN_1 };
// AddSidebarEntry("Developer Tools", "Event Log", 1);
// AddWidget(path, "Popout Event Log", WIDGET_WINDOW_BUTTON)
// .CVar("gWindows.EventLog")
// .Options(ButtonOptions().Tooltip("Enables the event log window"))
// .WindowName("Event Log");
}

} // namespace SohGui
42 changes: 42 additions & 0 deletions soh/soh/SohGui/SohMenuEnhancements.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include "SohMenu.h"

namespace SohGui {

extern std::shared_ptr<SohMenu> mSohMenu;
using namespace UIWidgets2;

void SohMenu::AddMenuEnhancements() {
// Add Enhancements Menu
AddMenuEntry("Enhancements", "gSettings.Menu.EnhancementsSidebarSection");

// Menu 1
WidgetPath path = { "Enhancements", "Menu 1", SECTION_COLUMN_1 };
AddSidebarEntry("Enhancements", "Menu 1", 3);

AddWidget(path, "Menu 1 filler", WIDGET_TEXT);

// Cheats
path.sidebarName = "Cheats";
AddSidebarEntry("Enhancements", "Cheats", 3);

AddWidget(path, "Cheats filler", WIDGET_TEXT);

// HUD Editor
// path = { "Enhancements", "HUD Editor", SECTION_COLUMN_1 };
// AddSidebarEntry("Enhancements", "HUD Editor", 1);
// AddWidget(path, "Popout HUD Editor", WIDGET_WINDOW_BUTTON)
// .CVar("gWindows.HudEditor")
// .WindowName("HUD Editor")
// .Options(ButtonOptions()
// .Tooltip("Enables the HUD Editor window, allowing you to modify your HUD")
// .Size(Sizes::Inline));

//// Item Tracker Settings
// path = { "Enhancements", "Item Tracker", SECTION_COLUMN_1 };
// AddSidebarEntry("Enhancements", "Item Tracker", 1);
// AddWidget(path, "Popout Item Tracker", WIDGET_WINDOW_BUTTON)
// .CVar("gWindows.ItemTracker")
// .WindowName("Item Tracker Settings");
}

} // namespace SohGui
19 changes: 19 additions & 0 deletions soh/soh/SohGui/SohMenuNetwork.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "SohMenu.h"

namespace SohGui {

extern std::shared_ptr<SohMenu> mSohMenu;
using namespace UIWidgets2;

void SohMenu::AddMenuNetwork() {
// Add Network Menu
AddMenuEntry("Network", "gSettings.Menu.NetworkSidebarSection");

// General
AddSidebarEntry("Network", "General", 3);
WidgetPath path = { "Network", "General", SECTION_COLUMN_1 };

AddWidget(path, "Filler1", WIDGET_TEXT);
}

} // namespace SohGui
19 changes: 19 additions & 0 deletions soh/soh/SohGui/SohMenuRandomizer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "SohMenu.h"

namespace SohGui {

extern std::shared_ptr<SohMenu> mSohMenu;
using namespace UIWidgets2;

void SohMenu::AddMenuRandomizer() {
// Add Randomizer Menu
AddMenuEntry("Randomizer", "gSettings.Menu.RandomizerSidebarSection");

// Menu 1
WidgetPath path = { "Randomizer", "Menu 1", SECTION_COLUMN_1 };
AddSidebarEntry("Randomizer", "Menu 1", 3);

AddWidget(path, "Filler1", WIDGET_TEXT);
}

} // namespace SohGui
Loading

0 comments on commit f666cf9

Please sign in to comment.