started work on sprite rendering
This commit is contained in:
parent
6fe829d66c
commit
ca729613c7
10 changed files with 417 additions and 22 deletions
|
@ -10,6 +10,7 @@
|
|||
#include "Disassembler.hpp"
|
||||
#include "MemoryViewer.hpp"
|
||||
#include "NametableViewer.hpp"
|
||||
#include "OAMViewer.hpp"
|
||||
#include "PatternTableViewer.hpp"
|
||||
#include "ControllerPortViewer.hpp"
|
||||
#include "Palettes.hpp"
|
||||
|
@ -27,6 +28,7 @@ Debugger::Debugger(Bus* bus) :
|
|||
|
||||
windows.push_back(new MemoryViewer(this, bus));
|
||||
windows.push_back(new NametableViewer(this, bus));
|
||||
windows.push_back(new OAMViewer(this, &bus->ppu));
|
||||
windows.push_back(new PatternTableViewer(this, bus->cartridge.GetMapper()));
|
||||
windows.push_back(new ControllerPortViewer(this, &bus->controllerPort));
|
||||
windows.push_back(new Palettes(this, bus));
|
||||
|
|
33
src/debugger/OAMViewer.cpp
Normal file
33
src/debugger/OAMViewer.cpp
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include "OAMViewer.hpp"
|
||||
|
||||
#include "../PPU.hpp"
|
||||
#include <imgui/imgui.h>
|
||||
|
||||
OAMViewer::OAMViewer(Debugger* debugger, PPU* ppu) :
|
||||
DebugWindow("OAM Viewer", debugger), ppu(ppu)
|
||||
{
|
||||
}
|
||||
|
||||
void OAMViewer::OnRender()
|
||||
{
|
||||
if (!ImGui::Begin("OAM Viewer", &isOpen))
|
||||
{
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
|
||||
char label[sizeof("Sprite 00")];
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
std::sprintf(label, "Sprite %02d", i);
|
||||
if (ImGui::CollapsingHeader(label))
|
||||
{
|
||||
ImGui::Text("Y pos : %02X", ppu->OAM[4 * i + 0]);
|
||||
ImGui::Text("Tile : %02X", ppu->OAM[4 * i + 1]);
|
||||
ImGui::Text("Attribute: %02X", ppu->OAM[4 * i + 2]);
|
||||
ImGui::Text("X pos : %02X", ppu->OAM[4 * i + 3]);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
17
src/debugger/OAMViewer.hpp
Normal file
17
src/debugger/OAMViewer.hpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
#pragma once
|
||||
|
||||
#include "DebugWindow.hpp"
|
||||
|
||||
class PPU;
|
||||
|
||||
class OAMViewer :
|
||||
public DebugWindow
|
||||
{
|
||||
public:
|
||||
OAMViewer(Debugger* debugger, PPU* ppu);
|
||||
|
||||
virtual void OnRender() override;
|
||||
|
||||
private:
|
||||
PPU* ppu;
|
||||
};
|
|
@ -121,6 +121,11 @@ void PPUWatcher::OnRender()
|
|||
ImGui::TableNextColumn();
|
||||
ImGui::Text("$%04X", ppu->ppuctrl.Flag.BackgrPatternTableAddr ? 0x1000 : 0x0000);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("Sprite Size");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text(ppu->ppuctrl.Flag.SpriteSize ? "8x16" : "8x8");
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("Master/Slave");
|
||||
ImGui::TableNextColumn();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue