From a21bf9934e37e000d4a4778f843da9ed0f8755c5 Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 13 Aug 2021 21:53:45 +0100 Subject: [PATCH] Add host scale factor text to d_info gui --- examples/Info/InfoExampleUI.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/examples/Info/InfoExampleUI.cpp b/examples/Info/InfoExampleUI.cpp index cd5b9bc5..d0ef002c 100644 --- a/examples/Info/InfoExampleUI.cpp +++ b/examples/Info/InfoExampleUI.cpp @@ -35,6 +35,7 @@ public: fSampleRate(getSampleRate()), fResizable(isResizable()), fScale(1.0f), + fScaleFactor(getScaleFactor()), fResizeHandle(this) { std::memset(fParameters, 0, sizeof(float)*kParameterCount); @@ -139,6 +140,11 @@ protected: drawRight(x, y, fResizable ? "Yes" : "No", 40); y+=lineHeight; + // host scale factor + drawLeft(x, y, "Host scale factor:", 20); + drawRight(x, y, getTextBufFloat(fScaleFactor), 40); + y+=lineHeight; + // BBT x = 200.0f * fScale; y = 15.0f * fScale; @@ -191,6 +197,11 @@ protected: UI::onResize(ev); } + void uiScaleFactorChanged(const double scaleFactor) override + { + fScaleFactor = scaleFactor; + } + // ------------------------------------------------------------------------------------------------------- private: @@ -200,7 +211,8 @@ private: // UI stuff bool fResizable; - float fScale; + float fScale; // our internal scaling + double fScaleFactor; // host reported scale factor ResizeHandle fResizeHandle; // temp buf for text