diff --git a/src/jasper/modules/world/include/jasper/world/world.hpp b/src/jasper/modules/world/include/jasper/world/world.hpp index 0b7b01b..8c882a9 100644 --- a/src/jasper/modules/world/include/jasper/world/world.hpp +++ b/src/jasper/modules/world/include/jasper/world/world.hpp @@ -4,13 +4,13 @@ #pragma once -#include +#include #include "worldstatic.hpp" namespace jasper::world { -namespace ncore = nostalgia::core; +namespace ngfx = nostalgia::gfx; class World { private: @@ -19,14 +19,14 @@ class World { uint16_t frame{}; turbine::TimeMs nextUpdateTime{}; }; - ncore::Context &m_nctx; + ngfx::Context &m_nctx; WorldStatic const&m_worldStatic; - ox::Vector, 32> m_tilesheets; + ox::Vector, 32> m_tilesheets; ox::Vector m_objStates; turbine::TimeMs m_currentTicks{}; public: - explicit World(ncore::Context &nctx, WorldStatic const&worldStatic) noexcept; + explicit World(ngfx::Context &nctx, WorldStatic const&worldStatic) noexcept; ox::Error setupDisplay() noexcept; diff --git a/src/jasper/modules/world/include/jasper/world/worlddoc.hpp b/src/jasper/modules/world/include/jasper/world/worlddoc.hpp index 6708b0a..e62a146 100644 --- a/src/jasper/modules/world/include/jasper/world/worlddoc.hpp +++ b/src/jasper/modules/world/include/jasper/world/worlddoc.hpp @@ -10,20 +10,20 @@ #include #include -#include +#include #include "worldobject.hpp" namespace jasper::world { -namespace ncore = nostalgia::core; +namespace ngfx = nostalgia::gfx; struct SpriteDoc { constexpr static auto TypeName = "net.drinkingtea.jasper.world.SpriteDoc"; constexpr static auto TypeVersion = 1; constexpr static auto Preloadable = true; ox::String tilesheetPath; - ox::Vector subsheetId; + ox::Vector subsheetId; }; struct DocObjRef { diff --git a/src/jasper/modules/world/include/jasper/world/worldobject.hpp b/src/jasper/modules/world/include/jasper/world/worldobject.hpp index 239a729..91e6661 100644 --- a/src/jasper/modules/world/include/jasper/world/worldobject.hpp +++ b/src/jasper/modules/world/include/jasper/world/worldobject.hpp @@ -6,12 +6,12 @@ #include -#include -#include +#include +#include namespace jasper::world { -namespace ncore = nostalgia::core; +namespace ngfx = nostalgia::gfx; using CollisionMap = uint32_t; @@ -31,7 +31,7 @@ struct WorldObject { ox::String name; uint16_t intervalMs{}; uint8_t palBank{}; - ncore::SubSheetId subsheetId{}; + ngfx::SubSheetId subsheetId{}; CollisionMap collisionMap{}; uint8_t frames{}; uint8_t objectType{}; diff --git a/src/jasper/modules/world/include/jasper/world/worldstatic.hpp b/src/jasper/modules/world/include/jasper/world/worldstatic.hpp index a0e88ad..1fce866 100644 --- a/src/jasper/modules/world/include/jasper/world/worldstatic.hpp +++ b/src/jasper/modules/world/include/jasper/world/worldstatic.hpp @@ -14,7 +14,7 @@ namespace jasper::world { -namespace ncore = nostalgia::core; +namespace ngfx = nostalgia::gfx; constexpr void setTopEdge(uint8_t &layerAttachments, uint8_t const val) noexcept { layerAttachments = static_cast((layerAttachments & 0b11111100) | val); diff --git a/src/jasper/modules/world/src/keel/typeconv.cpp b/src/jasper/modules/world/src/keel/typeconv.cpp index c4aff2f..484e029 100644 --- a/src/jasper/modules/world/src/keel/typeconv.cpp +++ b/src/jasper/modules/world/src/keel/typeconv.cpp @@ -2,7 +2,7 @@ * Copyright 2023 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved. */ -#include +#include #include #include "typeconv.hpp" diff --git a/src/jasper/modules/world/src/studio/maptilehighlighter.cpp b/src/jasper/modules/world/src/studio/maptilehighlighter.cpp index d4c2ceb..5a32027 100644 --- a/src/jasper/modules/world/src/studio/maptilehighlighter.cpp +++ b/src/jasper/modules/world/src/studio/maptilehighlighter.cpp @@ -25,14 +25,14 @@ const glutils::ProgramSource MapTileHighlighter::s_programSrc = { void main() { gl_Position = vec4(vPosition, 0.0, 1.0); fSelection = vSelection; - })", ncore::gl::GlslVersion), + })", ngfx::gl::GlslVersion), .fragShader = ox::sfmt(R"( {} in float fSelection; out vec4 outColor; void main() { outColor = vec4(0.0, 0.7, 1.0, 0.4) * fSelection; - })", ncore::gl::GlslVersion), + })", ngfx::gl::GlslVersion), }; MapTileHighlighter::MapTileHighlighter() { @@ -97,8 +97,8 @@ void MapTileHighlighter::setPixelBufferObject( bool const selected, float *vbo, GLuint *ebo) noexcept { - auto constexpr xmod = static_cast(ncore::TileWidth) / 240.f * 4; - auto constexpr ymod = static_cast(ncore::TileHeight) / 160.f * 4; + auto constexpr xmod = static_cast(ngfx::TileWidth) / 240.f * 4; + auto constexpr ymod = static_cast(ngfx::TileHeight) / 160.f * 4; x *= xmod; y *= -ymod; x -= 1.0f; diff --git a/src/jasper/modules/world/src/studio/maptilehighlighter.hpp b/src/jasper/modules/world/src/studio/maptilehighlighter.hpp index 56e6bf1..30c11cb 100644 --- a/src/jasper/modules/world/src/studio/maptilehighlighter.hpp +++ b/src/jasper/modules/world/src/studio/maptilehighlighter.hpp @@ -7,13 +7,13 @@ #include #include -#include +#include #include namespace jasper::world { -namespace ncore = nostalgia::core; +namespace ngfx = nostalgia::gfx; class MapTileHighlighter { private: diff --git a/src/jasper/modules/world/src/studio/studiomodule.cpp b/src/jasper/modules/world/src/studio/studiomodule.cpp index 866cf38..3548c50 100644 --- a/src/jasper/modules/world/src/studio/studiomodule.cpp +++ b/src/jasper/modules/world/src/studio/studiomodule.cpp @@ -33,10 +33,10 @@ static class: public studio::Module { ox::Vector> out; // Person TileSheet { - ncore::TileSheetV4 ts; + ngfx::TileSheetV4 ts; ts.bpp = 4; auto const addSheet = [&ts]( - ncore::TileSheetV4::SubSheet &ss, + ngfx::TileSheetV4::SubSheet &ss, ox::StringParam name, int const cols, int const rows) -> auto& { @@ -52,7 +52,7 @@ static class: public studio::Module { addSheetSet("Back"); addSheetSet("Left"); addSheetSet("Right"); - out.emplace_back(ox::make>( + out.emplace_back(ox::make>( "Jasper World Person", std::move(ts))); } diff --git a/src/jasper/modules/world/src/studio/worldeditor/worldeditorview.cpp b/src/jasper/modules/world/src/studio/worldeditor/worldeditorview.cpp index 04735d9..e1fdb0a 100644 --- a/src/jasper/modules/world/src/studio/worldeditor/worldeditorview.cpp +++ b/src/jasper/modules/world/src/studio/worldeditor/worldeditorview.cpp @@ -2,7 +2,7 @@ * Copyright 2023 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved. */ -#include +#include #include "worldeditorview.hpp" @@ -10,7 +10,7 @@ namespace jasper::world { WorldEditorView::WorldEditorView(studio::StudioContext &sctx, WorldStatic const&worldStatic): m_sctx{sctx}, - m_nctx{ncore::init(m_sctx.tctx, {.glInstallDrawer = false}).unwrapThrow()}, + m_nctx{ngfx::init(m_sctx.tctx, {.glInstallDrawer = false}).unwrapThrow()}, m_worldStatic{worldStatic}, m_world{*m_nctx, m_worldStatic} {} @@ -27,7 +27,7 @@ void WorldEditorView::setupTiles() noexcept { } ox::Error WorldEditorView::setupWorld() noexcept { - glutils::resizeInitFrameBuffer(m_frameBuffer, ncore::gl::drawSize(m_scale)); + glutils::resizeInitFrameBuffer(m_frameBuffer, ngfx::gl::drawSize(m_scale)); if (m_columns != m_worldStatic.columns || m_rows != m_worldStatic.rows) { OX_RETURN_ERROR(m_highlighter.setup({m_worldStatic.columns, m_worldStatic.rows})); m_columns = m_worldStatic.columns; @@ -38,11 +38,11 @@ ox::Error WorldEditorView::setupWorld() noexcept { } void WorldEditorView::draw(ox::Size const&targetSz) noexcept { - auto const scaleSz = targetSz / ncore::gl::drawSize(1); + auto const scaleSz = targetSz / ngfx::gl::drawSize(1); if (m_scaleSz != scaleSz) [[unlikely]] { m_scale = ox::max(1, ox::max(scaleSz.width, scaleSz.height)); - m_scaleSz = ncore::gl::drawSize(m_scale); - glutils::resizeInitFrameBuffer(m_frameBuffer, ncore::gl::drawSize(m_scale)); + m_scaleSz = ngfx::gl::drawSize(m_scale); + glutils::resizeInitFrameBuffer(m_frameBuffer, ngfx::gl::drawSize(m_scale)); } glutils::FrameBufferBind const frameBufferBind(m_frameBuffer); if (m_animateWorld) { @@ -51,7 +51,7 @@ void WorldEditorView::draw(ox::Size const&targetSz) noexcept { turbine::setRefreshWithin(m_sctx.tctx, wakeUp.value); } } - ncore::gl::draw(*m_nctx, m_scale); + ngfx::gl::draw(*m_nctx, m_scale); m_highlighter.draw(); } @@ -76,7 +76,7 @@ glutils::FrameBuffer const&WorldEditorView::framebuffer() const noexcept { } ox::Size WorldEditorView::drawSize() const noexcept { - return ncore::gl::drawSize(m_scale); + return ngfx::gl::drawSize(m_scale); } } diff --git a/src/jasper/modules/world/src/studio/worldeditor/worldeditorview.hpp b/src/jasper/modules/world/src/studio/worldeditor/worldeditorview.hpp index 15d31f7..a555a50 100644 --- a/src/jasper/modules/world/src/studio/worldeditor/worldeditorview.hpp +++ b/src/jasper/modules/world/src/studio/worldeditor/worldeditorview.hpp @@ -8,8 +8,8 @@ #include -#include -#include +#include +#include #include @@ -17,19 +17,19 @@ namespace jasper::world { -namespace ncore = nostalgia::core; +namespace ngfx = nostalgia::gfx; class WorldEditorView: public ox::SignalHandler { private: studio::StudioContext &m_sctx; - ncore::ContextUPtr m_nctx; + ngfx::ContextUPtr m_nctx; WorldStatic const&m_worldStatic; int m_columns{}, m_rows{}; World m_world; glutils::FrameBuffer m_frameBuffer; int m_scale = 1; - ox::Size m_scaleSz = ncore::gl::drawSize(m_scale); + ox::Size m_scaleSz = ngfx::gl::drawSize(m_scale); ox::Optional m_selection; MapTileHighlighter m_highlighter; bool m_animateWorld{}; diff --git a/src/jasper/modules/world/src/studio/worldobjectseteditor/collisionmapview.cpp b/src/jasper/modules/world/src/studio/worldobjectseteditor/collisionmapview.cpp index ad1a647..60b9da8 100644 --- a/src/jasper/modules/world/src/studio/worldobjectseteditor/collisionmapview.cpp +++ b/src/jasper/modules/world/src/studio/worldobjectseteditor/collisionmapview.cpp @@ -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; diff --git a/src/jasper/modules/world/src/studio/worldobjectseteditor/collisionmapview.hpp b/src/jasper/modules/world/src/studio/worldobjectseteditor/collisionmapview.hpp index 42967a8..5fa7426 100644 --- a/src/jasper/modules/world/src/studio/worldobjectseteditor/collisionmapview.hpp +++ b/src/jasper/modules/world/src/studio/worldobjectseteditor/collisionmapview.hpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include @@ -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{}; diff --git a/src/jasper/modules/world/src/studio/worldobjectseteditor/commands/editobject.cpp b/src/jasper/modules/world/src/studio/worldobjectseteditor/commands/editobject.cpp index f1d531f..47018c8 100644 --- a/src/jasper/modules/world/src/studio/worldobjectseteditor/commands/editobject.cpp +++ b/src/jasper/modules/world/src/studio/worldobjectseteditor/commands/editobject.cpp @@ -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}, diff --git a/src/jasper/modules/world/src/studio/worldobjectseteditor/commands/editobject.hpp b/src/jasper/modules/world/src/studio/worldobjectseteditor/commands/editobject.hpp index d079853..b5c8596 100644 --- a/src/jasper/modules/world/src/studio/worldobjectseteditor/commands/editobject.hpp +++ b/src/jasper/modules/world/src/studio/worldobjectseteditor/commands/editobject.hpp @@ -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; diff --git a/src/jasper/modules/world/src/studio/worldobjectseteditor/worldobjectseteditor-imgui.cpp b/src/jasper/modules/world/src/studio/worldobjectseteditor/worldobjectseteditor-imgui.cpp index 543146b..eb401ae 100644 --- a/src/jasper/modules/world/src/studio/worldobjectseteditor/worldobjectseteditor-imgui.cpp +++ b/src/jasper/modules/world/src/studio/worldobjectseteditor/worldobjectseteditor-imgui.cpp @@ -28,7 +28,7 @@ WorldObjectSetEditorImGui::WorldObjectSetEditorImGui( m_sctx(ctx), m_itemPath(itemPath()), m_doc(*readObj(keelCtx(m_sctx), itemPath()).unwrapThrow()), - m_tileSheet(readObj(keelCtx(m_sctx), m_doc.tilesheet).unwrapThrow()) { + m_tileSheet(readObj(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("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(m_colView.scale()); - auto const width = static_cast(m_visibleSubsheet->columns * ncore::TileWidth); - auto const height = static_cast(m_visibleSubsheet->rows * ncore::TileHeight); + auto const width = static_cast(m_visibleSubsheet->columns * ngfx::TileWidth); + auto const height = static_cast(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("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(cmd)) { auto &kctx = keelCtx(m_sctx.tctx); std::ignore = m_tileSheet.updated.disconnectObject(this); - oxLogError(readObj(kctx, m_doc.tilesheet).moveTo(m_tileSheet)); + oxLogError(readObj(kctx, m_doc.tilesheet).moveTo(m_tileSheet)); m_tileSheet.updated.connect(this, &WorldObjectSetEditorImGui::loadObj); } else if ( dynamic_cast(cmd) || diff --git a/src/jasper/modules/world/src/studio/worldobjectseteditor/worldobjectseteditor-imgui.hpp b/src/jasper/modules/world/src/studio/worldobjectseteditor/worldobjectseteditor-imgui.hpp index b22a4e4..01039da 100644 --- a/src/jasper/modules/world/src/studio/worldobjectseteditor/worldobjectseteditor-imgui.hpp +++ b/src/jasper/modules/world/src/studio/worldobjectseteditor/worldobjectseteditor-imgui.hpp @@ -18,8 +18,8 @@ class WorldObjectSetEditorImGui: public studio::Editor { studio::StudioContext &m_sctx; ox::String m_itemPath; WorldObjectSet m_doc; - keel::AssetRef m_tileSheet; - ncore::TileSheet::SubSheet const*m_visibleSubsheet = nullptr; + keel::AssetRef m_tileSheet; + ngfx::TileSheet::SubSheet const*m_visibleSubsheet = nullptr; ox::Vector 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; diff --git a/src/jasper/modules/world/src/world.cpp b/src/jasper/modules/world/src/world.cpp index f80111f..99c3699 100644 --- a/src/jasper/modules/world/src/world.cpp +++ b/src/jasper/modules/world/src/world.cpp @@ -4,7 +4,7 @@ #include -#include +#include #include @@ -15,7 +15,7 @@ static bool isUpdatingObj(ObjTileRefSet const&obj) noexcept { return obj.frames > 1; } -World::World(ncore::Context &nctx, WorldStatic const&worldStatic) noexcept: +World::World(ngfx::Context &nctx, WorldStatic const&worldStatic) noexcept: m_nctx(nctx), m_worldStatic(worldStatic) {} @@ -38,17 +38,17 @@ ox::Error World::setupDisplay() noexcept { if (m_tilesheets.empty()) { auto &kctx = keelCtx(m_nctx); for (auto const&tsAddr : m_worldStatic.tilesheets) { - OX_REQUIRE_M(ts, keel::readObj(kctx, tsAddr)); + OX_REQUIRE_M(ts, keel::readObj(kctx, tsAddr)); m_tilesheets.emplace_back(std::move(ts)); } } for (auto i = 0u; auto const&palAddr : m_worldStatic.palettes) { - OX_RETURN_ERROR(ncore::loadBgPalette(m_nctx, i, palAddr)); + OX_RETURN_ERROR(ngfx::loadBgPalette(m_nctx, i, palAddr)); ++i; } for (size_t i = 1; i < m_worldStatic.objTileRefSets.size(); ++i) { auto const&rs = m_worldStatic.objTileRefSets[i]; - OX_RETURN_ERROR(ncore::loadBgTileSheet( + OX_RETURN_ERROR(ngfx::loadBgTileSheet( m_nctx, rs.cbb, *m_tilesheets[rs.tilesheetId], @@ -72,7 +72,7 @@ ox::Result World::update() noexcept { void World::setupTiles() noexcept { m_currentTicks = ticksMs(turbineCtx(m_nctx)); - ncore::setBgStatus(m_nctx, 0); // disable all backgrounds + ngfx::setBgStatus(m_nctx, 0); // disable all backgrounds for (auto layerNo = 0u; auto const&layer : m_worldStatic.map) { setupLayer(layerNo, layer.cbb); ++layerNo; @@ -87,19 +87,19 @@ void World::setupTile( auto const tx = static_cast(x) * 2; auto const ty = static_cast(y) * 2; auto const &obj = m_worldStatic.objTileRefSets[t.objIdxRefSet]; - ncore::setBgTile(m_nctx, lyr, tx + 0, ty + 0, { + ngfx::setBgTile(m_nctx, lyr, tx + 0, ty + 0, { .tileIdx = static_cast(obj.cbbIdx + 0), .palBank = obj.palBank, }); - ncore::setBgTile(m_nctx, lyr, tx + 1, ty + 0, { + ngfx::setBgTile(m_nctx, lyr, tx + 1, ty + 0, { .tileIdx = static_cast(obj.cbbIdx + 1), .palBank = obj.palBank, }); - ncore::setBgTile(m_nctx, lyr, tx + 0, ty + 1, { + ngfx::setBgTile(m_nctx, lyr, tx + 0, ty + 1, { .tileIdx = static_cast(obj.cbbIdx + 2), .palBank = obj.palBank, }); - ncore::setBgTile(m_nctx, lyr, tx + 1, ty + 1, { + ngfx::setBgTile(m_nctx, lyr, tx + 1, ty + 1, { .tileIdx = static_cast(obj.cbbIdx + 3), .palBank = obj.palBank, }); @@ -112,7 +112,7 @@ ox::Result World::updateObj(ObjState &state) noexcept { if (state.frame >= obj.frames) { state.frame = 0; } - OX_RETURN_ERROR(ncore::loadBgTileSheet( + OX_RETURN_ERROR(ngfx::loadBgTileSheet( m_nctx, obj.cbb, *m_tilesheets[obj.tilesheetId], @@ -127,11 +127,11 @@ ox::Result World::updateObj(ObjState &state) noexcept { void World::setupLayer( uint_t const lyr, uint_t const cbb) noexcept { - ncore::clearBg(m_nctx, lyr); - ncore::setBgStatus(m_nctx, lyr, true); - ncore::setBgCbb(m_nctx, lyr, cbb); - auto const rows = ox::min(m_worldStatic.rows, ncore::tileRows(m_nctx) / 2); - auto const columns = ox::min(m_worldStatic.columns, ncore::tileColumns(m_nctx) / 2); + ngfx::clearBg(m_nctx, lyr); + ngfx::setBgStatus(m_nctx, lyr, true); + ngfx::setBgCbb(m_nctx, lyr, cbb); + auto const rows = ox::min(m_worldStatic.rows, ngfx::tileRows(m_nctx) / 2); + auto const columns = ox::min(m_worldStatic.columns, ngfx::tileColumns(m_nctx) / 2); for (auto y = 0; y < rows; ++y) { for (auto x = 0; x < columns; ++x) { setupTile(lyr, static_cast(x), static_cast(y)); diff --git a/src/jasper/modules/world/src/worldstatic.cpp b/src/jasper/modules/world/src/worldstatic.cpp index ab202de..27af814 100644 --- a/src/jasper/modules/world/src/worldstatic.cpp +++ b/src/jasper/modules/world/src/worldstatic.cpp @@ -4,7 +4,7 @@ #include -#include +#include #include #include @@ -20,7 +20,7 @@ static void ensureInVec(ox::Vector &vec, ox::FileAddress const& // If the root subsheet is not a leaf node, it will return the // tile count of the first leaf node that it finds. [[nodiscard]] -static uint8_t subsheetTileCnt(ncore::TileSheet::SubSheet const&ss) noexcept { +static uint8_t subsheetTileCnt(ngfx::TileSheet::SubSheet const&ss) noexcept { if (ss.subsheets.empty()) { return static_cast(ss.size()); } @@ -148,14 +148,14 @@ ox::Result WorldStaticLoader::setupTileResrc(DocObjRef const&docObjRef) if (obj == objSet->objects.end()) { return ox::Error{obj == objSet->objects.end(), "could not find WorldObject in WorldObjectSet"}; } - OX_REQUIRE(ts, keel::readObj(m_kctx, objSet->tilesheet)); + OX_REQUIRE(ts, keel::readObj(m_kctx, objSet->tilesheet)); OX_REQUIRE(tsIdx, ox::findIdx( m_worldStatic.tilesheets.begin(), m_worldStatic.tilesheets.end(), objSet->tilesheet).to()); - auto const subsheetOffset = ncore::getTileIdx(*ts, obj->subsheetId); + auto const subsheetOffset = ngfx::getTileIdx(*ts, obj->subsheetId); if (!subsheetOffset) { return ox::Error{1, "invalid subsheet idx"}; } - auto const subsheet = ncore::getSubsheet(*ts, obj->subsheetId); + auto const subsheet = ngfx::getSubsheet(*ts, obj->subsheetId); if (!subsheet) { return ox::Error{1, "could not find subsheet"}; } diff --git a/src/jasper/player/app.cpp b/src/jasper/player/app.cpp index 0d0ced4..8cf3465 100644 --- a/src/jasper/player/app.cpp +++ b/src/jasper/player/app.cpp @@ -8,12 +8,12 @@ #include #include -#include +#include #include #include -namespace ncore = nostalgia::core; +namespace ngfx = nostalgia::gfx; using namespace jasper; @@ -27,7 +27,7 @@ ox::Error run( auto &kctx = keelCtx(*tctx); OX_REQUIRE(bootfile, keel::readObj(kctx, "/Bootfile")); oxOut("Jasper Player\n"); - OX_REQUIRE(nctx, ncore::init(*tctx)); + OX_REQUIRE(nctx, ngfx::init(*tctx)); auto const&worldPath = *bootfile->args.at(0).unwrap(); OX_REQUIRE(worldStatic, readObj(kctx, worldPath)); world::World world(*nctx, *worldStatic);