[nostalgia/core] Make Context never move

This commit is contained in:
2021-07-18 16:11:23 -05:00
parent 70fd56ce0b
commit bed8c35218
5 changed files with 19 additions and 22 deletions
+5 -5
View File
@@ -37,15 +37,15 @@ static void handleGlfwKeyEvent(GLFWwindow *window, int key, int, int action, int
}
}
ox::Result<Context> init(ox::FileSystem *fs) noexcept {
Context ctx;
ctx.rom = fs;
ox::Result<ox::UniquePtr<Context>> init(ox::FileSystem *fs) noexcept {
auto ctx = ox::make_unique<Context>();
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.get()));
glfwSetKeyCallback(id->window, handleGlfwKeyEvent);
return ctx;
}