[nostalgia/core] Upgrade TileSheet format to support subsheets and add conversion system
This commit is contained in:
@@ -69,31 +69,31 @@ void TileSheetGrid::setBufferObjects(const geo::Vec2 &paneSize, const TileSheet
|
||||
setBufferObject(pt1, pt2, c, vbo, pixSize);
|
||||
};
|
||||
// set buffer length
|
||||
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 pixelCnt = static_cast<unsigned>(width * height);
|
||||
const auto tileCnt = static_cast<unsigned>(img.columns * img.rows);
|
||||
const auto tileCnt = static_cast<unsigned>(img.columns() * img.rows());
|
||||
m_bufferSet.vertices.resize((tileCnt + pixelCnt) * VertexVboLength);
|
||||
// set buffer
|
||||
auto i = 0ull;
|
||||
// pixel outlines
|
||||
constexpr auto pixOutlineColor = color32(0.4431f, 0.4901f, 0.4941f);
|
||||
for (auto x = 0; x < img.columns * TileWidth + 1; ++x) {
|
||||
set(i, {x, 0}, {x, img.rows * TileHeight}, pixOutlineColor);
|
||||
for (auto x = 0; x < img.columns() * TileWidth + 1; ++x) {
|
||||
set(i, {x, 0}, {x, img.rows() * TileHeight}, pixOutlineColor);
|
||||
++i;
|
||||
}
|
||||
for (auto y = 0; y < img.rows * TileHeight + 1; ++y) {
|
||||
set(i, {0, y}, {img.columns * TileWidth, y}, pixOutlineColor);
|
||||
for (auto y = 0; y < img.rows() * TileHeight + 1; ++y) {
|
||||
set(i, {0, y}, {img.columns() * TileWidth, y}, pixOutlineColor);
|
||||
++i;
|
||||
}
|
||||
// tile outlines
|
||||
constexpr auto tileOutlineColor = color32(0.f, 0.f, 0.f);
|
||||
for (auto x = 0; x < img.columns * TileWidth + 1; x += TileWidth) {
|
||||
set(i, {x, 0}, {x, img.rows * TileHeight}, tileOutlineColor);
|
||||
for (auto x = 0; x < img.columns() * TileWidth + 1; x += TileWidth) {
|
||||
set(i, {x, 0}, {x, img.rows() * TileHeight}, tileOutlineColor);
|
||||
++i;
|
||||
}
|
||||
for (auto y = 0; y < img.rows * TileHeight + 1; y += TileHeight) {
|
||||
set(i, {0, y}, {img.columns * TileWidth, y}, tileOutlineColor);
|
||||
for (auto y = 0; y < img.rows() * TileHeight + 1; y += TileHeight) {
|
||||
set(i, {0, y}, {img.columns() * TileWidth, y}, tileOutlineColor);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user