Skip to content

Commit

Permalink
Merge PR HarbourMasters#595 from HarbourMasters/2ship2harkinian
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Sep 23, 2024
2 parents 7e5232c + 1a09819 commit 113d828
Show file tree
Hide file tree
Showing 4 changed files with 537 additions and 7 deletions.
12 changes: 7 additions & 5 deletions mm/2s2h/BenGui/BenGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <Fast3D/gfx_pc.h>
#include "UIWidgets.hpp"
#include "HudEditor.h"
#include <Enhancements/ResolutionEditor/ResolutionEditor.h>

#ifdef __APPLE__
#include "graphic/Fast3D/gfx_metal.h"
Expand Down Expand Up @@ -37,8 +38,7 @@ std::shared_ptr<HudEditorWindow> mHudEditorWindow;
std::shared_ptr<ActorViewerWindow> mActorViewerWindow;
std::shared_ptr<CollisionViewerWindow> mCollisionViewerWindow;
std::shared_ptr<EventLogWindow> mEventLogWindow;
std::shared_ptr<BenMenu> mBenMenu;
std::shared_ptr<BenInputEditorWindow> mBenInputEditorWindow;
std::shared_ptr<AdvancedResolutionSettings::AdvancedResolutionSettingsWindow> mAdvancedResolutionSettingsWindow;

void SetupGuiElements() {
auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui();
Expand Down Expand Up @@ -95,7 +95,10 @@ void SetupGuiElements() {

mEventLogWindow = std::make_shared<EventLogWindow>("gWindows.EventLog", "Event Log", ImVec2(520, 600));
gui->AddGuiWindow(mEventLogWindow);
gui->SetPadBtnTogglesMenu();

mAdvancedResolutionSettingsWindow = std::make_shared<AdvancedResolutionSettings::AdvancedResolutionSettingsWindow>(
"gWindows.gAdvancedResolutionEditor", "Advanced Resolution Settings");
gui->AddGuiWindow(mAdvancedResolutionSettingsWindow);
}

void Destroy() {
Expand All @@ -113,7 +116,6 @@ void Destroy() {
mSaveEditorWindow = nullptr;
mHudEditorWindow = nullptr;
mActorViewerWindow = nullptr;
mItemTrackerWindow = nullptr;
mItemTrackerSettingsWindow = nullptr;
mAdvancedResolutionSettingsWindow = nullptr;
}
} // namespace BenGui
16 changes: 14 additions & 2 deletions mm/2s2h/BenGui/BenMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "2s2h/Enhancements/Cheats/Cheats.h"
#include "2s2h/Enhancements/Player/Player.h"
#include "HudEditor.h"
#include <Enhancements/ResolutionEditor/ResolutionEditor.h>

#include "2s2h/Enhancements/Trackers/ItemTracker.h"
#include "2s2h/Enhancements/Trackers/ItemTrackerSettings.h"
Expand Down Expand Up @@ -157,7 +158,8 @@ void DrawBenMenu() {
}
}

extern std::shared_ptr<BenInputEditorWindow> mBenInputEditorWindow;
extern std::shared_ptr<Ship::GuiWindow> mInputEditorWindow;
extern std::shared_ptr<AdvancedResolutionSettings::AdvancedResolutionSettingsWindow> mAdvancedResolutionSettingsWindow;

void DrawSettingsMenu() {
if (UIWidgets::BeginMenu("Settings")) {
Expand Down Expand Up @@ -201,7 +203,12 @@ void DrawSettingsMenu() {
if (UIWidgets::BeginMenu("Graphics")) {

#ifndef __APPLE__
if (UIWidgets::CVarSliderFloat("Internal Resolution: %f %%", CVAR_INTERNAL_RESOLUTION, 0.5f, 2.0f, 1.0f)) {
const bool disabled_resolutionSlider =
(CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalResolutionToggle", 0) &&
CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".Enabled", 0)) ||
CVarGetInteger("gLowResMode", 0);
if (UIWidgets::CVarSliderFloat("Internal Resolution: %f %%", CVAR_INTERNAL_RESOLUTION, 0.5f, 2.0f, 1.0f,
{ .disabled = disabled_resolutionSlider })) {
Ship::Context::GetInstance()->GetWindow()->SetResolutionMultiplier(
CVarGetFloat(CVAR_INTERNAL_RESOLUTION, 1));
};
Expand Down Expand Up @@ -311,6 +318,11 @@ void DrawSettingsMenu() {
// Currently this only has "Overlays Text Font", it doesn't use our new UIWidgets so it stands out
// Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->DrawSettings();

if (mAdvancedResolutionSettingsWindow) {
UIWidgets::WindowButton("Advanced Resolution", "gWindows.gAdvancedResolutionEditor",
mAdvancedResolutionSettingsWindow); //, { .tooltip = "" });
}

ImGui::EndMenu();
}
// #region 2S2H [Todo] None of this works yet
Expand Down
Loading

0 comments on commit 113d828

Please sign in to comment.