[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
@@ -49,11 +49,12 @@ class TileSheetGrid {
in vec3 gColor[];
in vec2 gPt2[];
out vec3 fColor;
uniform vec2 gScroll;
void main() {
fColor = gColor[0];
gl_Position = gl_in[0].gl_Position;
gl_Position = gl_in[0].gl_Position + vec4(gScroll, 0, 0);
EmitVertex();
gl_Position = vec4(gPt2[0], 0, 1);
gl_Position = vec4(gPt2[0] + gScroll, 0, 1);
EmitVertex();
EndPrimitive();
})glsl";
@@ -67,7 +68,7 @@ class TileSheetGrid {
ox::Error buildShader() noexcept;
void draw(bool update) noexcept;
void draw(bool update, const ImVec2 &scroll) noexcept;
void initBufferSet(const NostalgiaGraphic &img) noexcept;
@@ -77,7 +78,7 @@ class TileSheetGrid {
void setBufferObjects(const NostalgiaGraphic &img, glutils::BufferSet *bg) noexcept;
[[nodiscard]]
class ImVec2 pixelSize() const noexcept;
class ImVec2 pixelSize(const ImVec2 &paneSize = ImGui::GetContentRegionAvail()) const noexcept;
};