[nostalgia/core/studio] Cleanup, make FrameBuffer resize use resizeInitFrameBuffer

This commit is contained in:
2023-03-11 15:00:04 -06:00
parent a5547487f8
commit 488f73f60f
7 changed files with 35 additions and 34 deletions

View File

@@ -46,7 +46,7 @@ TileSheetEditorImGui::TileSheetEditorImGui(Context *ctx, ox::CRStringView path):
// init palette idx
const auto &palPath = model()->palPath();
auto sctx = applicationData<studio::StudioContext>(m_ctx);
const auto &palList = sctx->project->fileList(core::FileExt_npal + 1);
const auto &palList = sctx->project->fileList(core::FileExt_npal);
for (std::size_t i = 0; const auto &pal : palList) {
if (palPath == pal) {
m_selectedPaletteIdx = i;
@@ -278,10 +278,9 @@ void TileSheetEditorImGui::drawTileSheet(const geo::Vec2 &fbSize) noexcept {
const auto winPos = ImGui::GetWindowPos();
const auto fbSizei = geo::Size(static_cast<int>(fbSize.x), static_cast<int>(fbSize.y));
if (m_framebuffer.width != fbSizei.width || m_framebuffer.height != fbSizei.height) {
m_framebuffer = glutils::generateFrameBuffer(fbSizei.width, fbSizei.height);
glutils::resizeInitFrameBuffer(&m_framebuffer, fbSizei.width, fbSizei.height);
m_tileSheetEditor.resizeView(fbSize);
} else if (m_tileSheetEditor.updated()) {
m_tileSheetEditor.resizeView(fbSize);
m_tileSheetEditor.ackUpdate();
}
glBindFramebuffer(GL_FRAMEBUFFER, m_framebuffer);
@@ -344,7 +343,7 @@ void TileSheetEditorImGui::drawTileSheet(const geo::Vec2 &fbSize) noexcept {
void TileSheetEditorImGui::drawPaletteSelector() noexcept {
auto sctx = applicationData<studio::StudioContext>(m_ctx);
const auto &files = sctx->project->fileList(core::FileExt_npal + 1);
const auto &files = sctx->project->fileList(core::FileExt_npal);
const auto first = m_selectedPaletteIdx < files.size() ?
files[m_selectedPaletteIdx].c_str() : "";
if (ImGui::BeginCombo("Palette", first, 0)) {