[nostalgia] Make core::shutdown return void and add GBA implementation
This commit is contained in:
@@ -56,7 +56,7 @@ class Context {
|
||||
const ox::FileAddress &tilesheetPath,
|
||||
const ox::FileAddress &palettePath) noexcept;
|
||||
friend ox::Error run(Context *ctx) noexcept;
|
||||
friend ox::Error shutdown(Context *ctx) noexcept;
|
||||
friend void shutdown(Context *ctx) noexcept;
|
||||
friend ox::Result<ox::UniquePtr<Context>> init(ox::UniquePtr<ox::FileSystem> fs, const char *appName) noexcept;
|
||||
friend ox::String getClipboardText(Context *ctx) noexcept;
|
||||
friend uint64_t ticksMs(Context *ctx) noexcept;
|
||||
@@ -82,6 +82,8 @@ class Context {
|
||||
AssetManager assetManager;
|
||||
int uninterruptedRefreshes = 3;
|
||||
ox::UniquePtr<BaseClipboardObject> clipboard;
|
||||
#else
|
||||
bool running = true;
|
||||
#endif
|
||||
protected:
|
||||
#ifndef OX_BARE_METAL
|
||||
|
||||
@@ -26,6 +26,6 @@ ox::Error run(Context *ctx) noexcept;
|
||||
[[nodiscard]]
|
||||
uint64_t ticksMs(Context *ctx) noexcept;
|
||||
|
||||
ox::Error shutdown(Context *ctx) noexcept;
|
||||
void shutdown(Context *ctx) noexcept;
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ UpdateHandler g_updateHandler = nullptr;
|
||||
|
||||
ox::Error run(Context *ctx) noexcept {
|
||||
g_wakeupTime = 0;
|
||||
while (1) {
|
||||
while (ctx->running) {
|
||||
if (g_wakeupTime <= g_timerMs && g_updateHandler) {
|
||||
auto sleepTime = g_updateHandler(ctx);
|
||||
if (sleepTime >= 0) {
|
||||
|
||||
@@ -59,4 +59,8 @@ bool buttonDown(Context*, Key k) noexcept {
|
||||
return !(REG_GAMEPAD & (1 << static_cast<int>(k)));
|
||||
}
|
||||
|
||||
void shutdown(Context *ctx) noexcept {
|
||||
ctx->running = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -79,10 +79,9 @@ bool buttonDown(Context *ctx, Key key) noexcept {
|
||||
return (id->keysDown >> static_cast<int>(key)) & 1;
|
||||
}
|
||||
|
||||
ox::Error shutdown(Context *ctx) noexcept {
|
||||
void shutdown(Context *ctx) noexcept {
|
||||
const auto id = ctx->windowerData<GlfwImplData>();
|
||||
glfwSetWindowShouldClose(id->window, true);
|
||||
return OxError(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user