#include "StackViewer.h" #include "imgui.h" StackViewer::StackViewer( std::shared_ptr graphics, std::shared_ptr machine_state, std::shared_ptr callback_manager ) : graphics{std::move(graphics)}, machine_state{std::move(machine_state)}, callback_manager{std::move(callback_manager)} { } void StackViewer::render() { if (ImGui::Begin("Chip8 - Stack")) { if (ImGui::BeginTable("Stack", 2, ImGuiTableFlags_BordersV)) { for (std::size_t i = 0; i < std::size(machine_state->stack); i++) { ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); ImGui::Text("Depth %zu", i); ImGui::TableSetColumnIndex(1); ImGui::Text("0x%04X", machine_state->stack[i]); } } ImGui::EndTable(); } ImGui::End(); }