[nostalgia/core] Add clearCbb functions
All checks were successful
Build / build (push) Successful in 3m12s
All checks were successful
Build / build (push) Successful in 3m12s
This commit is contained in:
parent
ce9a0b1fdb
commit
8764444758
@ -142,6 +142,10 @@ ox::Error loadBgTileSheet(
|
|||||||
unsigned cbb,
|
unsigned cbb,
|
||||||
TileSheetSet const&set) noexcept;
|
TileSheetSet const&set) noexcept;
|
||||||
|
|
||||||
|
void clearCbb(Context &ctx, unsigned cbb) noexcept;
|
||||||
|
|
||||||
|
void clearCbbs(Context &ctx) noexcept;
|
||||||
|
|
||||||
ox::Error loadBgTileSheet(
|
ox::Error loadBgTileSheet(
|
||||||
Context &ctx,
|
Context &ctx,
|
||||||
unsigned cbb,
|
unsigned cbb,
|
||||||
|
11
src/nostalgia/modules/core/include/nostalgia/core/studio.hpp
Normal file
11
src/nostalgia/modules/core/include/nostalgia/core/studio.hpp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <studio/studio.hpp>
|
||||||
|
|
||||||
|
namespace nostalgia::core {
|
||||||
|
|
||||||
|
}
|
@ -18,6 +18,23 @@
|
|||||||
|
|
||||||
namespace nostalgia::core {
|
namespace nostalgia::core {
|
||||||
|
|
||||||
|
struct SubSheetTemplate {
|
||||||
|
static constexpr auto TypeName = "net.drinkingtea.nostalgia.gfx.SubSheetTemplate";
|
||||||
|
static constexpr auto TypeVersion = 1;
|
||||||
|
ox::String name;
|
||||||
|
int32_t width{};
|
||||||
|
int32_t height{};
|
||||||
|
ox::Vector<SubSheetTemplate> subsheets;
|
||||||
|
};
|
||||||
|
|
||||||
|
OX_MODEL_BEGIN(SubSheetTemplate)
|
||||||
|
OX_MODEL_FIELD(name)
|
||||||
|
OX_MODEL_FIELD(width)
|
||||||
|
OX_MODEL_FIELD(height)
|
||||||
|
OX_MODEL_FIELD(subsheets)
|
||||||
|
OX_MODEL_END()
|
||||||
|
|
||||||
|
|
||||||
// Predecessor to TileSheet, kept for backward compatibility
|
// Predecessor to TileSheet, kept for backward compatibility
|
||||||
struct TileSheetV1 {
|
struct TileSheetV1 {
|
||||||
static constexpr auto TypeName = "net.drinkingtea.nostalgia.core.NostalgiaGraphic";
|
static constexpr auto TypeName = "net.drinkingtea.nostalgia.core.NostalgiaGraphic";
|
||||||
|
@ -63,6 +63,19 @@ ox::Error loadSpritePalette(
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clearCbb(Context&, unsigned const cbb) noexcept {
|
||||||
|
for (auto &v : MEM_BG_TILES[cbb]) {
|
||||||
|
v = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearCbbs(Context &ctx) noexcept {
|
||||||
|
clearCbb(ctx, 0);
|
||||||
|
clearCbb(ctx, 1);
|
||||||
|
clearCbb(ctx, 2);
|
||||||
|
clearCbb(ctx, 3);
|
||||||
|
}
|
||||||
|
|
||||||
static ox::Error loadTileSheetSet(
|
static ox::Error loadTileSheetSet(
|
||||||
Context &ctx,
|
Context &ctx,
|
||||||
ox::Span<uint16_t> tileMapTargetMem,
|
ox::Span<uint16_t> tileMapTargetMem,
|
||||||
|
@ -586,6 +586,18 @@ static void copyPixels(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clearCbb(Context &ctx, unsigned const cbb) noexcept {
|
||||||
|
for (auto &v : ctx.cbbs[cbb].pixels) {
|
||||||
|
v = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearCbbs(Context &ctx) noexcept {
|
||||||
|
for (unsigned i = 0 ; i < ctx.cbbs.size(); ++i) {
|
||||||
|
clearCbb(ctx, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ox::Error loadBgTileSheet(
|
ox::Error loadBgTileSheet(
|
||||||
Context &ctx,
|
Context &ctx,
|
||||||
unsigned const cbb,
|
unsigned const cbb,
|
||||||
|
Loading…
Reference in New Issue
Block a user