This commit is contained in:
@@ -74,6 +74,10 @@ class StudioUIDrawer: public turbine::gl::Drawer {
|
|||||||
explicit StudioUIDrawer(StudioUI &ui) noexcept: m_ui(ui) {
|
explicit StudioUIDrawer(StudioUI &ui) noexcept: m_ui(ui) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void preDraw(turbine::Context &) noexcept final {
|
||||||
|
m_ui.preDraw();
|
||||||
|
}
|
||||||
|
|
||||||
void draw(turbine::Context&) noexcept final {
|
void draw(turbine::Context&) noexcept final {
|
||||||
m_ui.draw();
|
m_ui.draw();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,6 @@ using StudioConfig = StudioConfigV2;
|
|||||||
StudioUI::StudioUI(turbine::Context &tctx, ox::StringParam projectDataDir) noexcept:
|
StudioUI::StudioUI(turbine::Context &tctx, ox::StringParam projectDataDir) noexcept:
|
||||||
m_sctx{*this, tctx},
|
m_sctx{*this, tctx},
|
||||||
m_projectDataDir{std::move(projectDataDir)} {
|
m_projectDataDir{std::move(projectDataDir)} {
|
||||||
loadFont();
|
|
||||||
auto &kctx = keelCtx(m_tctx);
|
auto &kctx = keelCtx(m_tctx);
|
||||||
kctx.converters.emplace_back(keel::Converter::make<convertStudioConfigV1ToStudioConfigV2>());
|
kctx.converters.emplace_back(keel::Converter::make<convertStudioConfigV1ToStudioConfigV2>());
|
||||||
oxLogError(headerizeConfigFile<StudioConfigV1>(kctx));
|
oxLogError(headerizeConfigFile<StudioConfigV1>(kctx));
|
||||||
@@ -184,11 +183,14 @@ void StudioUI::handleNavigationChange(ox::StringParam path, ox::StringParam navA
|
|||||||
m_navAction.emplace(std::move(path), std::move(navArgs));
|
m_navAction.emplace(std::move(path), std::move(navArgs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StudioUI::preDraw() noexcept {
|
||||||
|
loadFont();
|
||||||
|
}
|
||||||
|
|
||||||
void StudioUI::draw() noexcept {
|
void StudioUI::draw() noexcept {
|
||||||
if (turbine::isWayland() || ox::defines::OS == ox::OS::Darwin) {
|
if (turbine::isWayland() || ox::defines::OS == ox::OS::Darwin) {
|
||||||
ig::setDpiScale(1.f);
|
ig::setDpiScale(1.f);
|
||||||
} else {
|
} else {
|
||||||
loadFont();
|
|
||||||
ig::setDpiScale(ImGui::GetWindowDpiScale());
|
ig::setDpiScale(ImGui::GetWindowDpiScale());
|
||||||
}
|
}
|
||||||
glutils::clearScreen();
|
glutils::clearScreen();
|
||||||
|
|||||||
@@ -103,6 +103,8 @@ class StudioUI final: public ox::SignalHandler {
|
|||||||
bool handleShutdown() noexcept;
|
bool handleShutdown() noexcept;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void preDraw() noexcept;
|
||||||
|
|
||||||
void draw() noexcept;
|
void draw() noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ namespace gl {
|
|||||||
class Drawer {
|
class Drawer {
|
||||||
public:
|
public:
|
||||||
virtual ~Drawer() = default;
|
virtual ~Drawer() = default;
|
||||||
|
virtual void preDraw(Context&) noexcept {}
|
||||||
virtual void draw(Context&) noexcept = 0;
|
virtual void draw(Context&) noexcept = 0;
|
||||||
};
|
};
|
||||||
void addDrawer(Context &ctx, Drawer *cd) noexcept;
|
void addDrawer(Context &ctx, Drawer *cd) noexcept;
|
||||||
|
|||||||
@@ -235,12 +235,15 @@ void requireRefreshFor(Context &ctx, int ms) noexcept {
|
|||||||
|
|
||||||
static void draw(Context &ctx) noexcept {
|
static void draw(Context &ctx) noexcept {
|
||||||
// draw start
|
// draw start
|
||||||
|
for (auto const d : ctx.drawers) {
|
||||||
|
d->preDraw(ctx);
|
||||||
|
}
|
||||||
#if TURBINE_USE_IMGUI
|
#if TURBINE_USE_IMGUI
|
||||||
ImGui_ImplOpenGL3_NewFrame();
|
ImGui_ImplOpenGL3_NewFrame();
|
||||||
ImGui_ImplGlfw_NewFrame();
|
ImGui_ImplGlfw_NewFrame();
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
#endif
|
#endif
|
||||||
for (auto d : ctx.drawers) {
|
for (auto const d : ctx.drawers) {
|
||||||
d->draw(ctx);
|
d->draw(ctx);
|
||||||
}
|
}
|
||||||
#if TURBINE_USE_IMGUI
|
#if TURBINE_USE_IMGUI
|
||||||
@@ -489,7 +492,9 @@ KeyEventHandler keyEventHandler(Context const &ctx) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float scale(Context const &ctx) noexcept {
|
float scale(Context const &ctx) noexcept {
|
||||||
return ctx.scale;
|
float x{}, y{};
|
||||||
|
glfwGetWindowContentScale(ctx.window, &x, &y);
|
||||||
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isWayland() noexcept {
|
bool isWayland() noexcept {
|
||||||
|
|||||||
Reference in New Issue
Block a user