diff --git a/soh/soh/Enhancements/debugger/sohConsole.cpp b/soh/soh/Enhancements/debugger/SohConsoleWindow.cpp similarity index 97% rename from soh/soh/Enhancements/debugger/sohConsole.cpp rename to soh/soh/Enhancements/debugger/SohConsoleWindow.cpp index 686152a1f..d5090e7e5 100644 --- a/soh/soh/Enhancements/debugger/sohConsole.cpp +++ b/soh/soh/Enhancements/debugger/SohConsoleWindow.cpp @@ -1,4 +1,4 @@ -#include "sohConsole.h" +#include "SohConsoleWindow.h" #include "soh/OTRGlobals.h" #include "soh/SohGui/UIWidgets.hpp" #include "soh/SohGui/SohGui.hpp" diff --git a/soh/soh/Enhancements/debugger/sohConsole.h b/soh/soh/Enhancements/debugger/SohConsoleWindow.h similarity index 100% rename from soh/soh/Enhancements/debugger/sohConsole.h rename to soh/soh/Enhancements/debugger/SohConsoleWindow.h diff --git a/soh/soh/Enhancements/debugger/sohGfxDebugger.cpp b/soh/soh/Enhancements/debugger/SohGfxDebuggerWindow.cpp similarity index 91% rename from soh/soh/Enhancements/debugger/sohGfxDebugger.cpp rename to soh/soh/Enhancements/debugger/SohGfxDebuggerWindow.cpp index 20b37ca93..06d81577d 100644 --- a/soh/soh/Enhancements/debugger/sohGfxDebugger.cpp +++ b/soh/soh/Enhancements/debugger/SohGfxDebuggerWindow.cpp @@ -1,4 +1,4 @@ -#include "sohGfxDebugger.h" +#include "SohGfxDebuggerWindow.h" #include "soh/OTRGlobals.h" void SohGfxDebuggerWindow::InitElement() { diff --git a/soh/soh/Enhancements/debugger/sohGfxDebugger.h b/soh/soh/Enhancements/debugger/SohGfxDebuggerWindow.h similarity index 100% rename from soh/soh/Enhancements/debugger/sohGfxDebugger.h rename to soh/soh/Enhancements/debugger/SohGfxDebuggerWindow.h diff --git a/soh/soh/Enhancements/debugger/SohStatsWindow.cpp b/soh/soh/Enhancements/debugger/SohStatsWindow.cpp new file mode 100644 index 000000000..56f81bee4 --- /dev/null +++ b/soh/soh/Enhancements/debugger/SohStatsWindow.cpp @@ -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(); +} diff --git a/soh/soh/Enhancements/debugger/SohStatsWindow.h b/soh/soh/Enhancements/debugger/SohStatsWindow.h new file mode 100644 index 000000000..d68953573 --- /dev/null +++ b/soh/soh/Enhancements/debugger/SohStatsWindow.h @@ -0,0 +1,17 @@ +#ifndef SOH_STATS_H +#define SOH_STATS_H + +#include + +class SohStatsWindow : public Ship::GuiWindow { + public: + using GuiWindow::GuiWindow; + ~SohStatsWindow() {}; + + protected: + void InitElement() override {}; + void DrawElement() override; + void UpdateElement() override {}; +}; + +#endif // SOH_STATS_H diff --git a/soh/soh/SohGui/SohGui.cpp b/soh/soh/SohGui/SohGui.cpp index 213efcfd4..87be00c98 100644 --- a/soh/soh/SohGui/SohGui.cpp +++ b/soh/soh/SohGui/SohGui.cpp @@ -68,7 +68,7 @@ namespace SohGui { std::shared_ptr mSohMenuBar; std::shared_ptr mConsoleWindow; - std::shared_ptr mStatsWindow; + std::shared_ptr mStatsWindow; std::shared_ptr mGfxDebuggerWindow; std::shared_ptr mInputEditorWindow; @@ -120,17 +120,15 @@ namespace SohGui { mSohMenu = std::make_shared(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(CVAR_WINDOW("SohConsole"), "Console##SoH", ImVec2(820, 630)); gui->AddGuiWindow(mConsoleWindow); mGfxDebuggerWindow = std::make_shared(CVAR_WINDOW("SohGfxDebugger"), "GfxDebugger##SoH", ImVec2(820, 630)); gui->AddGuiWindow(mGfxDebuggerWindow); + mStatsWindow = std::make_shared(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"); diff --git a/soh/soh/SohGui/SohGui.hpp b/soh/soh/SohGui/SohGui.hpp index 35c93b353..b1d278e06 100644 --- a/soh/soh/SohGui/SohGui.hpp +++ b/soh/soh/SohGui/SohGui.hpp @@ -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" diff --git a/soh/soh/SohGui/SohMenuDevTools.cpp b/soh/soh/SohGui/SohMenuDevTools.cpp index e6a757f21..3a769aea4 100644 --- a/soh/soh/SohGui/SohMenuDevTools.cpp +++ b/soh/soh/SohGui/SohMenuDevTools.cpp @@ -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