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

This commit is contained in:
2022-02-03 00:24:40 -06:00
parent 78942ce21d
commit d4e198ecc3
6 changed files with 49 additions and 12 deletions
@@ -7,6 +7,10 @@
namespace nostalgia::core {
void TileSheetGrid::setPixelSizeMod(float sm) noexcept {
m_pixelSizeMod = sm;
}
ox::Error TileSheetGrid::buildShader() noexcept {
const auto pixelLineVshad = ox::sfmt(VShad, glutils::GlslVersion);
const auto pixelLineFshad = ox::sfmt(FShad, glutils::GlslVersion);
@@ -92,11 +96,11 @@ void TileSheetGrid::setBufferObjects(const NostalgiaGraphic &img, glutils::Buffe
}
}
ImVec2 TileSheetGrid::pixelSize() noexcept {
ImVec2 TileSheetGrid::pixelSize() const noexcept {
const auto [sw, sh] = ImGui::GetContentRegionAvail();
constexpr float ymod = 0.35f / 10.0f;
const auto xmod = ymod * sh / sw;
return {xmod, ymod};
return {xmod * m_pixelSizeMod, ymod * m_pixelSizeMod};
}
}