Compare commits
No commits in common. "056284c8579b1b51c67e1a889a59dc9f714b0e40" and "8fa47e961d0d3aa38b29cb431a7f2c2eaaf70f7b" have entirely different histories.
056284c857
...
8fa47e961d
6
.gitignore
vendored
6
.gitignore
vendored
@ -4,7 +4,6 @@
|
|||||||
.conanbuild
|
.conanbuild
|
||||||
.mypy_cache
|
.mypy_cache
|
||||||
.stfolder
|
.stfolder
|
||||||
.stignore
|
|
||||||
scripts/__pycache__
|
scripts/__pycache__
|
||||||
CMakeLists.txt.user
|
CMakeLists.txt.user
|
||||||
ROM.oxfs
|
ROM.oxfs
|
||||||
@ -14,7 +13,8 @@ compile_commands.json
|
|||||||
dist
|
dist
|
||||||
graph_info.json
|
graph_info.json
|
||||||
imgui.ini
|
imgui.ini
|
||||||
*.gba
|
nostalgia.gba
|
||||||
*.sav
|
nostalgia.sav
|
||||||
|
nostalgia_media.oxfs
|
||||||
studio_state.json
|
studio_state.json
|
||||||
tags
|
tags
|
||||||
|
@ -1 +1 @@
|
|||||||
K1;14fc3dd8-42ff-4bf9-81f1-a010cc5ac251;M2;net.drinkingtea.nostalgia.core.Palette;1;ûÿ³Ö>
|
K1;14fc3dd8-42ff-4bf9-81f1-a010cc5ac251;M2;net.drinkingtea.nostalgia.core.Palette;1;ûÿ³Ö
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -10,11 +10,10 @@
|
|||||||
|
|
||||||
using namespace nostalgia;
|
using namespace nostalgia;
|
||||||
|
|
||||||
static int spriteX{};
|
|
||||||
static int spriteY{};
|
|
||||||
static bool s_paused = false;
|
static bool s_paused = false;
|
||||||
|
static ox::Optional<scene::Scene> s_scene;
|
||||||
|
|
||||||
static int sceneUpdateHandler(turbine::Context&) noexcept {
|
static int updateHandler(turbine::Context&) noexcept {
|
||||||
constexpr auto sleepTime = 16;
|
constexpr auto sleepTime = 16;
|
||||||
if (s_paused) {
|
if (s_paused) {
|
||||||
return sleepTime;
|
return sleepTime;
|
||||||
@ -23,7 +22,7 @@ static int sceneUpdateHandler(turbine::Context&) noexcept {
|
|||||||
return sleepTime;
|
return sleepTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sceneKeyEventHandler(turbine::Context &tctx, turbine::Key key, bool down) noexcept {
|
static void keyEventHandler(turbine::Context &tctx, turbine::Key key, bool down) noexcept {
|
||||||
if (down) {
|
if (down) {
|
||||||
if (key == turbine::Key::Alpha_Q) {
|
if (key == turbine::Key::Alpha_Q) {
|
||||||
turbine::requestShutdown(tctx);
|
turbine::requestShutdown(tctx);
|
||||||
@ -33,87 +32,14 @@ static void sceneKeyEventHandler(turbine::Context &tctx, turbine::Key key, bool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[[maybe_unused]]
|
|
||||||
static int testUpdateHandler(turbine::Context &tctx) noexcept {
|
|
||||||
auto &cctx = *turbine::applicationData<core::Context>(tctx);
|
|
||||||
constexpr auto sleepTime = 16;
|
|
||||||
if (s_paused) {
|
|
||||||
return sleepTime;
|
|
||||||
}
|
|
||||||
int xmod = 0;
|
|
||||||
int ymod = 0;
|
|
||||||
if (buttonDown(tctx, turbine::Alpha_D) || buttonDown(tctx, turbine::GamePad_Right)) {
|
|
||||||
xmod = 2;
|
|
||||||
} else if (buttonDown(tctx, turbine::Alpha_A) || buttonDown(tctx, turbine::GamePad_Left)) {
|
|
||||||
xmod = -2;
|
|
||||||
}
|
|
||||||
if (buttonDown(tctx, turbine::Alpha_S) || buttonDown(tctx, turbine::GamePad_Down)) {
|
|
||||||
ymod = 2;
|
|
||||||
} else if (buttonDown(tctx, turbine::Alpha_W) || buttonDown(tctx, turbine::GamePad_Up)) {
|
|
||||||
ymod = -2;
|
|
||||||
}
|
|
||||||
if (!xmod && !ymod) {
|
|
||||||
spriteX += 1;
|
|
||||||
}
|
|
||||||
spriteX += xmod;
|
|
||||||
spriteY += ymod;
|
|
||||||
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, {
|
|
||||||
.enabled = true,
|
|
||||||
.x = spriteX + 8 * (static_cast<int>(i) + 1),
|
|
||||||
.y = spriteY,
|
|
||||||
.tileIdx = c,
|
|
||||||
.priority = 1,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return sleepTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[maybe_unused]]
|
|
||||||
static void testKeyEventHandler(turbine::Context &tctx, turbine::Key key, bool down) noexcept {
|
|
||||||
if (down) {
|
|
||||||
if (key == turbine::Key::Alpha_Q) {
|
|
||||||
turbine::requestShutdown(tctx);
|
|
||||||
} else if (key == turbine::Key::Alpha_P) {
|
|
||||||
s_paused = !s_paused;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[[maybe_unused]]
|
|
||||||
static ox::Error runTest(turbine::Context &tctx) {
|
|
||||||
constexpr ox::FileAddress TileSheetAddr = ox::StringLiteral("/TileSheets/Charset.ng");
|
|
||||||
constexpr ox::FileAddress PaletteAddr = ox::StringLiteral("/Palettes/Chester.npal");
|
|
||||||
oxRequireM(cctx, core::init(tctx));
|
|
||||||
turbine::setApplicationData(tctx, cctx.get());
|
|
||||||
oxRequire(tsStat, turbine::rom(tctx)->stat(PaletteAddr));
|
|
||||||
oxReturnError(core::loadSpriteTileSheet(*cctx, TileSheetAddr, PaletteAddr));
|
|
||||||
oxReturnError(core::initConsole(*cctx));
|
|
||||||
core::puts(*cctx, 10, 9, "DOPENESS!!!");
|
|
||||||
turbine::setUpdateHandler(tctx, testUpdateHandler);
|
|
||||||
turbine::setKeyEventHandler(tctx, testKeyEventHandler);
|
|
||||||
//core::setBgStatus(*cctx, 1, true);
|
|
||||||
//core::setBgStatus(*cctx, 2, true);
|
|
||||||
//core::setBgStatus(*cctx, 3, true);
|
|
||||||
return turbine::run(tctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
[[maybe_unused]]
|
|
||||||
static ox::Error runScene(turbine::Context &tctx) {
|
|
||||||
constexpr ox::FileAddress SceneAddr = ox::StringLiteral("/Scenes/Chester.nscn");
|
|
||||||
oxRequireM(cctx, core::init(tctx));
|
|
||||||
oxRequire(scn, keel::readObj<scene::SceneStatic>(keelCtx(tctx), SceneAddr));
|
|
||||||
turbine::setUpdateHandler(tctx, sceneUpdateHandler);
|
|
||||||
turbine::setKeyEventHandler(tctx, sceneKeyEventHandler);
|
|
||||||
scene::Scene const scene(*scn);
|
|
||||||
oxReturnError(scene.setupDisplay(*cctx));
|
|
||||||
return turbine::run(tctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
ox::Error run(ox::UniquePtr<ox::FileSystem> &&fs) noexcept {
|
ox::Error run(ox::UniquePtr<ox::FileSystem> &&fs) noexcept {
|
||||||
oxRequireM(tctx, turbine::init(std::move(fs), "Nostalgia"));
|
oxRequireM(tctx, turbine::init(std::move(fs), "Nostalgia"));
|
||||||
return runTest(*tctx);
|
oxRequireM(cctx, core::init(*tctx));
|
||||||
|
constexpr ox::FileAddress SceneAddr = ox::StringLiteral("/Scenes/Chester.nscn");
|
||||||
|
oxRequire(scn, keel::readObj<scene::SceneStatic>(keelCtx(*tctx), SceneAddr));
|
||||||
|
turbine::setUpdateHandler(*tctx, updateHandler);
|
||||||
|
turbine::setKeyEventHandler(*tctx, keyEventHandler);
|
||||||
|
s_scene.emplace(*scn);
|
||||||
|
oxReturnError(s_scene->setupDisplay(*cctx));
|
||||||
|
return turbine::run(*tctx);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user