Squashed 'deps/nostalgia/' changes from 830f8fe3..672b92b3
672b92b3 [nostalgia/gfx/studio] Remove accidental version tag in default Palette 762a6517 [nostalgia] Rename core to gfx d141154a Merge commit '38777cfac8868b3628332090260710d5ac26aba0' 6170647c [nostalgia,studio] Proper fix for input filtering 48e45c7d [studio] Cleanup 5d3d9229 [nostalgia/core/studio/paletteeditor] Ignore keyboard input when popup is open d54e93d8 [studio] Cleanup 7b638538 Merge commit '8e0b6ffbabb10f8a6e9ad7e9f07e0ba1d039a02e' 240effd3 Merge commit '7e20f7200963cd0b22f84cc46e10db12b6c13806' f6f2acd6 [nostalgia/core/studio/tilesheeteditor] Add back file type check for palette drop git-subtree-dir: deps/nostalgia git-subtree-split: 672b92b363a2047c4c8ce93fb3d88001a76da35f
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#include <keel/media.hpp>
|
||||
#include <turbine/turbine.hpp>
|
||||
|
||||
#include <nostalgia/core/core.hpp>
|
||||
#include <nostalgia/gfx/core.hpp>
|
||||
#include <nostalgia/scene/scene.hpp>
|
||||
|
||||
using namespace nostalgia;
|
||||
@@ -16,7 +16,7 @@ static bool s_paused = false;
|
||||
|
||||
[[maybe_unused]]
|
||||
static int testUpdateHandler(turbine::Context &tctx) noexcept {
|
||||
auto &cctx = *turbine::applicationData<core::Context>(tctx);
|
||||
auto &cctx = *turbine::applicationData<gfx::Context>(tctx);
|
||||
constexpr auto sleepTime = 16;
|
||||
if (s_paused) {
|
||||
return sleepTime;
|
||||
@@ -41,7 +41,7 @@ static int testUpdateHandler(turbine::Context &tctx) noexcept {
|
||||
constexpr ox::StringView sprites = "nostalgia";
|
||||
for (unsigned i = 0; i < sprites.len(); ++i) {
|
||||
auto const c = static_cast<unsigned>(sprites[i] - ('a' - 1));
|
||||
core::setSprite(cctx, i, {
|
||||
gfx::setSprite(cctx, i, {
|
||||
.enabled = true,
|
||||
.x = spriteX + 8 * (static_cast<int>(i) + 1),
|
||||
.y = spriteY,
|
||||
@@ -67,13 +67,13 @@ static void testKeyEventHandler(turbine::Context &tctx, turbine::Key key, bool d
|
||||
static ox::Error runTest(turbine::Context &tctx) {
|
||||
constexpr ox::StringView TileSheetAddr{"/TileSheets/Charset.ng"};
|
||||
constexpr ox::StringView PaletteAddr{"/Palettes/Chester.npal"};
|
||||
OX_REQUIRE_M(cctx, core::init(tctx));
|
||||
OX_REQUIRE_M(cctx, gfx::init(tctx));
|
||||
turbine::setApplicationData(tctx, cctx.get());
|
||||
OX_REQUIRE(tsStat, turbine::rom(tctx)->stat(PaletteAddr));
|
||||
OX_RETURN_ERROR(core::loadSpriteTileSheet(*cctx, TileSheetAddr));
|
||||
OX_RETURN_ERROR(core::loadSpritePalette(*cctx, PaletteAddr));
|
||||
OX_RETURN_ERROR(core::initConsole(*cctx));
|
||||
core::puts(*cctx, 10, 9, "DOPENESS!!!");
|
||||
OX_RETURN_ERROR(gfx::loadSpriteTileSheet(*cctx, TileSheetAddr));
|
||||
OX_RETURN_ERROR(gfx::loadSpritePalette(*cctx, PaletteAddr));
|
||||
OX_RETURN_ERROR(gfx::initConsole(*cctx));
|
||||
gfx::puts(*cctx, 10, 9, "DOPENESS!!!");
|
||||
turbine::setUpdateHandler(tctx, testUpdateHandler);
|
||||
turbine::setKeyEventHandler(tctx, testKeyEventHandler);
|
||||
return turbine::run(tctx);
|
||||
@@ -85,10 +85,10 @@ static ox::Error runTileSheetSetTest(turbine::Context &tctx) {
|
||||
// this should make the screen display 'ABCDB', with the A being upside down
|
||||
// and the first B being backwards
|
||||
constexpr ox::StringView PaletteAddr{"/Palettes/Charset.npal"};
|
||||
OX_REQUIRE_M(cctx, core::init(tctx));
|
||||
OX_REQUIRE_M(cctx, gfx::init(tctx));
|
||||
turbine::setApplicationData(tctx, cctx.get());
|
||||
OX_REQUIRE(tsStat, turbine::rom(tctx)->stat(PaletteAddr));
|
||||
core::TileSheetSet const set{
|
||||
gfx::TileSheetSet const set{
|
||||
.bpp = 4,
|
||||
.entries = {
|
||||
{ .tilesheet = ox::StringLiteral{"/TileSheets/Chester.ng"}, .sections{{.begin = 0, .tiles = 1}} },
|
||||
@@ -98,23 +98,23 @@ static ox::Error runTileSheetSetTest(turbine::Context &tctx) {
|
||||
},
|
||||
};
|
||||
constexpr auto bgPalBank = 1;
|
||||
OX_RETURN_ERROR(core::loadBgTileSheet(*cctx, 0, set));
|
||||
OX_RETURN_ERROR(core::loadSpriteTileSheet(*cctx, set));
|
||||
OX_RETURN_ERROR(core::loadBgPalette(*cctx, bgPalBank, PaletteAddr));
|
||||
OX_RETURN_ERROR(core::loadBgPalette(*cctx, 0, PaletteAddr));
|
||||
OX_RETURN_ERROR(core::loadSpritePalette(*cctx, PaletteAddr));
|
||||
core::setBgStatus(*cctx, 0, true);
|
||||
core::setBgTile(*cctx, 0, 10, 9, { .tileIdx = 1, .palBank = bgPalBank, .flipX = 0, .flipY = 1 });
|
||||
core::setBgTile(*cctx, 0, 11, 9, { .tileIdx = 2, .palBank = bgPalBank, .flipX = 1, .flipY = 0 });
|
||||
core::setBgTile(*cctx, 0, 13, 9, { .tileIdx = 4, .palBank = bgPalBank, .flipX = 0, .flipY = 0 });
|
||||
core::setSprite(*cctx, 16, {
|
||||
OX_RETURN_ERROR(gfx::loadBgTileSheet(*cctx, 0, set));
|
||||
OX_RETURN_ERROR(gfx::loadSpriteTileSheet(*cctx, set));
|
||||
OX_RETURN_ERROR(gfx::loadBgPalette(*cctx, bgPalBank, PaletteAddr));
|
||||
OX_RETURN_ERROR(gfx::loadBgPalette(*cctx, 0, PaletteAddr));
|
||||
OX_RETURN_ERROR(gfx::loadSpritePalette(*cctx, PaletteAddr));
|
||||
gfx::setBgStatus(*cctx, 0, true);
|
||||
gfx::setBgTile(*cctx, 0, 10, 9, { .tileIdx = 1, .palBank = bgPalBank, .flipX = 0, .flipY = 1 });
|
||||
gfx::setBgTile(*cctx, 0, 11, 9, { .tileIdx = 2, .palBank = bgPalBank, .flipX = 1, .flipY = 0 });
|
||||
gfx::setBgTile(*cctx, 0, 13, 9, { .tileIdx = 4, .palBank = bgPalBank, .flipX = 0, .flipY = 0 });
|
||||
gfx::setSprite(*cctx, 16, {
|
||||
.enabled = true,
|
||||
.x = 12 * 8,
|
||||
.y = 9 * 8,
|
||||
.tileIdx = 3,
|
||||
.bpp = static_cast<unsigned>(set.bpp),
|
||||
});
|
||||
core::setSprite(*cctx, 17, {
|
||||
gfx::setSprite(*cctx, 17, {
|
||||
.enabled = true,
|
||||
.x = 14 * 8,
|
||||
.y = 9 * 8,
|
||||
@@ -148,7 +148,7 @@ static void sceneKeyEventHandler(turbine::Context &tctx, turbine::Key key, bool
|
||||
[[maybe_unused]]
|
||||
static ox::Error runScene(turbine::Context &tctx) {
|
||||
constexpr ox::StringView SceneAddr{"/Scenes/Chester.nscn"};
|
||||
OX_REQUIRE_M(cctx, core::init(tctx));
|
||||
OX_REQUIRE_M(cctx, gfx::init(tctx));
|
||||
OX_REQUIRE(scn, keel::readObj<scene::SceneStatic>(keelCtx(tctx), SceneAddr));
|
||||
turbine::setUpdateHandler(tctx, sceneUpdateHandler);
|
||||
turbine::setKeyEventHandler(tctx, sceneKeyEventHandler);
|
||||
|
||||
Reference in New Issue
Block a user