Imgui stuff

This commit is contained in:
Margen67 2025-08-01 06:05:55 -07:00
parent 833f938a64
commit 10f2b5ebfc
6 changed files with 1930 additions and 14 deletions

View file

@ -27,6 +27,11 @@ includedirs({
}) })
defines({ defines({
"IMGUI_DISABLE_OBSOLETE_FUNCTIONS",
"IMGUI_DISABLE_DEFAULT_FONT",
--"IMGUI_USE_WCHAR32",
"IMGUI_USE_STB_SPRINTF",
--"IMGUI_ENABLE_FREETYPE",
"USE_CPP17", -- Tabulate "USE_CPP17", -- Tabulate
}) })

View file

@ -379,7 +379,7 @@ void DebugWindow::DrawSourcePane() {
ImGui::EndGroup(); ImGui::EndGroup();
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::PushButtonRepeat(true); ImGui::PushItemFlag(ImGuiItemFlags_ButtonRepeat, true);
bool can_step = !cache_.is_running && state_.thread_info; bool can_step = !cache_.is_running && state_.thread_info;
if (ImGui::ButtonEx("Step PPC", ImVec2(0, 0), if (ImGui::ButtonEx("Step PPC", ImVec2(0, 0),
can_step ? 0 : ImGuiItemFlags_Disabled)) { can_step ? 0 : ImGuiItemFlags_Disabled)) {
@ -388,7 +388,7 @@ void DebugWindow::DrawSourcePane() {
processor_->StepGuestInstruction(state_.thread_info->thread_id); processor_->StepGuestInstruction(state_.thread_info->thread_id);
} }
} }
ImGui::PopButtonRepeat(); ImGui::PopItemFlag();
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip( ImGui::SetTooltip(
"Step one PPC instruction on the current thread (hold for many)."); "Step one PPC instruction on the current thread (hold for many).");
@ -398,7 +398,7 @@ void DebugWindow::DrawSourcePane() {
// Only show x64 step button if we have x64 visible. // Only show x64 step button if we have x64 visible.
ImGui::Dummy(ImVec2(4, 0)); ImGui::Dummy(ImVec2(4, 0));
ImGui::SameLine(); ImGui::SameLine();
ImGui::PushButtonRepeat(true); ImGui::PushItemFlag(ImGuiItemFlags_ButtonRepeat, true);
if (ImGui::ButtonEx("Step x64", ImVec2(0, 0), if (ImGui::ButtonEx("Step x64", ImVec2(0, 0),
can_step ? 0 : ImGuiItemFlags_Disabled)) { can_step ? 0 : ImGuiItemFlags_Disabled)) {
// By enabling the button when stepping we allow repeat behavior. // By enabling the button when stepping we allow repeat behavior.
@ -406,7 +406,7 @@ void DebugWindow::DrawSourcePane() {
processor_->StepHostInstruction(state_.thread_info->thread_id); processor_->StepHostInstruction(state_.thread_info->thread_id);
} }
} }
ImGui::PopButtonRepeat(); ImGui::PopItemFlag();
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip( ImGui::SetTooltip(
"Step one x64 instruction on the current thread (hold for many)."); "Step one x64 instruction on the current thread (hold for many).");

View file

@ -234,13 +234,13 @@ void TraceViewer::DrawControllerUI() {
ImGui::SetTooltip("Reset to first frame"); ImGui::SetTooltip("Reset to first frame");
} }
ImGui::SameLine(); ImGui::SameLine();
ImGui::PushButtonRepeat(true); ImGui::PushItemFlag(ImGuiItemFlags_ButtonRepeat, true);
if (ImGui::Button(">>", ImVec2(0, 0))) { if (ImGui::Button(">>", ImVec2(0, 0))) {
if (target_frame + 1 < player_->frame_count()) { if (target_frame + 1 < player_->frame_count()) {
++target_frame; ++target_frame;
} }
} }
ImGui::PopButtonRepeat(); ImGui::PopItemFlag();
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Next frame (hold for continuous)"); ImGui::SetTooltip("Next frame (hold for continuous)");
} }
@ -433,7 +433,8 @@ void TraceViewer::DrawPacketDisassemblerUI() {
int TraceViewer::RecursiveDrawCommandBufferUI( int TraceViewer::RecursiveDrawCommandBufferUI(
const TraceReader::Frame* frame, TraceReader::CommandBuffer* buffer) { const TraceReader::Frame* frame, TraceReader::CommandBuffer* buffer) {
int selected_id = -1; int selected_id = -1;
int column_width = int(ImGui::GetContentRegionMax().x); int column_width =
int(ImGui::GetContentRegionAvail().x); // TODO: This might be broken
for (size_t i = 0; i < buffer->commands.size(); i++) { for (size_t i = 0; i < buffer->commands.size(); i++) {
switch (buffer->commands[i].type) { switch (buffer->commands[i].type) {
@ -512,7 +513,8 @@ void TraceViewer::DrawCommandListUI() {
} }
int command_count = int(frame->commands.size()); int command_count = int(frame->commands.size());
int target_command = player_->current_command_index(); int target_command = player_->current_command_index();
int column_width = int(ImGui::GetContentRegionMax().x); int column_width =
int(ImGui::GetContentRegionAvail().x); // TODO: This might be broken
ImGui::Text("Frame #%d", player_->current_frame_index()); ImGui::Text("Frame #%d", player_->current_frame_index());
ImGui::Separator(); ImGui::Separator();
if (ImGui::Button("reset")) { if (ImGui::Button("reset")) {
@ -522,7 +524,7 @@ void TraceViewer::DrawCommandListUI() {
ImGui::SetTooltip("Reset to before any frame commands"); ImGui::SetTooltip("Reset to before any frame commands");
} }
ImGui::SameLine(); ImGui::SameLine();
ImGui::PushButtonRepeat(true); ImGui::PushItemFlag(ImGuiItemFlags_ButtonRepeat, true);
if (ImGui::Button("prev", ImVec2(0, 0))) { if (ImGui::Button("prev", ImVec2(0, 0))) {
if (target_command >= 0) { if (target_command >= 0) {
--target_command; --target_command;
@ -540,7 +542,7 @@ void TraceViewer::DrawCommandListUI() {
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Move to the next command (hold)"); ImGui::SetTooltip("Move to the next command (hold)");
} }
ImGui::PopButtonRepeat(); ImGui::PopItemFlag();
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("end")) { if (ImGui::Button("end")) {
target_command = command_count - 1; target_command = command_count - 1;

View file

@ -188,9 +188,9 @@ void ImGuiDrawer::Initialize() {
style.Colors[ImGuiCol_ResizeGripActive] = ImVec4(1.00f, 1.00f, 1.00f, 0.90f); style.Colors[ImGuiCol_ResizeGripActive] = ImVec4(1.00f, 1.00f, 1.00f, 0.90f);
style.Colors[ImGuiCol_Tab] = style.Colors[ImGuiCol_Button]; style.Colors[ImGuiCol_Tab] = style.Colors[ImGuiCol_Button];
style.Colors[ImGuiCol_TabHovered] = style.Colors[ImGuiCol_ButtonHovered]; style.Colors[ImGuiCol_TabHovered] = style.Colors[ImGuiCol_ButtonHovered];
style.Colors[ImGuiCol_TabActive] = style.Colors[ImGuiCol_ButtonActive]; style.Colors[ImGuiCol_TabSelected] = style.Colors[ImGuiCol_ButtonActive];
style.Colors[ImGuiCol_TabUnfocused] = style.Colors[ImGuiCol_FrameBg]; style.Colors[ImGuiCol_TabDimmed] = style.Colors[ImGuiCol_FrameBg];
style.Colors[ImGuiCol_TabUnfocusedActive] = style.Colors[ImGuiCol_TabDimmedSelected] =
style.Colors[ImGuiCol_FrameBgHovered]; style.Colors[ImGuiCol_FrameBgHovered];
style.Colors[ImGuiCol_PlotLines] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f); style.Colors[ImGuiCol_PlotLines] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
style.Colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f); style.Colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
@ -739,7 +739,6 @@ void ImGuiDrawer::ClearInput() {
io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX); io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
std::memset(io.MouseDown, 0, sizeof(io.MouseDown)); std::memset(io.MouseDown, 0, sizeof(io.MouseDown));
io.ClearInputKeys(); io.ClearInputKeys();
io.ClearInputCharacters();
touch_pointer_id_ = TouchEvent::kPointerIDNone; touch_pointer_id_ = TouchEvent::kPointerIDNone;
reset_mouse_position_after_next_frame_ = false; reset_mouse_position_after_next_frame_ = false;
} }

View file

@ -5,6 +5,9 @@ project("imgui")
language("C++") language("C++")
includedirs({ includedirs({
"imgui", "imgui",
--"imgui/misc/freetype",
--"freetype/include",
"stb",
}) })
files({ files({
"imgui/imgui.cpp", "imgui/imgui.cpp",
@ -12,4 +15,5 @@ project("imgui")
"imgui/imgui_draw.cpp", "imgui/imgui_draw.cpp",
"imgui/imgui_tables.cpp", "imgui/imgui_tables.cpp",
"imgui/imgui_widgets.cpp", "imgui/imgui_widgets.cpp",
--"imgui/misc/freetype/imgui_freetype.cpp",
}) })

1906
third_party/stb/stb_sprintf.h vendored Normal file

File diff suppressed because it is too large Load diff