fixing compilation error and some warnings

This commit is contained in:
Clément Le Bihan
2020-05-25 15:58:30 +02:00
parent a012a6b110
commit ca07bf3366
3 changed files with 8 additions and 9 deletions

View File

@@ -8,11 +8,11 @@
namespace ComSquare::PPU
{
Background::Background(int bpp, Vector2<int> backgroundSize, Vector2<int> characterSize, bool directColor, bool highRes, bool priority, uint16_t vramAddress, uint16_t graphicVramAddress):
_bpp(bpp),
_backgroundSize(backgroundSize),
_characterSize(characterSize),
_highRes(highRes),
_bpp(bpp),
_directColor(directColor),
_highRes(highRes),
_priority(priority),
_vramAddress(vramAddress),
_graphicVramAddress(graphicVramAddress)
@@ -74,8 +74,8 @@ namespace ComSquare::PPU
uint16_t addr = nbPalette * 0x10;
for (int i = 0; i < 0xF; i++) {
palette[i] = this->cgramRead(addr);
palette[i] += this->cgramRead(addr + 1) << 8U;
palette[i] = this->cgram->read_internal(addr);
palette[i] += this->cgram->read_internal(addr + 1) << 8U;
}
return palette;
}
@@ -125,7 +125,7 @@ namespace ComSquare::PPU
tileMapValue = this->vram->read_internal(vramAddress);
tileMapValue += this->vram->read_internal(vramAddress + 1) << 8U;
vramAddress += 2;
drawBgTile(tileMapValue, {(pos.x * this->_characterSize.x) + offset.x, (pos.y * this->_characterSize.y) + offset.y}, this->_bpp);
drawBgTile(tileMapValue, {(pos.x * this->_characterSize.x) + offset.x, (pos.y * this->_characterSize.y) + offset.y});
if (pos.x % 31 == 0 && pos.x) {
pos.y++;
pos.x = 0;

View File

@@ -9,6 +9,7 @@
#include <array>
#include <vector>
#include "../Models/Vector2.hpp"
#include "../Ram/Ram.hpp"
namespace ComSquare::PPU
{
@@ -24,6 +25,8 @@ namespace ComSquare::PPU
uint16_t _graphicVramAddress;
std::array<std::array<uint32_t, 1024>, 1024> _buffer;
std::shared_ptr<Ram::Ram> vram;
std::shared_ptr<Ram::Ram> cgram;
//! @brief Draw a tile on the screen at x y pos
void drawBgTile(uint16_t data, Vector2<int> pos);
//! @brief Get a palette from the number of the palette (0 - 7)

View File

@@ -1,11 +1,7 @@
/********************************************************************************
** Form generated from reading UI file 'cpu.ui'
**
<<<<<<< HEAD
** Created by: Qt User Interface Compiler version 5.13.2
=======
** Created by: Qt User Interface Compiler version 5.14.2
>>>>>>> 24bcafeea3896022704904815d263f69f22e5096
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/