diff --git a/opengl/LVGL.cpp b/opengl/LVGL.cpp index 814f1a1..d1962ee 100644 --- a/opengl/LVGL.cpp +++ b/opengl/LVGL.cpp @@ -21,8 +21,6 @@ #include "../distrho/extra/Sleep.hpp" #include "../distrho/extra/Time.hpp" -#include "demos/lv_demos.h" - START_NAMESPACE_DGL // -------------------------------------------------------------------------------------------------------------------- @@ -530,14 +528,6 @@ void LVGLWidget::onResize(const Widget::ResizeEvent& event) lv_global = lvglData->global; lv_display_set_resolution(lvglData->display, width, height); lv_refr_now(lvglData->display); - - // TESTING - static bool testing = true; - if (testing) - { - testing = false; - lv_demo_widgets(); - } } // -------------------------------------------------------------------------------------------------------------------- diff --git a/tests/lvgl/lv_conf.h b/tests/lvgl/lv_conf.h index 51bb9cc..6592f41 100644 --- a/tests/lvgl/lv_conf.h +++ b/tests/lvgl/lv_conf.h @@ -400,10 +400,10 @@ *https://fonts.google.com/specimen/Montserrat*/ #define LV_FONT_MONTSERRAT_8 0 #define LV_FONT_MONTSERRAT_10 0 -#define LV_FONT_MONTSERRAT_12 0 +#define LV_FONT_MONTSERRAT_12 1 #define LV_FONT_MONTSERRAT_14 1 #define LV_FONT_MONTSERRAT_16 1 -#define LV_FONT_MONTSERRAT_18 0 +#define LV_FONT_MONTSERRAT_18 1 #define LV_FONT_MONTSERRAT_20 0 #define LV_FONT_MONTSERRAT_22 1 #define LV_FONT_MONTSERRAT_24 1 diff --git a/tests/lvgl/lvgl.cpp b/tests/lvgl/lvgl.cpp index b8d1710..dd206b2 100644 --- a/tests/lvgl/lvgl.cpp +++ b/tests/lvgl/lvgl.cpp @@ -5,6 +5,21 @@ #include "../../generic/ResizeHandle.hpp" #include "../../opengl/LVGL.hpp" +#include "demos/lv_demos.h" + +class LVGLDemo : public LVGLWidget +{ +public: + LVGLDemo(Window& window) + : LVGLWidget(window) {} + + // delay setup after window size has been set + void setup() + { + lv_demo_widgets(); + } +}; + class DemoWindow : public StandaloneWindow { static const uint kMarginBase = 8; @@ -13,14 +28,16 @@ class DemoWindow : public StandaloneWindow static const uint kMinWindowWidth = 1000; static const uint kMinWindowHeight = 600; - // ResizeHandle resizeHandle; - LVGLWidget lvgl; + LVGLDemo lvgl; + ResizeHandle resizeHandle; + + bool widgetsDone = false; public: DemoWindow(Application& app) : StandaloneWindow(app), - // resizeHandle(this), - lvgl(this) + lvgl((Window&)*this), + resizeHandle(this) { const double scaleFactor = getScaleFactor(); const uint margin = kMarginContent * scaleFactor; @@ -29,6 +46,8 @@ class DemoWindow : public StandaloneWindow setSize(kMinWindowWidth * scaleFactor, kMinWindowHeight * scaleFactor); setResizable(true); setTitle("LVGL Widgets Demo"); + + lvgl.setup(); } protected: