[studio] Move task runner to draw call
All checks were successful
Build / build (push) Successful in 2m33s
All checks were successful
Build / build (push) Successful in 2m33s
This commit is contained in:
parent
fd4619bc25
commit
5e90f8d454
@ -28,12 +28,6 @@ class StudioUIDrawer: public turbine::gl::Drawer {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int updateHandler(turbine::Context &ctx) noexcept {
|
|
||||||
auto sctx = turbine::applicationData<studio::StudioContext>(ctx);
|
|
||||||
sctx->ui.update();
|
|
||||||
return 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void keyEventHandler(turbine::Context &ctx, turbine::Key key, bool down) noexcept {
|
static void keyEventHandler(turbine::Context &ctx, turbine::Key key, bool down) noexcept {
|
||||||
auto sctx = turbine::applicationData<studio::StudioContext>(ctx);
|
auto sctx = turbine::applicationData<studio::StudioContext>(ctx);
|
||||||
sctx->ui.handleKeyEvent(key, down);
|
sctx->ui.handleKeyEvent(key, down);
|
||||||
@ -45,7 +39,6 @@ static ox::Error runApp(
|
|||||||
ox::UPtr<ox::FileSystem> &&fs) noexcept {
|
ox::UPtr<ox::FileSystem> &&fs) noexcept {
|
||||||
oxRequireM(ctx, turbine::init(std::move(fs), appName));
|
oxRequireM(ctx, turbine::init(std::move(fs), appName));
|
||||||
turbine::setWindowTitle(*ctx, keelCtx(*ctx).appName);
|
turbine::setWindowTitle(*ctx, keelCtx(*ctx).appName);
|
||||||
turbine::setUpdateHandler(*ctx, updateHandler);
|
|
||||||
turbine::setKeyEventHandler(*ctx, keyEventHandler);
|
turbine::setKeyEventHandler(*ctx, keyEventHandler);
|
||||||
turbine::setRefreshWithin(*ctx, 0);
|
turbine::setRefreshWithin(*ctx, 0);
|
||||||
StudioUI ui(*ctx, projectDataDir);
|
StudioUI ui(*ctx, projectDataDir);
|
||||||
|
@ -78,10 +78,6 @@ StudioUI::StudioUI(turbine::Context &ctx, ox::StringView projectDataDir) noexcep
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StudioUI::update() noexcept {
|
|
||||||
m_taskRunner.update(m_ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
void StudioUI::handleKeyEvent(turbine::Key key, bool down) noexcept {
|
void StudioUI::handleKeyEvent(turbine::Key key, bool down) noexcept {
|
||||||
for (auto p : m_popups) {
|
for (auto p : m_popups) {
|
||||||
if (p->isOpen()) {
|
if (p->isOpen()) {
|
||||||
@ -124,6 +120,7 @@ void StudioUI::draw() noexcept {
|
|||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
handleKeyInput();
|
handleKeyInput();
|
||||||
|
m_taskRunner.update(m_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StudioUI::drawMenu() noexcept {
|
void StudioUI::drawMenu() noexcept {
|
||||||
|
@ -50,8 +50,6 @@ class StudioUI: public ox::SignalHandler {
|
|||||||
public:
|
public:
|
||||||
explicit StudioUI(turbine::Context &ctx, ox::StringView projectDataDir) noexcept;
|
explicit StudioUI(turbine::Context &ctx, ox::StringView projectDataDir) noexcept;
|
||||||
|
|
||||||
void update() noexcept;
|
|
||||||
|
|
||||||
void handleKeyEvent(turbine::Key, bool down) noexcept;
|
void handleKeyEvent(turbine::Key, bool down) noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user