[nostalgia/core/studio] Add zoom support to TileSheetEditor
This commit is contained in:
@@ -8,6 +8,10 @@
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
void TileSheetPixels::setPixelSizeMod(float sm) noexcept {
|
||||
m_pixelSizeMod = sm;
|
||||
}
|
||||
|
||||
ox::Error TileSheetPixels::buildShader() noexcept {
|
||||
const auto Vshad = ox::sfmt(VShad, glutils::GlslVersion);
|
||||
const auto Fshad = ox::sfmt(FShad, glutils::GlslVersion);
|
||||
@@ -67,7 +71,7 @@ void TileSheetPixels::setPixelBufferObject(unsigned vertexRow, float x, float y,
|
||||
}
|
||||
|
||||
void TileSheetPixels::setBufferObjects(const NostalgiaGraphic &img, const NostalgiaPalette &pal, glutils::BufferSet *bg) noexcept {
|
||||
const auto setPixel = [bg, img, pal](std::size_t i, uint8_t p) {
|
||||
const auto setPixel = [this, bg, img, pal](std::size_t i, uint8_t p) {
|
||||
const auto color = pal.colors[p];
|
||||
const auto pt = idxToPt(i, img.columns);
|
||||
const auto fx = static_cast<float>(pt.x);
|
||||
@@ -98,11 +102,11 @@ void TileSheetPixels::setBufferObjects(const NostalgiaGraphic &img, const Nostal
|
||||
}
|
||||
}
|
||||
|
||||
ImVec2 TileSheetPixels::pixelSize() noexcept {
|
||||
ImVec2 TileSheetPixels::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};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user