Creado register view
This commit is contained in:
57
src/UI/RegisterView.cpp
Normal file
57
src/UI/RegisterView.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#include "RegisterView.h"
|
||||
|
||||
#include "imgui.h"
|
||||
#include "../Interpreter/MachineState.h"
|
||||
|
||||
RegisterView::RegisterView(
|
||||
std::shared_ptr<Graphics> graphics,
|
||||
std::shared_ptr<MachineState> machine_state,
|
||||
std::shared_ptr<CallbackManager> callback_manager) :
|
||||
graphics{std::move(graphics)},
|
||||
machine_state{std::move(machine_state)},
|
||||
callback_manager{std::move(callback_manager)}
|
||||
{
|
||||
}
|
||||
|
||||
void RegisterView::render()
|
||||
{
|
||||
if (ImGui::Begin("Chip8 - Registers"))
|
||||
{
|
||||
if (ImGui::BeginTable("Registers", 4, ImGuiTableFlags_Borders))
|
||||
{
|
||||
ImGui::TableNextRow();
|
||||
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
ImGui::Text("PC");
|
||||
ImGui::Text("0x%04X", this->machine_state->pc);
|
||||
ImGui::TableSetColumnIndex(1);
|
||||
ImGui::Text("I");
|
||||
ImGui::Text("0x%02X", this->machine_state->i);
|
||||
|
||||
ImGui::TableSetColumnIndex(2);
|
||||
ImGui::Text("DT");
|
||||
ImGui::Text("0x%04X", this->machine_state->dt);
|
||||
|
||||
ImGui::TableSetColumnIndex(3);
|
||||
ImGui::Text("ST");
|
||||
ImGui::Text("0x%04X", this->machine_state->st);
|
||||
}
|
||||
ImGui::EndTable();
|
||||
|
||||
if (ImGui::BeginTable("Registers", 8, ImGuiTableFlags_Borders))
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
ImGui::TableNextRow();
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
ImGui::TableSetColumnIndex(j);
|
||||
ImGui::Text("V%i", i * 8 + j);
|
||||
ImGui::Text("0x%02X", this->machine_state->v[i * 8 + j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
Reference in New Issue
Block a user