diff --git a/src/nostalgia/modules/core/include/nostalgia/core/gfx.hpp b/src/nostalgia/modules/core/include/nostalgia/core/gfx.hpp index c8c8ed77..e5f32bef 100644 --- a/src/nostalgia/modules/core/include/nostalgia/core/gfx.hpp +++ b/src/nostalgia/modules/core/include/nostalgia/core/gfx.hpp @@ -142,6 +142,10 @@ ox::Error loadBgTileSheet( unsigned cbb, TileSheetSet const&set) noexcept; +void clearCbb(Context &ctx, unsigned cbb) noexcept; + +void clearCbbs(Context &ctx) noexcept; + ox::Error loadBgTileSheet( Context &ctx, unsigned cbb, diff --git a/src/nostalgia/modules/core/include/nostalgia/core/studio.hpp b/src/nostalgia/modules/core/include/nostalgia/core/studio.hpp new file mode 100644 index 00000000..0e6ad2ce --- /dev/null +++ b/src/nostalgia/modules/core/include/nostalgia/core/studio.hpp @@ -0,0 +1,11 @@ +/* + * Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved. + */ + +#pragma once + +#include + +namespace nostalgia::core { + +} diff --git a/src/nostalgia/modules/core/include/nostalgia/core/tilesheet.hpp b/src/nostalgia/modules/core/include/nostalgia/core/tilesheet.hpp index f31a7d18..6348903a 100644 --- a/src/nostalgia/modules/core/include/nostalgia/core/tilesheet.hpp +++ b/src/nostalgia/modules/core/include/nostalgia/core/tilesheet.hpp @@ -18,6 +18,23 @@ 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 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 struct TileSheetV1 { static constexpr auto TypeName = "net.drinkingtea.nostalgia.core.NostalgiaGraphic"; diff --git a/src/nostalgia/modules/core/src/gba/gfx.cpp b/src/nostalgia/modules/core/src/gba/gfx.cpp index 3d58ce57..eac447b0 100644 --- a/src/nostalgia/modules/core/src/gba/gfx.cpp +++ b/src/nostalgia/modules/core/src/gba/gfx.cpp @@ -63,6 +63,19 @@ ox::Error loadSpritePalette( 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( Context &ctx, ox::Span tileMapTargetMem, diff --git a/src/nostalgia/modules/core/src/opengl/gfx.cpp b/src/nostalgia/modules/core/src/opengl/gfx.cpp index 686b8782..baadfef4 100644 --- a/src/nostalgia/modules/core/src/opengl/gfx.cpp +++ b/src/nostalgia/modules/core/src/opengl/gfx.cpp @@ -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( Context &ctx, unsigned const cbb,