Eliminando codigo antiguo y creando base de control panel
This commit is contained in:
46
src/UI/ControlPanel.cpp
Normal file
46
src/UI/ControlPanel.cpp
Normal 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();
|
||||
}
|
||||
Reference in New Issue
Block a user