Eliminando codigo antiguo y creando base de control panel

This commit is contained in:
2025-06-23 23:59:46 -04:00
parent 13010642b6
commit de3b9f6769
19 changed files with 61 additions and 1167 deletions

46
src/UI/ControlPanel.cpp Normal file
View File

@@ -0,0 +1,46 @@
#include "ControlPanel.h"
#include <format>
#include "imgui.h"
ControlPanel::ControlPanel(
std::shared_ptr<Graphics> graphics,
std::shared_ptr<MachineState> machine_state
): graphics{std::move(graphics)},
machine_state{std::move(machine_state)} {}
void ControlPanel::render() {
constexpr auto full_width = ImVec2(-FLT_MIN, 0.0f);
if (ImGui::Begin("Chip-8 - Controls")) {
ImGui::Button("Load Rom", full_width);
if (ImGui::Button(run ? "Pause" : "Run", full_width)) {
this->run = !run;
}
ImGui::Text("Status: %s", "Stopped");
ImGui::SeparatorText("Debug");
ImGui::Button("Step One", full_width);
ImGui::Button(std::format("Step +{}", steps).data(), full_width);
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
ImGui::InputInt("##steps", &steps);
ImGui::PopItemWidth();
ImGui::SeparatorText("Emulation speed (IPS)");
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
ImGui::InputInt("##speed", &speed);
ImGui::PopItemWidth();
ImGui::SeparatorText("");
ImGui::Button("Reset", full_width);
ImGui::Button("Reload ROM", full_width);
}
ImGui::End();
}