[nostalgia] Make core::init take FileSystem and return Context, add core::setWindowTitle

This commit is contained in:
2021-07-18 15:28:09 -05:00
parent 2d3602fd05
commit 643239e104
10 changed files with 38 additions and 17 deletions
+6 -4
View File
@@ -37,15 +37,17 @@ static void handleGlfwKeyEvent(GLFWwindow *window, int key, int, int action, int
}
}
ox::Error init(Context *ctx) noexcept {
ox::Result<Context> init(ox::FileSystem *fs) noexcept {
Context ctx;
ctx.rom = fs;
const auto id = new GlfwImplData;
ctx->setWindowerData(id);
ctx.setWindowerData(id);
using namespace std::chrono;
id->startTime = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
glfwInit();
oxReturnError(initGfx(ctx));
oxReturnError(initGfx(&ctx));
glfwSetKeyCallback(id->window, handleGlfwKeyEvent);
return OxError(0);
return ctx;
}
ox::Error run(Context *ctx) noexcept {