Browse Source

Small cleanup in examples, fix nanovg not showing contents

pull/1/head
falkTX 6 years ago
parent
commit
c689fa6baf
6 changed files with 23 additions and 18 deletions
  1. +1
    -1
      dpf
  2. +1
    -1
      examples/demo-multi.cpp
  3. +13
    -8
      examples/demo.cpp
  4. +2
    -2
      examples/nanovg.cpp
  5. +2
    -2
      examples/nanovg2.cpp
  6. +4
    -4
      examples/nanovg_res/demo.c

+ 1
- 1
dpf

@@ -1 +1 @@
Subproject commit 8e747ec0d573d66396a4f81dbc7a167964494e07
Subproject commit d49366db694fb9097210ba9665449f6a67025285

+ 1
- 1
examples/demo-multi.cpp View File

@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2015 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2018 Filipe Coelho <falktx@falktx.com>
*
* 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


+ 13
- 8
examples/demo.cpp View File

@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2015 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2018 Filipe Coelho <falktx@falktx.com>
*
* 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
@@ -319,6 +319,8 @@ class DemoWindow : public Window,
public LeftSideWidget::Callback
{
public:
static const int kSidebarWidth = 81;

DemoWindow(Application& app)
: Window(app),
wColor(*this),
@@ -338,11 +340,11 @@ public:
wText.hide();
//wPerf.hide();

wColor.setAbsoluteX(81);
wImages.setAbsoluteX(81);
wRects.setAbsoluteX(81);
wShapes.setAbsoluteX(81);
wText.setAbsoluteX(81);
wColor.setAbsoluteX(kSidebarWidth);
wImages.setAbsoluteX(kSidebarWidth);
wRects.setAbsoluteX(kSidebarWidth);
wShapes.setAbsoluteX(kSidebarWidth);
wText.setAbsoluteX(kSidebarWidth);
wLeft.setAbsolutePos(2, 2);
wPerf.setAbsoluteY(5);

@@ -354,14 +356,17 @@ public:

void onReshape(uint width, uint height) override
{
Size<uint> size(width-81, height);
if (width < kSidebarWidth)
return;

Size<uint> size(width-kSidebarWidth, height);
wColor.setSize(size);
wImages.setSize(size);
wRects.setSize(size);
wShapes.setSize(size);
wText.setSize(size);

wLeft.setSize(81-4, height-4);
wLeft.setSize(kSidebarWidth-4, height-4);
//wRezHandle.setAbsoluteX(width-wRezHandle.getWidth());
//wRezHandle.setAbsoluteY(height-wRezHandle.getHeight());



+ 2
- 2
examples/nanovg.cpp View File

@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2015 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2018 Filipe Coelho <falktx@falktx.com>
*
* 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
@@ -145,7 +145,7 @@ public:
}

protected:
void onReshape(int width, int height)
void onReshape(uint width, uint height) override
{
fDemo.setSize(width, height);
//fDemo.setAbsolutePos(10, height-fDemo.getHeight()-50);


+ 2
- 2
examples/nanovg2.cpp View File

@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2015 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2018 Filipe Coelho <falktx@falktx.com>
*
* 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
@@ -202,7 +202,7 @@ public:
}

protected:
void onReshape(int width, int height)
void onReshape(uint width, uint height) override
{
fDemo.setSize(width, height);



+ 4
- 4
examples/nanovg_res/demo.c View File

@@ -807,7 +807,7 @@ int loadDemoData(NVGcontext* vg, DemoData* data)

for (i = 0; i < 12; i++) {
char file[128];
snprintf(file, 128, "../example/images/image%d.jpg", i+1);
snprintf(file, 128, "./nanovg_res/images/image%d.jpg", i+1);
data->images[i] = nvgCreateImage(vg, file, 0);
if (data->images[i] == 0) {
printf("Could not load %s.\n", file);
@@ -815,17 +815,17 @@ int loadDemoData(NVGcontext* vg, DemoData* data)
}
}

data->fontIcons = nvgCreateFont(vg, "icons", "../example/entypo.ttf");
data->fontIcons = nvgCreateFont(vg, "icons", "./nanovg_res/entypo.ttf");
if (data->fontIcons == -1) {
printf("Could not add font icons.\n");
return -1;
}
data->fontNormal = nvgCreateFont(vg, "sans", "../example/Roboto-Regular.ttf");
data->fontNormal = nvgCreateFont(vg, "sans", "./nanovg_res/Roboto-Regular.ttf");
if (data->fontNormal == -1) {
printf("Could not add font italic.\n");
return -1;
}
data->fontBold = nvgCreateFont(vg, "sans-bold", "../example/Roboto-Bold.ttf");
data->fontBold = nvgCreateFont(vg, "sans-bold", "./nanovg_res/Roboto-Bold.ttf");
if (data->fontBold == -1) {
printf("Could not add font bold.\n");
return -1;


Loading…
Cancel
Save