[nostalgia/studio] Add keyboard shortcuts
This commit is contained in:
@@ -23,17 +23,24 @@ class StudioUIDrawer: public core::Drawer {
|
||||
}
|
||||
};
|
||||
|
||||
static int eventHandler(core::Context *ctx) noexcept {
|
||||
static int updateHandler(core::Context *ctx) noexcept {
|
||||
auto sctx = core::applicationData<studio::StudioContext>(ctx);
|
||||
auto ui = dynamic_cast<StudioUI*>(sctx->ui);
|
||||
ui->update();
|
||||
return 16;
|
||||
}
|
||||
|
||||
static void keyEventHandler(core::Context *ctx, core::Key key, bool down) noexcept {
|
||||
auto sctx = core::applicationData<studio::StudioContext>(ctx);
|
||||
auto ui = dynamic_cast<StudioUI*>(sctx->ui);
|
||||
ui->handleKeyEvent(key, down);
|
||||
}
|
||||
|
||||
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::setUpdateHandler(ctx.get(), eventHandler);
|
||||
core::setUpdateHandler(ctx.get(), updateHandler);
|
||||
core::setKeyEventHandler(ctx.get(), keyEventHandler);
|
||||
core::setConstantRefresh(ctx.get(), false);
|
||||
studio::StudioContext studioCtx;
|
||||
core::setApplicationData(ctx.get(), &studioCtx);
|
||||
|
||||
Reference in New Issue
Block a user