From c701f583da26d491985649c3eed7961992a591e2 Mon Sep 17 00:00:00 2001 From: Mikko Mononen Date: Sun, 10 Oct 2010 10:14:52 +0000 Subject: [PATCH] Fix for Issue 128 --- RecastDemo/Source/imguiRenderGL.cpp | 5 ++++- RecastDemo/Source/main.cpp | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/RecastDemo/Source/imguiRenderGL.cpp b/RecastDemo/Source/imguiRenderGL.cpp index 809c07b..407d01f 100644 --- a/RecastDemo/Source/imguiRenderGL.cpp +++ b/RecastDemo/Source/imguiRenderGL.cpp @@ -22,6 +22,9 @@ #include "SDL.h" #include "SDL_opengl.h" +// Some math headers don't have PI defined. +static const float PI = 3.14159265f; + void imguifree(void* ptr, void* userptr); void* imguimalloc(size_t size, void* userptr); @@ -235,7 +238,7 @@ bool imguiRenderGLInit(const char* fontpath) { for (int i = 0; i < CIRCLE_VERTS; ++i) { - float a = (float)i/(float)CIRCLE_VERTS * (float)M_PI*2; + float a = (float)i/(float)CIRCLE_VERTS * PI*2; g_circleVerts[i*2+0] = cosf(a); g_circleVerts[i*2+1] = sinf(a); } diff --git a/RecastDemo/Source/main.cpp b/RecastDemo/Source/main.cpp index 50c0fd1..8d9c453 100644 --- a/RecastDemo/Source/main.cpp +++ b/RecastDemo/Source/main.cpp @@ -61,7 +61,7 @@ static const int g_nsamples = sizeof(g_samples)/sizeof(SampleItem); int main(int /*argc*/, char** /*argv*/) -{ +{ // Init SDL if (SDL_Init(SDL_INIT_EVERYTHING) != 0) { @@ -894,7 +894,7 @@ int main(int /*argc*/, char** /*argv*/) const float r = 25.0f; for (int i = 0; i < 20; ++i) { - const float a = (float)i / 20.0f * (float)M_PI*2; + const float a = (float)i / 20.0f * RC_PI*2; const float fx = (float)x + cosf(a)*r; const float fy = (float)y + sinf(a)*r; glVertex2f(fx,fy);