diff --git a/examples/boing.c b/examples/boing.c index ec313596..0dd7b577 100644 --- a/examples/boing.c +++ b/examples/boing.c @@ -27,6 +27,11 @@ * a hidden computer or VCR. *****************************************************************************/ +#if defined(_MSC_VER) + // Make MS math.h define M_PI + #define _USE_MATH_DEFINES +#endif + #include #include #include @@ -102,11 +107,6 @@ double dt; #define RAND_MAX 4095 #endif -/* PI */ -#ifndef M_PI - #define M_PI 3.1415926535897932384626433832795 -#endif - /***************************************************************************** * Truncate a degree. diff --git a/examples/gears.c b/examples/gears.c index 2d445964..55d2f672 100644 --- a/examples/gears.c +++ b/examples/gears.c @@ -21,6 +21,10 @@ * - Enabled vsync */ +#if defined(_MSC_VER) + // Make MS math.h define M_PI + #define _USE_MATH_DEFINES +#endif #include #include @@ -28,10 +32,6 @@ #include #include -#ifndef M_PI -#define M_PI 3.141592654 -#endif - /* If non-zero, the program exits after that many seconds */ static int autoexit = 0; diff --git a/examples/particles.c b/examples/particles.c index 64f2e831..175468d0 100644 --- a/examples/particles.c +++ b/examples/particles.c @@ -24,6 +24,11 @@ // //======================================================================== +#if defined(_MSC_VER) + // Make MS math.h define M_PI + #define _USE_MATH_DEFINES +#endif + #include #include #include @@ -43,11 +48,6 @@ #define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA #endif // GL_EXT_separate_specular_color -// Some 's do not define M_PI -#ifndef M_PI -#define M_PI 3.141592654 -#endif - //======================================================================== // Type definitions diff --git a/examples/splitview.c b/examples/splitview.c index 6c911969..9e25a742 100644 --- a/examples/splitview.c +++ b/examples/splitview.c @@ -14,14 +14,15 @@ #define GLFW_INCLUDE_GLEXT #include +#if defined(_MSC_VER) + // Make MS math.h define M_PI + #define _USE_MATH_DEFINES +#endif + #include #include #include -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - //======================================================================== // Global variables diff --git a/examples/wave.c b/examples/wave.c index bafe4652..3c6038f9 100644 --- a/examples/wave.c +++ b/examples/wave.c @@ -8,6 +8,11 @@ * 2010-10-24: Formatting and cleanup - Camilla Berglund *****************************************************************************/ +#if defined(_MSC_VER) + // Make MS math.h define M_PI + #define _USE_MATH_DEFINES +#endif + #include #include #include @@ -15,10 +20,6 @@ #define GLFW_INCLUDE_GLU #include -#ifndef M_PI - #define M_PI 3.1415926535897932384626433832795 -#endif - // Maximum delta T to allow for differential calculations #define MAX_DELTA_T 0.01 diff --git a/tests/cursor.c b/tests/cursor.c index 6f165213..7a932501 100644 --- a/tests/cursor.c +++ b/tests/cursor.c @@ -32,6 +32,11 @@ #include +#if defined(_MSC_VER) + // Make MS math.h define M_PI + #define _USE_MATH_DEFINES +#endif + #include #include #include