[jasper] Upgrade to newer Nostalgia
All checks were successful
Build / build (push) Successful in 3m57s

This commit is contained in:
2025-01-20 03:18:30 -06:00
parent 2eb87c06f2
commit c33ffa7b36
19 changed files with 84 additions and 84 deletions

View File

@@ -12,7 +12,7 @@ CollisionMap mapIdx(auto x, auto y) noexcept {
}
CollisionView::CollisionView(studio::StudioContext &sctx):
m_nctx(ncore::init(sctx.tctx, {
m_nctx(ngfx::init(sctx.tctx, {
.glInstallDrawer = false,
.glSpriteCount = 0,
}).unwrapThrow()),
@@ -29,9 +29,9 @@ ox::Error CollisionView::setup(
m_subsheetTilesWidth = w;
m_subsheetTilesHeight = h;
m_sheetTileStart = tile;
ncore::setBgStatus(*m_nctx, 0, true);
OX_RETURN_ERROR(ncore::loadBgTileSheet(*m_nctx, 0, tsAddr));
OX_RETURN_ERROR(ncore::loadBgPalette(*m_nctx, 0, palAddr));
ngfx::setBgStatus(*m_nctx, 0, true);
OX_RETURN_ERROR(ngfx::loadBgTileSheet(*m_nctx, 0, tsAddr));
OX_RETURN_ERROR(ngfx::loadBgPalette(*m_nctx, 0, palAddr));
OX_RETURN_ERROR(m_highlighter.setup({w / 2, h / 2}));
buildGlBuffers(colMap);
return {};
@@ -39,7 +39,7 @@ ox::Error CollisionView::setup(
void CollisionView::draw() noexcept {
glutils::FrameBufferBind const frameBufferBind(m_frameBuffer);
ncore::gl::draw(*m_nctx, s_scale);
ngfx::gl::draw(*m_nctx, s_scale);
m_highlighter.draw();
}
@@ -67,7 +67,7 @@ void CollisionView::buildGlBuffers(CollisionMap colMap) noexcept {
auto tile = m_sheetTileStart;
for (auto y = 0; y < m_subsheetTilesHeight; ++y) {
for (auto x = 0; x < m_subsheetTilesWidth; ++x) {
ncore::setBgTile(*m_nctx, 0, x, y, tile);
ngfx::setBgTile(*m_nctx, 0, x, y, tile);
auto const collidable = (colMap >> mapIdx(x, y)) & 1;
std::ignore = m_highlighter.setTileHighlight({x, y}, collidable);
++tile;

View File

@@ -7,7 +7,7 @@
#include <glutils/glutils.hpp>
#include <studio/context.hpp>
#include <nostalgia/core/core.hpp>
#include <nostalgia/gfx/core.hpp>
#include <jasper/world/worldobject.hpp>
@@ -15,12 +15,12 @@
namespace jasper::world {
namespace ncore = nostalgia::core;
namespace ngfx = nostalgia::gfx;
class CollisionView {
private:
static constexpr int s_scale = 5;
ncore::ContextUPtr m_nctx;
ngfx::ContextUPtr m_nctx;
glutils::FrameBuffer m_frameBuffer;
uint_t m_sheetTileStart{};
int m_subsheetTilesWidth{};

View File

@@ -9,7 +9,7 @@ namespace jasper::world {
EditObjectSubSheet::EditObjectSubSheet(
WorldObjectSet &doc,
size_t const objIdx,
ncore::SubSheetId const newSubSheet,
ngfx::SubSheetId const newSubSheet,
uint8_t const newFrames) noexcept:
m_doc{doc},
m_objIdx{objIdx},

View File

@@ -110,15 +110,15 @@ class EditObjectSubSheet: public studio::UndoCommand {
private:
WorldObjectSet &m_doc;
size_t const m_objIdx{};
ncore::SubSheetId const m_oldSubSheet{};
ncore::SubSheetId m_newSubSheet{};
ngfx::SubSheetId const m_oldSubSheet{};
ngfx::SubSheetId m_newSubSheet{};
uint8_t const m_oldFrames{};
uint8_t m_newFrames{};
public:
EditObjectSubSheet(
WorldObjectSet &doc,
size_t objIdx,
ncore::SubSheetId newSubSheet,
ngfx::SubSheetId newSubSheet,
uint8_t newFrames) noexcept;
ox::Error redo() noexcept override;

View File

@@ -28,7 +28,7 @@ WorldObjectSetEditorImGui::WorldObjectSetEditorImGui(
m_sctx(ctx),
m_itemPath(itemPath()),
m_doc(*readObj<WorldObjectSet>(keelCtx(m_sctx), itemPath()).unwrapThrow()),
m_tileSheet(readObj<ncore::TileSheet>(keelCtx(m_sctx), m_doc.tilesheet).unwrapThrow()) {
m_tileSheet(readObj<ngfx::TileSheet>(keelCtx(m_sctx), m_doc.tilesheet).unwrapThrow()) {
auto &kctx = keelCtx(m_sctx);
auto const [tsPath, err] = getPath(kctx, m_doc.tilesheet);
if (!err) {
@@ -95,7 +95,7 @@ void WorldObjectSetEditorImGui::drawTileSheetSelector() noexcept {
ig::InputText("Tile Sheet", m_tilesheetPath, tsFlags);
if (ig::DragDropTarget const d; d) {
auto const [fr, err] = ig::getDragDropPayload<studio::FileRef>("FileRef");
if (!err && endsWith(fr.path, ncore::FileExt_ng)) {
if (!err && endsWith(fr.path, ngfx::FileExt_ng)) {
std::ignore = setTileSheet(fr.path);
}
}
@@ -215,8 +215,8 @@ void WorldObjectSetEditorImGui::drawObjEditor() noexcept {
auto const&fb = m_colView.framebuffer();
uintptr_t const buffId = fb.color.id;
auto const scale = static_cast<float>(m_colView.scale());
auto const width = static_cast<float>(m_visibleSubsheet->columns * ncore::TileWidth);
auto const height = static_cast<float>(m_visibleSubsheet->rows * ncore::TileHeight);
auto const width = static_cast<float>(m_visibleSubsheet->columns * ngfx::TileWidth);
auto const height = static_cast<float>(m_visibleSubsheet->rows * ngfx::TileHeight);
auto const horzPct = width / 240.f;
auto const vertPct = height / 160.f;
auto const imageSz = ImVec2{width * scale, height * scale};
@@ -238,7 +238,7 @@ void WorldObjectSetEditorImGui::drawObjEditor() noexcept {
}
}
void WorldObjectSetEditorImGui::drawSubSheetNode(ncore::TileSheet::SubSheet const&ss) noexcept {
void WorldObjectSetEditorImGui::drawSubSheetNode(ngfx::TileSheet::SubSheet const&ss) noexcept {
auto constexpr dirFlags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick;
auto const&obj = activeObj();
auto const selected = ss.id == obj.subsheetId ? ImGuiTreeNodeFlags_Selected : 0;
@@ -285,7 +285,7 @@ void WorldObjectSetEditorImGui::drawPaletteList() noexcept {
}
if (ig::DragDropTarget const d; d) {
auto const [fr, err] = ig::getDragDropPayload<studio::FileRef>("FileRef");
if (!err && endsWith(fr.path, ncore::FileExt_npal)) {
if (!err && endsWith(fr.path, ngfx::FileExt_npal)) {
addPalette(fr.path);
}
}
@@ -315,7 +315,7 @@ void WorldObjectSetEditorImGui::drawAddPalettePopup() noexcept {
auto constexpr popupSz = ImVec2{285.f, 0};
ig::IDStackItem const idStackItem{"AddPalette"};
if (ig::BeginPopup(m_sctx.tctx, popupName, m_addPalPopup.show, popupSz)) {
auto const&palettes = m_sctx.project->fileList(ncore::FileExt_npal);
auto const&palettes = m_sctx.project->fileList(ngfx::FileExt_npal);
ig::ComboBox("Palette", palettes, m_addPalPopup.selectedIdx);
if (ig::PopupControlsOkCancel(popupSz.x, m_addPalPopup.show) == ig::PopupResponse::OK) {
addPalette(palettes[m_addPalPopup.selectedIdx]);
@@ -359,7 +359,7 @@ ox::Error WorldObjectSetEditorImGui::handleCmd(studio::UndoCommand const*cmd) no
if (dynamic_cast<ChangeTileSheet const*>(cmd)) {
auto &kctx = keelCtx(m_sctx.tctx);
std::ignore = m_tileSheet.updated.disconnectObject(this);
oxLogError(readObj<ncore::TileSheet>(kctx, m_doc.tilesheet).moveTo(m_tileSheet));
oxLogError(readObj<ngfx::TileSheet>(kctx, m_doc.tilesheet).moveTo(m_tileSheet));
m_tileSheet.updated.connect(this, &WorldObjectSetEditorImGui::loadObj);
} else if (
dynamic_cast<AddPalette const*>(cmd) ||

View File

@@ -18,8 +18,8 @@ class WorldObjectSetEditorImGui: public studio::Editor {
studio::StudioContext &m_sctx;
ox::String m_itemPath;
WorldObjectSet m_doc;
keel::AssetRef<ncore::TileSheet> m_tileSheet;
ncore::TileSheet::SubSheet const*m_visibleSubsheet = nullptr;
keel::AssetRef<ngfx::TileSheet> m_tileSheet;
ngfx::TileSheet::SubSheet const*m_visibleSubsheet = nullptr;
ox::Vector<ox::String> m_paletteDisplayNames;
size_t m_selectedObj{};
size_t m_selectedPal{};
@@ -58,7 +58,7 @@ class WorldObjectSetEditorImGui: public studio::Editor {
void drawObjEditor() noexcept;
void drawSubSheetNode(ncore::TileSheet::SubSheet const&ss) noexcept;
void drawSubSheetNode(ngfx::TileSheet::SubSheet const&ss) noexcept;
void drawPaletteList() noexcept;