mirror of
https://github.com/zoriya/ComSquare.git
synced 2025-12-20 14:15:11 +00:00
start to test the implementation of tilerenderer
This commit is contained in:
@@ -139,4 +139,9 @@ namespace ComSquare::Debugger
|
||||
return palette;
|
||||
}
|
||||
|
||||
void TileRenderer::setCgram(std::shared_ptr<Ram::Ram> ram)
|
||||
{
|
||||
this->_cgram = std::move(ram);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,9 +9,9 @@
|
||||
#include <QMouseEvent>
|
||||
#include <array>
|
||||
#include "PPU/PPU.hpp"
|
||||
#include "ClosableWindow.hpp"
|
||||
#include "Debugger/ClosableWindow.hpp"
|
||||
#include "Renderer/QtRenderer/QtSFML.hpp"
|
||||
#include "ui/ui_tileView.h"
|
||||
#include "../../ui/ui_tileView.h"
|
||||
#include "Ram/Ram.hpp"
|
||||
|
||||
|
||||
@@ -24,13 +24,14 @@ namespace ComSquare::Debugger
|
||||
//! @brief cgram to access the colors
|
||||
std::shared_ptr<Ram::Ram> _cgram;
|
||||
//! @brief The bpp to use while rendering
|
||||
int _bpp,
|
||||
int _bpp;
|
||||
//! @brief The palette number to use while rendering
|
||||
int _palette;
|
||||
public:
|
||||
//! @brief internal buffer
|
||||
std::array<std::array<uint32_t, 500>, 1024> buffer;
|
||||
std::array<std::array<uint32_t, 1024>, 1024> buffer;
|
||||
void setPalette(int palette);
|
||||
void setCgram(std::shared_ptr<Ram::Ram> ram);
|
||||
void setBpp(int bpp);
|
||||
void setRam(std::shared_ptr<Ram::Ram> ram);
|
||||
uint8_t getPixelReferenceFromTileRow(uint16_t tileRowAddress, uint8_t pixelIndex);
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
#include <iostream>
|
||||
#include <bitset>
|
||||
#include "PPU.hpp"
|
||||
#include "../Exceptions/NotImplementedException.hpp"
|
||||
#include "../Exceptions/InvalidAddress.hpp"
|
||||
#include "../Ram/Ram.hpp"
|
||||
#include "../Models/Vector2.hpp"
|
||||
#include "Exceptions/NotImplementedException.hpp"
|
||||
#include "Exceptions/InvalidAddress.hpp"
|
||||
#include "Ram/Ram.hpp"
|
||||
#include "Models/Vector2.hpp"
|
||||
#include <random>
|
||||
|
||||
namespace ComSquare::PPU
|
||||
@@ -31,6 +31,8 @@ namespace ComSquare::PPU
|
||||
_mainScreen({{{0}}}),
|
||||
_subScreen({{{0}}})
|
||||
{
|
||||
this->tileRenderer.setRam(this->vram);
|
||||
this->tileRenderer.setCgram(this->cgram);
|
||||
this->_registers._isLowByte = true;
|
||||
|
||||
//colors for the cgram
|
||||
@@ -465,7 +467,10 @@ namespace ComSquare::PPU
|
||||
void PPU::update(unsigned cycles)
|
||||
{
|
||||
(void)cycles;
|
||||
this->tileRenderer.render();
|
||||
this->add_buffer(this->_screen, this->tileRenderer.buffer);
|
||||
|
||||
/*
|
||||
this->renderMainAndSubScreen();
|
||||
this->add_buffer(this->_screen, this->_subScreen);
|
||||
this->add_buffer(this->_screen, this->_mainScreen);
|
||||
@@ -475,7 +480,7 @@ namespace ComSquare::PPU
|
||||
for (unsigned long j = 0; j < this->_screen[i].size(); j++) {
|
||||
this->_renderer.putPixel(j, i, this->_screen[i][j]);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
this->_renderer.drawScreen();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
#define COMSQUARE_PPU_HPP
|
||||
|
||||
#include <cstdint>
|
||||
#include "../Memory/AMemory.hpp"
|
||||
#include "../Memory/MemoryBus.hpp"
|
||||
#include "../Renderer/IRenderer.hpp"
|
||||
#include "../Ram/Ram.hpp"
|
||||
#include "../Models/Vector2.hpp"
|
||||
#include "Memory/AMemory.hpp"
|
||||
#include "Memory/MemoryBus.hpp"
|
||||
#include "Renderer/IRenderer.hpp"
|
||||
#include "Ram/Ram.hpp"
|
||||
#include "Models/Vector2.hpp"
|
||||
#include "Background.hpp"
|
||||
#include "PPUUtils.hpp"
|
||||
#include "Debugger/TileViewer/TileViewer.hpp"
|
||||
|
||||
#define FALLTHROUGH __attribute__((fallthrough));
|
||||
|
||||
@@ -631,6 +632,8 @@ namespace ComSquare::PPU
|
||||
Vector2<int> getBgScroll(int bgNumber) const;
|
||||
//! @brief Allow to look the value of each write register (used by Register debugger)
|
||||
const Registers &getWriteRegisters() const;
|
||||
|
||||
Debugger::TileRenderer tileRenderer;
|
||||
};
|
||||
|
||||
//! @brief Transform SNES color code BGR to uint32_t RGB
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "Debugger/HeaderViewer.hpp"
|
||||
#include "Debugger/CGramDebug.hpp"
|
||||
#include "Debugger/RegisterViewer.hpp"
|
||||
#include "Debugger/TileViewer.hpp"
|
||||
#include "Debugger/TileViewer/TileViewer.hpp"
|
||||
#endif
|
||||
|
||||
namespace ComSquare
|
||||
|
||||
Reference in New Issue
Block a user