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

Port "Advanced Resolution" editor window from Shipwright #595

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 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
7 changes: 7 additions & 0 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,6 +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<AdvancedResolutionSettings::AdvancedResolutionSettingsWindow> mAdvancedResolutionSettingsWindow;

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

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

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

void Destroy() {
Expand All @@ -105,5 +111,6 @@ void Destroy() {
mSaveEditorWindow = nullptr;
mHudEditorWindow = nullptr;
mActorViewerWindow = nullptr;
mAdvancedResolutionSettingsWindow = nullptr;
}
} // namespace BenGui
8 changes: 8 additions & 0 deletions mm/2s2h/BenGui/BenMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "2s2h/DeveloperTools/DeveloperTools.h"
#include "2s2h/DeveloperTools/WarpPoint.h"
#include "HudEditor.h"
#include <Enhancements/ResolutionEditor/ResolutionEditor.h>

extern bool ShouldClearTextureCacheAtEndOfFrame;

Expand Down Expand Up @@ -129,6 +130,7 @@ void DrawBenMenu() {
}

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

void DrawSettingsMenu() {
if (UIWidgets::BeginMenu("Settings")) {
Expand Down Expand Up @@ -172,6 +174,7 @@ void DrawSettingsMenu() {
if (UIWidgets::BeginMenu("Graphics")) {

#ifndef __APPLE__
// TODO: Will need to disable this slider when "Advanced Resolution" mode is active.
sheepytina marked this conversation as resolved.
Show resolved Hide resolved
if (UIWidgets::CVarSliderFloat("Internal Resolution: %f %%", CVAR_INTERNAL_RESOLUTION, 0.5f, 2.0f, 1.0f)) {
Ship::Context::GetInstance()->GetWindow()->SetResolutionMultiplier(
CVarGetFloat(CVAR_INTERNAL_RESOLUTION, 1));
Expand Down Expand Up @@ -289,6 +292,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