[nostalgia/core] Upgrade TileSheet format to support subsheets and add conversion system
This commit is contained in:
@@ -81,7 +81,7 @@ void TileSheetPixels::setPixelBufferObject(const geo::Vec2 &paneSize, unsigned v
|
||||
void TileSheetPixels::setBufferObjects(const geo::Vec2 &paneSize, const TileSheet &img, const Palette &pal, glutils::BufferSet *bg) noexcept {
|
||||
const auto setPixel = [this, paneSize, bg, img, pal](std::size_t i, uint8_t p) {
|
||||
const auto color = pal.colors[p];
|
||||
const auto pt = idxToPt(static_cast<int>(i), img.columns);
|
||||
const auto pt = idxToPt(static_cast<int>(i), img.columns());
|
||||
const auto fx = static_cast<float>(pt.x);
|
||||
const auto fy = static_cast<float>(pt.y);
|
||||
const auto vbo = &bg->vertices[i * VertexVboLength];
|
||||
@@ -89,8 +89,8 @@ void TileSheetPixels::setBufferObjects(const geo::Vec2 &paneSize, const TileShee
|
||||
setPixelBufferObject(paneSize, i * VertexVboRows, fx, fy, color, vbo, ebo);
|
||||
};
|
||||
// set buffer lengths
|
||||
const auto width = img.columns * TileWidth;
|
||||
const auto height = img.rows * TileHeight;
|
||||
const auto width = img.columns() * TileWidth;
|
||||
const auto height = img.rows() * TileHeight;
|
||||
const auto tiles = static_cast<unsigned>(width * height);
|
||||
m_bufferSet.vertices.resize(tiles * VertexVboLength);
|
||||
m_bufferSet.elements.resize(tiles * VertexEboLength);
|
||||
|
||||
Reference in New Issue
Block a user