Browse Source

Misc

pull/1/head
falkTX 11 years ago
parent
commit
a01b213ea7
2 changed files with 17 additions and 23 deletions
  1. +1
    -1
      dpf
  2. +16
    -22
      examples/nanovg.cpp

+ 1
- 1
dpf

@@ -1 +1 @@
Subproject commit 304054af33b20ddbcdf0e5c87871010e8fc191dc
Subproject commit 5cdf7878a4b9f66f2a00e5a77db2191961d46b59

+ 16
- 22
examples/nanovg.cpp View File

@@ -77,14 +77,14 @@ struct TimePOSIX {
return (uint64_t) tv.tv_sec * (uint64_t) 1000000 + (uint64_t) tv.tv_usec;
}
}

double getTime()
{
return (double)(getRawTime() - base) * resolution;
}
};

static TimePOSIX gTime;

double glfwGetTime()
{
return (double)(gTime.getRawTime() - gTime.base) * gTime.resolution;
}
#endif

// ------------------------------------------------------
@@ -113,6 +113,16 @@ public:
fContext(nullptr)
{
parent.addIdleCallback(this);
// init = false;

initGraph(&fPerf, GRAPH_RENDER_FPS, "Frame Time");

fContext = nvgCreateGL2(512, 512, NVG_ANTIALIAS);
DISTRHO_SAFE_ASSERT_RETURN(fContext != nullptr,);

loadDemoData(fContext, &fData);

prevt = gTime.getTime();
}

~NanoVGExampleWidget() override
@@ -132,28 +142,12 @@ protected:

void onDisplay() override
{
static bool init = true;

if (init)
{
init = false;

initGraph(&fPerf, GRAPH_RENDER_FPS, "Frame Time");

fContext = nvgCreateGL2(512, 512, NVG_ANTIALIAS);
DISTRHO_SAFE_ASSERT_RETURN(fContext != nullptr,);

loadDemoData(fContext, &fData);

prevt = glfwGetTime();
}

const int winWidth = getWidth();
const int winHeight = getHeight();

double t, dt;

t = glfwGetTime();
t = gTime.getTime();
dt = t - prevt;
prevt = t;
updateGraph(&fPerf, dt);


Loading…
Cancel
Save