Mono dev tools (#5175)

* apply mono font to some dev tool windows

* soh gui wrappers for gfxdebugger and console to set mono font

* it can be just a little larger
This commit is contained in:
Archez 2025-03-21 07:21:33 -04:00 committed by GitHub
parent 985bf91945
commit 57bc5690e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 109 additions and 10 deletions

View file

@ -1555,6 +1555,8 @@ void ResetBaseOptions() {
void SaveEditorWindow::DrawElement() { void SaveEditorWindow::DrawElement() {
PushStyleTabs(THEME_COLOR); PushStyleTabs(THEME_COLOR);
ImGui::PushFont(OTRGlobals::Instance->fontMonoLarger);
if (ImGui::BeginTabBar("SaveContextTabBar", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { if (ImGui::BeginTabBar("SaveContextTabBar", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) {
ResetBaseOptions(); ResetBaseOptions();
if (ImGui::BeginTabItem("Info")) { if (ImGui::BeginTabItem("Info")) {
@ -1594,6 +1596,8 @@ void SaveEditorWindow::DrawElement() {
ImGui::EndTabBar(); ImGui::EndTabBar();
} }
ImGui::PopFont();
PopStyleTabs(); PopStyleTabs();
} }

View file

@ -93,6 +93,8 @@ void PerformDisplayListSearch() {
void DLViewerWindow::DrawElement() { void DLViewerWindow::DrawElement() {
// Debounce the search field as listing otr files is expensive // Debounce the search field as listing otr files is expensive
UIWidgets::PushStyleInput(THEME_COLOR); UIWidgets::PushStyleInput(THEME_COLOR);
ImGui::PushFont(OTRGlobals::Instance->fontMonoLarger);
if (ImGui::InputText("Search Display Lists", searchString, ARRAY_COUNT(searchString))) { if (ImGui::InputText("Search Display Lists", searchString, ARRAY_COUNT(searchString))) {
doSearch = true; doSearch = true;
searchDebounceFrames = 30; searchDebounceFrames = 30;
@ -121,6 +123,7 @@ void DLViewerWindow::DrawElement() {
UIWidgets::PopStyleCombobox(); UIWidgets::PopStyleCombobox();
if (activeDisplayList == "") { if (activeDisplayList == "") {
ImGui::PopFont();
return; return;
} }
@ -326,8 +329,11 @@ void DLViewerWindow::DrawElement() {
} }
} catch (const std::exception& e) { } catch (const std::exception& e) {
ImGui::Text("Error displaying DL instructions."); ImGui::Text("Error displaying DL instructions.");
ImGui::PopFont();
return; return;
} }
ImGui::PopFont();
} }
void DLViewerWindow::InitElement() { void DLViewerWindow::InitElement() {

View file

@ -1,6 +1,7 @@
#include "hookDebugger.h" #include "hookDebugger.h"
#include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "soh/SohGui/UIWidgets.hpp" #include "soh/SohGui/UIWidgets.hpp"
#include "soh/OTRGlobals.h"
#include <string> #include <string>
#include <version> #include <version>
@ -82,12 +83,16 @@ void HookDebuggerWindow::DrawElement() {
"(\"__cpp_lib_source_location\" not defined in \"<version>\")."); "(\"__cpp_lib_source_location\" not defined in \"<version>\").");
#endif #endif
ImGui::PushFont(OTRGlobals::Instance->fontMonoLarger);
for (auto& [hookName, _] : hookData) { for (auto& [hookName, _] : hookData) {
if (ImGui::TreeNode(hookName)) { if (ImGui::TreeNode(hookName)) {
DrawHookRegisteringInfos(hookName); DrawHookRegisteringInfos(hookName);
ImGui::TreePop(); ImGui::TreePop();
} }
} }
ImGui::PopFont();
} }
void HookDebuggerWindow::InitElement() { void HookDebuggerWindow::InitElement() {

View file

@ -0,0 +1,30 @@
#include "sohConsole.h"
#include "soh/OTRGlobals.h"
#include "soh/SohGui/UIWidgets.hpp"
#include "soh/SohGui/SohGui.hpp"
void SohConsoleWindow::InitElement() {
ConsoleWindow::InitElement();
}
void SohConsoleWindow::UpdateElement() {
ConsoleWindow::UpdateElement();
}
void SohConsoleWindow::DrawElement() {
UIWidgets::PushStyleInput(THEME_COLOR);
// Small font (13) to match hardcoded width values in the LUS window.. set large font after below TODO addressed
ImGui::PushFont(OTRGlobals::Instance->fontMonoSmall);
// TODO: This can be removed after the LUS console window is designed better without hardcoding widths
ImGui::BeginChild("##Console Wrapper", ImVec2(0, 0), ImGuiChildFlags_None,
ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar |
ImGuiWindowFlags_NoScrollWithMouse);
ConsoleWindow::DrawElement();
ImGui::EndChild();
ImGui::PopFont();
UIWidgets::PopStyleInput();
}

View file

@ -0,0 +1,17 @@
#ifndef SOH_CONSOLE_H
#define SOH_CONSOLE_H
#include "window/gui/GuiWindow.h"
#include "window/gui/ConsoleWindow.h"
class SohConsoleWindow : public Ship::ConsoleWindow {
public:
using ConsoleWindow::ConsoleWindow;
protected:
void InitElement() override;
void UpdateElement() override;
void DrawElement() override;
};
#endif // SOH_CONSOLE_H

View file

@ -0,0 +1,16 @@
#include "sohGfxDebugger.h"
#include "soh/OTRGlobals.h"
void SohGfxDebuggerWindow::InitElement() {
GfxDebuggerWindow::InitElement();
}
void SohGfxDebuggerWindow::UpdateElement() {
GfxDebuggerWindow::UpdateElement();
}
void SohGfxDebuggerWindow::DrawElement() {
ImGui::PushFont(OTRGlobals::Instance->fontMonoLarger);
GfxDebuggerWindow::DrawElement();
ImGui::PopFont();
}

View file

@ -0,0 +1,17 @@
#ifndef SOH_GFX_DEBUGGER_H
#define SOH_GFX_DEBUGGER_H
#include "window/gui/GuiWindow.h"
#include "window/gui/GfxDebuggerWindow.h"
class SohGfxDebuggerWindow : public LUS::GfxDebuggerWindow {
public:
using GfxDebuggerWindow::GfxDebuggerWindow;
protected:
void InitElement() override;
void UpdateElement() override;
void DrawElement() override;
};
#endif // SOH_GFX_DEBUGGER_H

View file

@ -635,9 +635,11 @@ void DrawGameplayStatsOptionsTab() {
} }
void GameplayStatsWindow::DrawElement() { void GameplayStatsWindow::DrawElement() {
ImGui::PushFont(OTRGlobals::Instance->fontMonoLarger);
DrawGameplayStatsHeader(); DrawGameplayStatsHeader();
UIWidgets::PushStyleTabs(THEME_COLOR); UIWidgets::PushStyleTabs(THEME_COLOR);
if (ImGui::BeginTabBar("Stats", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { if (ImGui::BeginTabBar("Stats", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) {
if (ImGui::BeginTabItem("Timestamps")) { if (ImGui::BeginTabItem("Timestamps")) {
DrawGameplayStatsTimestampsTab(); DrawGameplayStatsTimestampsTab();
@ -657,7 +659,9 @@ void GameplayStatsWindow::DrawElement() {
} }
ImGui::EndTabBar(); ImGui::EndTabBar();
} }
UIWidgets::PopStyleTabs(); UIWidgets::PopStyleTabs();
ImGui::PopFont();
ImGui::Text("Note: Gameplay stats are saved to the current file and will be\nlost if you quit without saving."); ImGui::Text("Note: Gameplay stats are saved to the current file and will be\nlost if you quit without saving.");
} }

View file

@ -401,6 +401,7 @@ OTRGlobals::OTRGlobals() {
previousImGuiScale = defaultImGuiScale; previousImGuiScale = defaultImGuiScale;
fontMonoSmall = CreateFontWithSize(14.0f, "fonts/Inconsolata-Regular.ttf");
fontMono = CreateFontWithSize(16.0f, "fonts/Inconsolata-Regular.ttf"); fontMono = CreateFontWithSize(16.0f, "fonts/Inconsolata-Regular.ttf");
fontMonoLarger = CreateFontWithSize(20.0f, "fonts/Inconsolata-Regular.ttf"); fontMonoLarger = CreateFontWithSize(20.0f, "fonts/Inconsolata-Regular.ttf");
fontMonoLargest = CreateFontWithSize(24.0f, "fonts/Inconsolata-Regular.ttf"); fontMonoLargest = CreateFontWithSize(24.0f, "fonts/Inconsolata-Regular.ttf");

View file

@ -54,6 +54,7 @@ class OTRGlobals {
ImFont* defaultFontLarger; ImFont* defaultFontLarger;
ImFont* defaultFontLargest; ImFont* defaultFontLargest;
ImFont* fontMonoSmall;
ImFont* fontStandard; ImFont* fontStandard;
ImFont* fontStandardLarger; ImFont* fontStandardLarger;
ImFont* fontStandardLargest; ImFont* fontStandardLargest;

View file

@ -124,15 +124,11 @@ namespace SohGui {
SPDLOG_ERROR("Could not find stats window"); SPDLOG_ERROR("Could not find stats window");
} }
mConsoleWindow = gui->GetGuiWindow("Console"); mConsoleWindow = std::make_shared<SohConsoleWindow>(CVAR_WINDOW("Console"), "Console##SoH", ImVec2(820, 630));
if (mConsoleWindow == nullptr) { gui->AddGuiWindow(mConsoleWindow);
SPDLOG_ERROR("Could not find console window");
}
mGfxDebuggerWindow = gui->GetGuiWindow("Gfx Debugger"); mGfxDebuggerWindow = std::make_shared<SohGfxDebuggerWindow>(CVAR_WINDOW("GfxDebugger"), "GfxDebugger##SoH", ImVec2(820, 630));
if (mGfxDebuggerWindow == nullptr) { gui->AddGuiWindow(mGfxDebuggerWindow);
SPDLOG_ERROR("Could not find Gfx Debugger window");
}
mInputEditorWindow = gui->GetGuiWindow("Controller Configuration"); mInputEditorWindow = gui->GetGuiWindow("Controller Configuration");
if (mInputEditorWindow == nullptr) { if (mInputEditorWindow == nullptr) {

View file

@ -18,6 +18,8 @@
#include "soh/Enhancements/debugger/debugSaveEditor.h" #include "soh/Enhancements/debugger/debugSaveEditor.h"
#include "soh/Enhancements/debugger/hookDebugger.h" #include "soh/Enhancements/debugger/hookDebugger.h"
#include "soh/Enhancements/debugger/dlViewer.h" #include "soh/Enhancements/debugger/dlViewer.h"
#include "soh/Enhancements/debugger/sohConsole.h"
#include "soh/Enhancements/debugger/sohGfxDebugger.h"
#include "soh/Enhancements/debugger/valueViewer.h" #include "soh/Enhancements/debugger/valueViewer.h"
#include "soh/Enhancements/gameplaystatswindow.h" #include "soh/Enhancements/gameplaystatswindow.h"
#include "soh/Enhancements/randomizer/randomizer_check_tracker.h" #include "soh/Enhancements/randomizer/randomizer_check_tracker.h"

View file

@ -99,7 +99,7 @@ void SohMenu::AddMenuDevTools() {
AddSidebarEntry("Dev Tools", path.sidebarName, 1); AddSidebarEntry("Dev Tools", path.sidebarName, 1);
AddWidget(path, "Popout Console", WIDGET_WINDOW_BUTTON) AddWidget(path, "Popout Console", WIDGET_WINDOW_BUTTON)
.CVar(CVAR_WINDOW("Console")) .CVar(CVAR_WINDOW("Console"))
.WindowName("Console") .WindowName("Console##SoH")
.Options(WindowButtonOptions().Tooltip("Enables the separate Console Window.")); .Options(WindowButtonOptions().Tooltip("Enables the separate Console Window."));
// Save Editor // Save Editor
@ -163,7 +163,7 @@ void SohMenu::AddMenuDevTools() {
AddSidebarEntry("Dev Tools", path.sidebarName, 1); AddSidebarEntry("Dev Tools", path.sidebarName, 1);
AddWidget(path, "Popout Gfx Debugger", WIDGET_WINDOW_BUTTON) AddWidget(path, "Popout Gfx Debugger", WIDGET_WINDOW_BUTTON)
.CVar(CVAR_WINDOW("GfxDebugger")) .CVar(CVAR_WINDOW("GfxDebugger"))
.WindowName("GfxDebuggerWindow") .WindowName("GfxDebugger##SoH")
.Options(WindowButtonOptions().Tooltip("Enables the separate Gfx Debugger Window.")); .Options(WindowButtonOptions().Tooltip("Enables the separate Gfx Debugger Window."));
} }