[nostalgia/core] Cleanup graphics API

This commit is contained in:
2023-12-21 21:18:31 -06:00
parent 8395128efa
commit d29118d783
8 changed files with 268 additions and 288 deletions

View File

@@ -17,8 +17,8 @@ ox::Error Scene::setupDisplay(core::Context &ctx) const noexcept {
return OxError(1, "Scene has no palettes");
}
auto const&palette = m_sceneStatic.palettes[0];
oxReturnError(core::loadBgTileSheet(
ctx, 0, m_sceneStatic.tilesheet, palette));
oxReturnError(core::loadBgTileSheet(ctx, 0, m_sceneStatic.tilesheet));
oxReturnError(core::loadBgPalette(ctx, palette));
// disable all backgrounds
core::setBgStatus(ctx, 0);
for (auto layerNo = 0u; auto const&layer : m_sceneStatic.tileMapIdx) {
@@ -39,10 +39,10 @@ void Scene::setupLayer(
const auto width = m_sceneStatic.rows[layerNo];
for (auto const&tile : layer) {
const auto tile8 = static_cast<uint8_t>(tile);
core::setTile(ctx, layerNo, x, y, tile8);
core::setTile(ctx, layerNo, x + 1, y, tile8 + 1);
core::setTile(ctx, layerNo, x, y + 1, tile8 + 2);
core::setTile(ctx, layerNo, x + 1, y + 1, tile8 + 3);
core::setBgTile(ctx, layerNo, x, y, tile8);
core::setBgTile(ctx, layerNo, x + 1, y, tile8 + 1);
core::setBgTile(ctx, layerNo, x, y + 1, tile8 + 2);
core::setBgTile(ctx, layerNo, x + 1, y + 1, tile8 + 3);
x += 2;
if (x >= width * 2) {
x = 0;