[nostalgia/core] Rename customData functions in Context and move them out of Context

This commit is contained in:
2022-02-03 21:06:44 -06:00
parent c7cd54ae52
commit 7459d687b0
5 changed files with 24 additions and 19 deletions

View File

@@ -23,7 +23,7 @@ class StudioUIDrawer: public core::Drawer {
};
static int eventHandler(core::Context *ctx) noexcept {
auto ui = ctx->customData<StudioUI>();
auto ui = core::applicationData<StudioUI>(ctx);
ui->update();
return 16;
}
@@ -32,9 +32,9 @@ static ox::Error run(ox::UniquePtr<ox::FileSystem> fs) noexcept {
oxRequireM(ctx, core::init(std::move(fs), "NostalgiaStudio"));
core::setWindowTitle(ctx.get(), "Nostalgia Studio");
core::setEventHandler(ctx.get(), eventHandler);
auto ui = ox::make_unique<StudioUI>(ctx.get());
StudioUIDrawer drawer(ui.get());
ctx->setCustomData(ui.get());
StudioUI ui(ctx.get());
StudioUIDrawer drawer(&ui);
core::setApplicationData(ctx.get(), &ui);
ctx->drawers.emplace_back(&drawer);
return core::run(ctx.get());
}