diff --git a/example/demo.c b/example/demo.c index 9c8b40e..e952428 100644 --- a/example/demo.c +++ b/example/demo.c @@ -862,7 +862,7 @@ void updateFPS(struct FPScounter* fps, float frameTime) #define AVG_SIZE 20 -void renderFPS(struct NVGcontext* vg, float x, float y, struct FPScounter* fps, enum FPSRenderStyle style) +void renderFPS(struct NVGcontext* vg, float x, float y, struct FPScounter* fps, enum FPSRenderStyle style, const char* name) { int i, head; float avg, w, h; @@ -930,6 +930,14 @@ void renderFPS(struct NVGcontext* vg, float x, float y, struct FPScounter* fps, nvgFillColor(vg, nvgRGBA(240,240,240,255)); sprintf(str, "%.2f ms", avg * 1000.0f); nvgText(vg, x+w-5,y+h/2, str, NULL); + + if( name ) + { + nvgFontSize(vg, 20.0f); + nvgTextAlign(vg,NVG_ALIGN_LEFT|NVG_ALIGN_MIDDLE); + nvgFillColor(vg, nvgRGBA(240,240,240,160)); + nvgText(vg, x+5,y+h/2, name, NULL); + } } diff --git a/example/demo.h b/example/demo.h index 4689afd..271cc9f 100644 --- a/example/demo.h +++ b/example/demo.h @@ -29,7 +29,7 @@ struct FPScounter void initFPS(struct FPScounter* fps); void updateFPS(struct FPScounter* fps, float frameTime); -void renderFPS(struct NVGcontext* vg, float x, float y, struct FPScounter* fps, enum FPSRenderStyle style ); +void renderFPS(struct NVGcontext* vg, float x, float y, struct FPScounter* fps, enum FPSRenderStyle style, const char* name ); #ifdef __cplusplus } diff --git a/example/example_gl3.c b/example/example_gl3.c index a69679a..83a7411 100644 --- a/example/example_gl3.c +++ b/example/example_gl3.c @@ -159,9 +159,9 @@ int main() nvgBeginFrame(vg, winWidth, winHeight, pxRatio); renderDemo(vg, mx,my, winWidth,winHeight, t, blowup, &data); - renderFPS(vg, 5,5, &fps, RENDER_FPS); - renderFPS(vg, 310,5, &cpuTimes, RENDER_MS); - renderFPS(vg, 615,5, &gpuTimes, RENDER_MS); + renderFPS(vg, 5,5, &fps, RENDER_FPS, NULL ); + renderFPS(vg, 310,5, &cpuTimes, RENDER_MS, "CPU Time"); + renderFPS(vg, 615,5, &gpuTimes, RENDER_MS, "GPU Time"); nvgEndFrame(vg);