Skip to content

Commit 057434c

Browse files
authored
Update Dev Tools Windows (#5220)
* Update dev tools windows * Review comments
1 parent 47c653a commit 057434c

9 files changed

Lines changed: 52 additions & 12 deletions

File tree

soh/soh/Enhancements/debugger/sohConsole.cpp renamed to soh/soh/Enhancements/debugger/SohConsoleWindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "sohConsole.h"
1+
#include "SohConsoleWindow.h"
22
#include "soh/OTRGlobals.h"
33
#include "soh/SohGui/UIWidgets.hpp"
44
#include "soh/SohGui/SohGui.hpp"
File renamed without changes.

soh/soh/Enhancements/debugger/sohGfxDebugger.cpp renamed to soh/soh/Enhancements/debugger/SohGfxDebuggerWindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "sohGfxDebugger.h"
1+
#include "SohGfxDebuggerWindow.h"
22
#include "soh/OTRGlobals.h"
33

44
void SohGfxDebuggerWindow::InitElement() {
File renamed without changes.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include "SohStatsWindow.h"
2+
#include "soh/OTRGlobals.h"
3+
4+
void SohStatsWindow::DrawElement() {
5+
const float framerate = ImGui::GetIO().Framerate;
6+
const float deltatime = ImGui::GetIO().DeltaTime;
7+
ImGui::PushFont(OTRGlobals::Instance->fontMonoLarger);
8+
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0));
9+
10+
#if defined(_WIN32)
11+
ImGui::Text("Platform: Windows");
12+
#elif defined(__IOS__)
13+
ImGui::Text("Platform: iOS");
14+
#elif defined(__APPLE__)
15+
ImGui::Text("Platform: macOS");
16+
#elif defined(__linux__)
17+
ImGui::Text("Platform: Linux");
18+
#else
19+
ImGui::Text("Platform: Unknown");
20+
#endif
21+
ImGui::Text("Status: %.3f ms/frame (%.1f FPS)", deltatime * 1000.0f, framerate);
22+
ImGui::PopStyleColor();
23+
ImGui::PopFont();
24+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#ifndef SOH_STATS_H
2+
#define SOH_STATS_H
3+
4+
#include <libultraship/libultraship.h>
5+
6+
class SohStatsWindow : public Ship::GuiWindow {
7+
public:
8+
using GuiWindow::GuiWindow;
9+
~SohStatsWindow() {};
10+
11+
protected:
12+
void InitElement() override {};
13+
void DrawElement() override;
14+
void UpdateElement() override {};
15+
};
16+
17+
#endif // SOH_STATS_H

soh/soh/SohGui/SohGui.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ namespace SohGui {
6868
std::shared_ptr<SohMenuBar> mSohMenuBar;
6969

7070
std::shared_ptr<Ship::GuiWindow> mConsoleWindow;
71-
std::shared_ptr<Ship::GuiWindow> mStatsWindow;
71+
std::shared_ptr<SohStatsWindow> mStatsWindow;
7272
std::shared_ptr<Ship::GuiWindow> mGfxDebuggerWindow;
7373
std::shared_ptr<Ship::GuiWindow> mInputEditorWindow;
7474

@@ -120,17 +120,15 @@ namespace SohGui {
120120
mSohMenu = std::make_shared<SohMenu>(CVAR_WINDOW("Menu"), "Port Menu");
121121
gui->SetMenu(mSohMenu);
122122

123-
mStatsWindow = gui->GetGuiWindow("Stats");
124-
if (mStatsWindow == nullptr) {
125-
SPDLOG_ERROR("Could not find stats window");
126-
}
127-
128123
mConsoleWindow = std::make_shared<SohConsoleWindow>(CVAR_WINDOW("SohConsole"), "Console##SoH", ImVec2(820, 630));
129124
gui->AddGuiWindow(mConsoleWindow);
130125

131126
mGfxDebuggerWindow = std::make_shared<SohGfxDebuggerWindow>(CVAR_WINDOW("SohGfxDebugger"), "GfxDebugger##SoH", ImVec2(820, 630));
132127
gui->AddGuiWindow(mGfxDebuggerWindow);
133128

129+
mStatsWindow = std::make_shared<SohStatsWindow>(CVAR_WINDOW("SohStats"), "Stats##Soh", ImVec2(400, 100));
130+
gui->AddGuiWindow(mStatsWindow);
131+
134132
mInputEditorWindow = gui->GetGuiWindow("Controller Configuration");
135133
if (mInputEditorWindow == nullptr) {
136134
SPDLOG_ERROR("Could not find input editor window");

soh/soh/SohGui/SohGui.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
#include "soh/Enhancements/debugger/debugSaveEditor.h"
1919
#include "soh/Enhancements/debugger/hookDebugger.h"
2020
#include "soh/Enhancements/debugger/dlViewer.h"
21-
#include "soh/Enhancements/debugger/sohConsole.h"
22-
#include "soh/Enhancements/debugger/sohGfxDebugger.h"
21+
#include "soh/Enhancements/debugger/SohConsoleWindow.h"
22+
#include "soh/Enhancements/debugger/SohGfxDebuggerWindow.h"
23+
#include "soh/Enhancements/debugger/SohStatsWindow.h"
2324
#include "soh/Enhancements/debugger/valueViewer.h"
2425
#include "soh/Enhancements/gameplaystatswindow.h"
2526
#include "soh/Enhancements/randomizer/randomizer_check_tracker.h"

soh/soh/SohGui/SohMenuDevTools.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ void SohMenu::AddMenuDevTools() {
9090
path.sidebarName = "Stats";
9191
AddSidebarEntry("Dev Tools", path.sidebarName, 1);
9292
AddWidget(path, "Popout Stats Window", WIDGET_WINDOW_BUTTON)
93-
.CVar(CVAR_WINDOW("Stats"))
94-
.WindowName("Stats")
93+
.CVar(CVAR_WINDOW("SohStats"))
94+
.WindowName("Stats##Soh")
9595
.Options(WindowButtonOptions().Tooltip("Enables the separate Stats Window."));
9696

9797
// Console

0 commit comments

Comments
 (0)