diff --git a/dpf b/dpf index d1ecc17..3a77a11 160000 --- a/dpf +++ b/dpf @@ -1 +1 @@ -Subproject commit d1ecc17a687cdade92954e548249a7f747aec392 +Subproject commit 3a77a1144f4cb53ded4fb9194eded380bdfa9316 diff --git a/examples/Makefile b/examples/Makefile index 65b9be9..0519892 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -18,7 +18,7 @@ WINDRES ?= windres ifeq ($(WIN32),true) TARGETS = app.exe color.exe demo.exe demo-multi images.exe nanovg.exe rectangles.exe shapes.exe text.exe else -TARGETS = app color demo demo-multi images nanovg nanovg2 rectangles shapes text +TARGETS = app blendish color demo demo-multi images nanovg nanovg2 rectangles shapes text endif # -------------------------------------------------------------- @@ -42,6 +42,9 @@ debug: app: app.cpp ../dpf/dgl/* $(CXX) $< $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -o $@ +blendish: blendish.cpp ../dpf/dgl/* + $(CXX) $< $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -o $@ + color: color.cpp widgets/ExampleColorWidget.hpp ../dpf/dgl/* $(CXX) $< $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -o $@ diff --git a/examples/blendish.cpp b/examples/blendish.cpp new file mode 100644 index 0000000..920cc16 --- /dev/null +++ b/examples/blendish.cpp @@ -0,0 +1,62 @@ +/* + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2015 Filipe Coelho + * + * Permission to use, copy, modify, and/or distribute this software for any purpose with + * or without fee is hereby granted, provided that the above copyright notice and this + * permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD + * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER + * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +// ------------------------------------------------------ +// DGL Stuff + +#include "NanoVG.hpp" +#include "StandaloneWindow.hpp" + +// ------------------------------------------------------ +// use namespace + +using DGL::NanoWidget; +using DGL::StandaloneWindow; +using DGL::Window; + +// ------------------------------------------------------ +// Test + +class TestWidget : public NanoWidget +{ +public: + TestWidget(Window& parent) + : NanoWidget(parent) + { + } + +protected: + void onNanoDisplay() override + { + } +}; + +// ------------------------------------------------------ +// main entry point + +int main() +{ + StandaloneWindow win; + TestWidget w(win); + + win.setSize(500, 500); + win.setTitle("Blendish"); + win.exec(); + + return 0; +} + +// ------------------------------------------------------ diff --git a/examples/demo.cpp b/examples/demo.cpp index aae6370..b72a2e0 100644 --- a/examples/demo.cpp +++ b/examples/demo.cpp @@ -62,7 +62,7 @@ public: curHover(-1) { // for text - font = nvg.createFont("sans", "./nanovg_res/Roboto-Regular.ttf"); + font = nvg.createFontFromFile("sans", "./nanovg_res/Roboto-Regular.ttf"); using namespace DemoArtwork; img1.loadFromMemory(ico1Data, ico1Width, ico1Height, GL_BGR); diff --git a/examples/nanovg2.cpp b/examples/nanovg2.cpp index 326d8e9..18503b2 100644 --- a/examples/nanovg2.cpp +++ b/examples/nanovg2.cpp @@ -55,18 +55,18 @@ public: { char file[128]; std::snprintf(file, 128, "./nanovg_res/images/image%d.jpg", i+1); - fImages[i] = createImage(file, 0); + fImages[i] = createImageFromFile(file, 0); - if (fImages[i] == nullptr) + if (! fImages[i].isValid()) { d_stdout("Could not load %s.", file); return; } } - fFontIcons = createFont("icons", "./nanovg_res/entypo.ttf"); - fFontNormal = createFont("sans", "./nanovg_res/Roboto-Regular.ttf"); - fFontBold = createFont("sans-bold", "./nanovg_res/Roboto-Bold.ttf"); + fFontIcons = createFontFromFile("icons", "./nanovg_res/entypo.ttf"); + fFontNormal = createFontFromFile("sans", "./nanovg_res/Roboto-Regular.ttf"); + fFontBold = createFontFromFile("sans-bold", "./nanovg_res/Roboto-Bold.ttf"); } protected: @@ -123,7 +123,7 @@ protected: private: FontId fFontNormal, fFontBold, fFontIcons; - ScopedPointer fImages[12]; + NanoImage fImages[12]; void drawEyes(float x, float y, float w, float h, float mx, float my, float t) { diff --git a/examples/widgets/ExampleTextWidget.hpp b/examples/widgets/ExampleTextWidget.hpp index 3b80b7c..da59260 100644 --- a/examples/widgets/ExampleTextWidget.hpp +++ b/examples/widgets/ExampleTextWidget.hpp @@ -36,7 +36,7 @@ class ExampleTextWidget : public NanoWidget public: ExampleTextWidget(Window& parent) : NanoWidget(parent), - fFont(createFont("sans", "./nanovg_res/Roboto-Regular.ttf")) + fFont(createFontFromFile("sans", "./nanovg_res/Roboto-Regular.ttf")) { setSize(500, 300); } diff --git a/examples/widgets/NanoPerfWidget.hpp b/examples/widgets/NanoPerfWidget.hpp index 318ff0e..ed117b8 100644 --- a/examples/widgets/NanoPerfWidget.hpp +++ b/examples/widgets/NanoPerfWidget.hpp @@ -118,7 +118,7 @@ public: std::memset(fValues, 0, sizeof(float)*kHistoryCount); - createFont("sans", "./nanovg_res/Roboto-Regular.ttf"); + createFontFromFile("sans", "./nanovg_res/Roboto-Regular.ttf"); prevt = gTime.getTime(); }