[nostalgia/core/studio] Add scrolling support to TileSheetEditor

This commit is contained in:
2022-02-04 22:51:17 -06:00
parent 9af7eb2fd7
commit 96e2510e64
8 changed files with 183 additions and 62 deletions
@@ -24,8 +24,9 @@ class TileSheetPixels {
in vec2 vPosition;
in vec3 vColor;
out vec3 fColor;
uniform vec2 vScroll;
void main() {
gl_Position = vec4(vPosition, 0.0, 1.0);
gl_Position = vec4(vPosition + vScroll, 0.0, 1.0);
fColor = vColor;
})";
static constexpr auto FShad = R"(
@@ -46,18 +47,18 @@ class TileSheetPixels {
ox::Error buildShader() noexcept;
void draw(bool update) noexcept;
void draw(bool update, const ImVec2 &scroll) noexcept;
void initBufferSet(const NostalgiaGraphic &img, const NostalgiaPalette &pal) noexcept;
[[nodiscard]]
ImVec2 pixelSize(const ImVec2 &paneSize = ImGui::GetContentRegionAvail()) const noexcept;
private:
void setPixelBufferObject(unsigned vertexRow, float x, float y, Color16 color, float *vbo, GLuint *ebo) noexcept;
void setBufferObjects(const NostalgiaGraphic &img, const NostalgiaPalette &pal, glutils::BufferSet *bg) noexcept;
[[nodiscard]]
ImVec2 pixelSize() const noexcept;
};
}