[nostalgia/gfx/studio] Add type specific navigateTo functions
Some checks failed
Build / build (push) Has been cancelled

This commit is contained in:
Gary Talent 2025-05-17 23:26:23 -05:00
parent 0e9a8d7202
commit ebef57a28b
2 changed files with 26 additions and 3 deletions

View File

@ -6,6 +6,27 @@
#include <studio/studio.hpp> #include <studio/studio.hpp>
namespace nostalgia::core { #include "tilesheet.hpp"
namespace nostalgia::gfx {
inline void navigateToTileSheet(studio::Context &ctx, ox::StringViewCR path, SubSheetId subsheetId) noexcept {
::studio::navigateTo(ctx, path, ox::intToStr(subsheetId));
}
inline void navigateToPalette(studio::Context &ctx, ox::StringViewCR path) noexcept {
::studio::navigateTo(ctx, path);
}
inline void navigateToPalette(
studio::Context &ctx,
ox::StringViewCR path,
size_t const colorIdx,
size_t const palPage) noexcept {
::studio::navigateTo(
ctx,
path,
ox::sfmt("{};{}", colorIdx, palPage));
}
} }

View File

@ -9,6 +9,8 @@
#include <keel/media.hpp> #include <keel/media.hpp>
#include <studio/studio.hpp> #include <studio/studio.hpp>
#include <nostalgia/gfx/studio.hpp>
#include "tilesheeteditor-imgui.hpp" #include "tilesheeteditor-imgui.hpp"
namespace nostalgia::gfx { namespace nostalgia::gfx {
@ -570,10 +572,10 @@ void TileSheetEditorImGui::drawPaletteMenu() noexcept {
m_view.setPalIdx(i); m_view.setPalIdx(i);
} }
if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(0)) { if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(0)) {
studio::navigateTo( navigateToPalette(
m_sctx, m_sctx,
m_model.palPath(), m_model.palPath(),
ox::sfmt("{};{}", i, m_model.palettePage())); i, m_model.palettePage());
} }
// Column: color RGB // Column: color RGB
ImGui::TableNextColumn(); ImGui::TableNextColumn();