[nostalgia] Make core::shutdown return void and add GBA implementation
This commit is contained in:
@@ -9,7 +9,7 @@ using namespace nostalgia;
|
||||
static unsigned spriteX = 72;
|
||||
static unsigned spriteY = 64;
|
||||
|
||||
static int eventHandler(core::Context *ctx) noexcept {
|
||||
static int updateHandler(core::Context *ctx) noexcept {
|
||||
if (core::buttonDown(ctx, core::GamePad_Right)) {
|
||||
spriteX += 2;
|
||||
} else if (core::buttonDown(ctx, core::GamePad_Left)) {
|
||||
@@ -28,6 +28,12 @@ static int eventHandler(core::Context *ctx) noexcept {
|
||||
return 16;
|
||||
}
|
||||
|
||||
static void keyEventHandler(core::Context *ctx, core::Key key, bool down) noexcept {
|
||||
if (down && key == core::Key::Alpha_Q) {
|
||||
core::shutdown(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
ox::Error run(ox::UniquePtr<ox::FileSystem> fs) noexcept {
|
||||
oxRequireM(ctx, core::init(std::move(fs)));
|
||||
constexpr auto TileSheetAddr = "/TileSheets/Charset.ng";
|
||||
@@ -35,7 +41,8 @@ ox::Error run(ox::UniquePtr<ox::FileSystem> fs) noexcept {
|
||||
oxReturnError(core::loadSpriteTileSheet(ctx.get(), 0, TileSheetAddr, PaletteAddr));
|
||||
oxReturnError(core::initConsole(ctx.get()));
|
||||
core::puts(ctx.get(), 10, 9, "DOPENESS!!!");
|
||||
core::setUpdateHandler(ctx.get(), eventHandler);
|
||||
core::setUpdateHandler(ctx.get(), updateHandler);
|
||||
core::setKeyEventHandler(ctx.get(), keyEventHandler);
|
||||
return core::run(ctx.get());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user