diff --git a/dpf b/dpf index 568b765..edf7ceb 160000 --- a/dpf +++ b/dpf @@ -1 +1 @@ -Subproject commit 568b765007958ba86bed1553b7f34dcc1bb2ed3f +Subproject commit edf7cebc93c6172d45111deb7e52b5df44652ba5 diff --git a/examples/Makefile b/examples/Makefile index dd0fabf..1fa2b38 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -16,9 +16,9 @@ WINDRES ?= windres # -------------------------------------------------------------- ifeq ($(WIN32),true) -TARGETS = app.exe color.exe demo.exe images.exe nanovg.exe rectangles.exe shapes.exe +TARGETS = app.exe color.exe demo.exe images.exe nanovg.exe rectangles.exe shapes.exe text.exe else -TARGETS = app color demo images nanovg rectangles shapes +TARGETS = app color demo images nanovg rectangles shapes text endif # -------------------------------------------------------------- @@ -71,9 +71,6 @@ cairo: cairo.cpp ../dpf/dgl/* qt-embed: qt-embed.cpp ../dpf/dgl/* $(CXX) $< $(BUILD_CXX_FLAGS) $(shell pkg-config --cflags --libs QtCore QtGui) $(LINK_FLAGS) -o $@ -text: text.cpp ../dpf/dgl/* - $(CXX) $< $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -o $@ - # -------------------------------------------------------------- %.exe: %.cpp win32/distrho.o diff --git a/examples/demo.cpp b/examples/demo.cpp index 21c9242..b874c1b 100644 --- a/examples/demo.cpp +++ b/examples/demo.cpp @@ -23,6 +23,7 @@ #include "widgets/ExampleImagesWidget.hpp" #include "widgets/ExampleRectanglesWidget.hpp" #include "widgets/ExampleShapesWidget.hpp" +#include "widgets/ExampleTextWidget.hpp" // ------------------------------------------------------ // Images @@ -44,6 +45,8 @@ using DGL::Size; class LeftSideWidget : public Widget { public: + static const int kPageCount = 5; + class Callback { public: @@ -62,6 +65,7 @@ public: img2.loadFromMemory(ico2Data, ico2Width, ico2Height, GL_BGR); img3.loadFromMemory(ico3Data, ico3Width, ico2Height, GL_BGR); img4.loadFromMemory(ico4Data, ico4Width, ico4Height, GL_BGR); + //img5.loadFromMemory(ico5Data, ico5Width, ico5Height, GL_BGR); } protected: @@ -104,6 +108,7 @@ protected: img2.drawAt(pad, pad + 1 + iconSize); img3.drawAt(pad, pad + 2 + iconSize*2); img4.drawAt(pad, pad + 3 + iconSize*3); + //img5.drawAt(pad, pad + 3 + iconSize*3); } bool onMouse(const MouseEvent& ev) override @@ -115,7 +120,7 @@ protected: const int iconSize = getWidth(); - for (int i=0; i<4; ++i) + for (int i=0; i bg, bgIcon; Line lineSep; - Image img1, img2, img3, img4; + Image img1, img2, img3, img4, img5; }; #if 0 @@ -310,6 +315,7 @@ public: wImages(*this), wRects(*this), wShapes(*this), + wText(*this), wLeft(*this, this), //wRezHandle(*this), curWidget(nullptr) @@ -318,11 +324,13 @@ public: wImages.hide(); wRects.hide(); wShapes.hide(); + wText.hide(); wColor.setAbsoluteX(80); wImages.setAbsoluteX(80); wRects.setAbsoluteX(80); wShapes.setAbsoluteX(80); + wText.setAbsoluteX(80); wLeft.setAbsolutePos(2, 2); setSize(600, 500); @@ -338,6 +346,7 @@ public: wImages.setSize(size); wRects.setSize(size); wShapes.setSize(size); + wText.setSize(size); wLeft.setSize(73, height-4); //wRezHandle.setAbsoluteX(width-wRezHandle.getWidth()); @@ -369,6 +378,10 @@ protected: case 3: curWidget = &wShapes; break; + break; + case 4: + curWidget = &wText; + break; } if (curWidget != nullptr) @@ -380,6 +393,7 @@ private: ExampleImagesWidget wImages; ExampleRectanglesWidget wRects; ExampleShapesWidget wShapes; + ExampleTextWidget wText; LeftSideWidget wLeft; //ResizeHandle wRezHandle; diff --git a/examples/nanovg.cpp b/examples/nanovg.cpp index ba53bf6..8bb4635 100644 --- a/examples/nanovg.cpp +++ b/examples/nanovg.cpp @@ -104,13 +104,12 @@ int my = 0; double prevt = 0; -class NanoExampleWidget : public Widget, - public IdleCallback, - public NanoVG +class NanoExampleWidget : public NanoWidget, + public IdleCallback { public: NanoExampleWidget(Window& parent) - : Widget(parent), + : NanoWidget(parent), fContext(getContext()) { parent.addIdleCallback(this); @@ -136,7 +135,7 @@ protected: repaint(); } - void onDisplay() override + void onNanoDisplay() override { if (fContext == nullptr) return; @@ -158,13 +157,9 @@ protected: glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT); - beginFrame(winWidth, winHeight, premult ? PREMULTIPLIED_ALPHA : STRAIGHT_ALPHA); - renderDemo(fContext, mx, my, winWidth, winHeight, t, blowup, &fData); renderGraph(fContext, 5, 5, &fPerf); - endFrame(); - if (screenshot) { screenshot = 0; diff --git a/examples/widgets/ExampleTextWidget.hpp b/examples/widgets/ExampleTextWidget.hpp index 79f3b64..3824889 100644 --- a/examples/widgets/ExampleTextWidget.hpp +++ b/examples/widgets/ExampleTextWidget.hpp @@ -20,7 +20,7 @@ // ------------------------------------------------------ // DGL Stuff -#include "NanoWidget.hpp" +#include "NanoVG.hpp" // ------------------------------------------------------ // use namespace @@ -42,14 +42,11 @@ public: } protected: - void onDisplay() override + void onNanoDisplay() override { const int width = getWidth(); const int height = getHeight(); - beginFrame(); - save(); - fontSize(40.0f); textAlign(Align(ALIGN_CENTER|ALIGN_MIDDLE)); textLineHeight(20.0f); @@ -61,9 +58,6 @@ protected: fillColor(RGBA(0,0,0,220)); textBox(10, height/2, width-20, "Hello World!", nullptr); - - restore(); - endFrame(); } private: