Remove ad-hoc M_PIs and enable VC++ macro

Fixes #564.
This commit is contained in:
Camilla Berglund 2015-07-27 16:04:21 +02:00
parent 3d62ff0e07
commit d2113dc9f5
6 changed files with 29 additions and 22 deletions

View File

@ -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 <stdio.h>
#include <stdlib.h>
#include <math.h>
@ -102,11 +107,6 @@ double dt;
#define RAND_MAX 4095
#endif
/* PI */
#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif
/*****************************************************************************
* Truncate a degree.

View File

@ -21,6 +21,10 @@
* - Enabled vsync
*/
#if defined(_MSC_VER)
// Make MS math.h define M_PI
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#include <stdlib.h>
@ -28,10 +32,6 @@
#include <string.h>
#include <GLFW/glfw3.h>
#ifndef M_PI
#define M_PI 3.141592654
#endif
/* If non-zero, the program exits after that many seconds
*/
static int autoexit = 0;

View File

@ -24,6 +24,11 @@
//
//========================================================================
#if defined(_MSC_VER)
// Make MS math.h define M_PI
#define _USE_MATH_DEFINES
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@ -43,11 +48,6 @@
#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA
#endif // GL_EXT_separate_specular_color
// Some <math.h>'s do not define M_PI
#ifndef M_PI
#define M_PI 3.141592654
#endif
//========================================================================
// Type definitions

View File

@ -14,14 +14,15 @@
#define GLFW_INCLUDE_GLEXT
#include <GLFW/glfw3.h>
#if defined(_MSC_VER)
// Make MS math.h define M_PI
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
//========================================================================
// Global variables

View File

@ -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 <stdio.h>
#include <stdlib.h>
#include <math.h>
@ -15,10 +20,6 @@
#define GLFW_INCLUDE_GLU
#include <GLFW/glfw3.h>
#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif
// Maximum delta T to allow for differential calculations
#define MAX_DELTA_T 0.01

View File

@ -32,6 +32,11 @@
#include <GLFW/glfw3.h>
#if defined(_MSC_VER)
// Make MS math.h define M_PI
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#include <stdio.h>
#include <stdlib.h>