[nostalgia/core/studio] Break out TileSheetEditor application logic

This commit is contained in:
2022-02-13 11:17:57 -06:00
parent 320df614a9
commit 8774f1c062
10 changed files with 246 additions and 149 deletions
@@ -24,7 +24,7 @@ void TileSheetPixels::draw(bool update, const geo::Vec2 &scroll) noexcept {
if (update) {
glutils::sendVbo(m_bufferSet);
}
const auto uniformScroll = static_cast<GLint>(glGetUniformLocation(m_shader, "vScroll"));
const auto uniformScroll = glGetUniformLocation(m_shader, "vScroll");
glUniform2f(uniformScroll, scroll.x, scroll.y);
glDrawElements(GL_TRIANGLES, static_cast<GLsizei>(m_bufferSet.elements.size()), GL_UNSIGNED_INT, nullptr);
}
@@ -56,7 +56,7 @@ geo::Vec2 TileSheetPixels::pixelSize(const geo::Vec2 &paneSize) const noexcept {
return {xmod * m_pixelSizeMod, ymod * m_pixelSizeMod};
}
void TileSheetPixels::setPixelBufferObject(const geo::Vec2 &paneSize, unsigned vertexRow, float x, float y, Color16 color, float *vbo, GLuint *ebo) noexcept {
void TileSheetPixels::setPixelBufferObject(const geo::Vec2 &paneSize, unsigned vertexRow, float x, float y, Color16 color, float *vbo, GLuint *ebo) const noexcept {
const auto [xmod, ymod] = pixelSize(paneSize);
x *= xmod;
y *= -ymod;