From 5e8a29038d6de40c38ac5281eb49198b353c497e Mon Sep 17 00:00:00 2001 From: Leonard Ritter Date: Wed, 24 Sep 2014 14:39:18 +0200 Subject: [PATCH] MSVC: disabling warnings example: output frame time --- blendish.h | 2 ++ example.cpp | 12 ++++++++++++ oui.h | 19 +++++++++++-------- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/blendish.h b/blendish.h index 55b537c..4ec120e 100644 --- a/blendish.h +++ b/blendish.h @@ -1089,6 +1089,8 @@ BND_EXPORT NVGcolor bndNodeWireColor(const BNDnodeTheme *theme, BNDwidgetState s #ifdef _MSC_VER #pragma warning (disable: 4996) // Switch off security warnings #pragma warning (disable: 4100) // Switch off unreferenced formal parameter warnings + #pragma warning (disable: 4244) + #pragma warning (disable: 4305) #ifdef __cplusplus #define BND_INLINE inline #else diff --git a/example.cpp b/example.cpp index 5da20bb..a08c7ed 100644 --- a/example.cpp +++ b/example.cpp @@ -1213,6 +1213,9 @@ int main() glfwSetTime(0); + double c = 0.0; + int total = 0; + while (!glfwWindowShouldClose(window)) { double mx, my; @@ -1231,11 +1234,20 @@ int main() glClearColor(0,0,0,1); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT); + double t = glfwGetTime(); nvgBeginFrame(_vg, winWidth, winHeight, pxRatio); draw(_vg, winWidth, winHeight); nvgEndFrame(_vg); + double t2 = glfwGetTime(); + c += (t2 - t); + total++; + if (total > (1*60)) { + printf("%fms\n", (c / (double)total)*1000.0); + total = 0; + c = 0.0; + } glfwSwapBuffers(window); glfwPollEvents(); diff --git a/oui.h b/oui.h index 5af33d9..9cddd1e 100644 --- a/oui.h +++ b/oui.h @@ -678,15 +678,18 @@ OUI_EXPORT short uiGetMarginDown(int item); #include #ifdef _MSC_VER -#pragma warning (disable: 4996) // Switch off security warnings -#pragma warning (disable: 4100) // Switch off unreferenced formal parameter warnings -#ifdef __cplusplus -#define UI_INLINE inline -#else -#define UI_INLINE -#endif + #pragma warning (disable: 4996) // Switch off security warnings + #pragma warning (disable: 4100) // Switch off unreferenced formal parameter warnings + #pragma warning (disable: 4244) + #pragma warning (disable: 4305) + + #ifdef __cplusplus + #define UI_INLINE inline + #else + #define UI_INLINE + #endif #else -#define UI_INLINE inline + #define UI_INLINE inline #endif #define UI_MAX_KIND 16