Update Dev Tools Windows (#5220)

* Update dev tools windows

* Review comments
This commit is contained in:
aMannus 2025-03-26 22:26:11 +01:00 committed by GitHub
parent 47c653a0e5
commit 057434cdf3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 52 additions and 12 deletions

View file

@ -1,4 +1,4 @@
#include "sohConsole.h"
#include "SohConsoleWindow.h"
#include "soh/OTRGlobals.h"
#include "soh/SohGui/UIWidgets.hpp"
#include "soh/SohGui/SohGui.hpp"

View file

@ -1,4 +1,4 @@
#include "sohGfxDebugger.h"
#include "SohGfxDebuggerWindow.h"
#include "soh/OTRGlobals.h"
void SohGfxDebuggerWindow::InitElement() {

View file

@ -0,0 +1,24 @@
#include "SohStatsWindow.h"
#include "soh/OTRGlobals.h"
void SohStatsWindow::DrawElement() {
const float framerate = ImGui::GetIO().Framerate;
const float deltatime = ImGui::GetIO().DeltaTime;
ImGui::PushFont(OTRGlobals::Instance->fontMonoLarger);
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0));
#if defined(_WIN32)
ImGui::Text("Platform: Windows");
#elif defined(__IOS__)
ImGui::Text("Platform: iOS");
#elif defined(__APPLE__)
ImGui::Text("Platform: macOS");
#elif defined(__linux__)
ImGui::Text("Platform: Linux");
#else
ImGui::Text("Platform: Unknown");
#endif
ImGui::Text("Status: %.3f ms/frame (%.1f FPS)", deltatime * 1000.0f, framerate);
ImGui::PopStyleColor();
ImGui::PopFont();
}

View file

@ -0,0 +1,17 @@
#ifndef SOH_STATS_H
#define SOH_STATS_H
#include <libultraship/libultraship.h>
class SohStatsWindow : public Ship::GuiWindow {
public:
using GuiWindow::GuiWindow;
~SohStatsWindow() {};
protected:
void InitElement() override {};
void DrawElement() override;
void UpdateElement() override {};
};
#endif // SOH_STATS_H

View file

@ -68,7 +68,7 @@ namespace SohGui {
std::shared_ptr<SohMenuBar> mSohMenuBar;
std::shared_ptr<Ship::GuiWindow> mConsoleWindow;
std::shared_ptr<Ship::GuiWindow> mStatsWindow;
std::shared_ptr<SohStatsWindow> mStatsWindow;
std::shared_ptr<Ship::GuiWindow> mGfxDebuggerWindow;
std::shared_ptr<Ship::GuiWindow> mInputEditorWindow;
@ -120,17 +120,15 @@ namespace SohGui {
mSohMenu = std::make_shared<SohMenu>(CVAR_WINDOW("Menu"), "Port Menu");
gui->SetMenu(mSohMenu);
mStatsWindow = gui->GetGuiWindow("Stats");
if (mStatsWindow == nullptr) {
SPDLOG_ERROR("Could not find stats window");
}
mConsoleWindow = std::make_shared<SohConsoleWindow>(CVAR_WINDOW("SohConsole"), "Console##SoH", ImVec2(820, 630));
gui->AddGuiWindow(mConsoleWindow);
mGfxDebuggerWindow = std::make_shared<SohGfxDebuggerWindow>(CVAR_WINDOW("SohGfxDebugger"), "GfxDebugger##SoH", ImVec2(820, 630));
gui->AddGuiWindow(mGfxDebuggerWindow);
mStatsWindow = std::make_shared<SohStatsWindow>(CVAR_WINDOW("SohStats"), "Stats##Soh", ImVec2(400, 100));
gui->AddGuiWindow(mStatsWindow);
mInputEditorWindow = gui->GetGuiWindow("Controller Configuration");
if (mInputEditorWindow == nullptr) {
SPDLOG_ERROR("Could not find input editor window");

View file

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

View file

@ -90,8 +90,8 @@ void SohMenu::AddMenuDevTools() {
path.sidebarName = "Stats";
AddSidebarEntry("Dev Tools", path.sidebarName, 1);
AddWidget(path, "Popout Stats Window", WIDGET_WINDOW_BUTTON)
.CVar(CVAR_WINDOW("Stats"))
.WindowName("Stats")
.CVar(CVAR_WINDOW("SohStats"))
.WindowName("Stats##Soh")
.Options(WindowButtonOptions().Tooltip("Enables the separate Stats Window."));
// Console