Skip to content

Commit

Permalink
[GUI] Default to not opening the debugger
Browse files Browse the repository at this point in the history
  • Loading branch information
Vali0004 committed Mar 4, 2025
1 parent 7d794f9 commit 39960df
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Xenon/Render/GUI/GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ void Render::GUI::Text(const std::string& label) {
ImGui::TextUnformatted(label.c_str());
}

void Render::GUI::SameLine(float xOffset, float spacing) {
ImGui::SameLine(xOffset, spacing);
}

void Render::GUI::MenuBar(std::function<void()> callback) {
if (ImGui::BeginMenuBar()) {
if (callback) {
Expand Down
1 change: 1 addition & 0 deletions Xenon/Render/GUI/GUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class GUI {
void Window(const std::string& title, std::function<void()> callback = {}, const ImVec2& size = {}, ImGuiWindowFlags flags = 0, bool* conditon = nullptr, const ImVec2& position = {}, ImGuiCond cond = ImGuiCond_Once);
void Child(const std::string& title, std::function<void()> callback = {}, const ImVec2& size = {}, ImGuiChildFlags flags = 0, ImGuiWindowFlags windowFlags = 0);
void Text(const std::string& label);
void SameLine(float xOffset = 0.f, float spacing = -1.f);
void MenuBar(std::function<void()> callback = {});
void MenuItem(const std::string& title, std::function<void()> callback = {}, bool enabled = true, bool selected = false, const std::string& shortcut = {});
void Menu(const std::string& title, std::function<void()> callback = {});
Expand Down
28 changes: 25 additions & 3 deletions Xenon/Render/GUI/Implementations/OpenGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,36 @@ void Render::OpenGLGUI::OnSwap(Texture *texture) {
ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_MenuBar, nullptr, {}, ImGuiCond_Always
);
}
if (!Xe_Main->renderer->imguiRender || (Xe_Main->renderer->imguiRender && !ppcDebuggerAttached)) {
if (ppcDebuggerActive && (!Xe_Main->renderer->imguiRender || (Xe_Main->renderer->imguiRender && !ppcDebuggerAttached))) {
Window("PPC Debugger", [this] {
PPCDebugger(this);
}, { 1200.f, 700.f }, ImGuiWindowFlags_NoCollapse, nullptr, { 500.f, 100.f });
}, { 1200.f, 700.f }, ImGuiWindowFlags_NoCollapse, &ppcDebuggerActive, { 500.f, 100.f });
}
if (!Xe_Main->renderer->imguiRender) {
Window("Debug", [&] {
TabBar("##main", [&] {
TabItem("Debug", [&] {
Button("Start", [&] {
ppcDebuggerActive = true;
});
if (ppcDebuggerActive) {
if (!Xe_Main->getCPU()->IsHalted()) {
Button("Pause", [&] {
Xe_Main->getCPU()->Continue();
});
SameLine();
}
else {
Button("Continue", [&] {
Xe_Main->getCPU()->Continue();
});
}
SameLine();
Button("Step", [&] {
Xe_Main->getCPU()->Step();
});
}
});
TabItem("Settings", [&] {
TabBar("##settings", [&] {
TabItem("General", [&] {
Expand All @@ -231,7 +253,7 @@ void Render::OpenGLGUI::OnSwap(Texture *texture) {
});
});
});
}, { 800.f, 500.f }, ImGuiWindowFlags_NoCollapse, nullptr, { 1750.f, 10.f });
}, { 800.f, 500.f }, ImGuiWindowFlags_NoCollapse, nullptr, { 100.f, 10.f });
}
}

Expand Down

0 comments on commit 39960df

Please sign in to comment.