| @@ -18,8 +18,7 @@ | |||||
| #include "b2ChainShape.h" | #include "b2ChainShape.h" | ||||
| #include "b2EdgeShape.h" | #include "b2EdgeShape.h" | ||||
| #include <new> | |||||
| #include <cstring> | |||||
| using namespace std; | using namespace std; | ||||
| b2ChainShape::~b2ChainShape() | b2ChainShape::~b2ChainShape() | ||||
| @@ -17,7 +17,7 @@ | |||||
| */ | */ | ||||
| #include "b2CircleShape.h" | #include "b2CircleShape.h" | ||||
| #include <new> | |||||
| using namespace std; | using namespace std; | ||||
| b2Shape* b2CircleShape::Clone(b2BlockAllocator* allocator) const | b2Shape* b2CircleShape::Clone(b2BlockAllocator* allocator) const | ||||
| @@ -17,7 +17,7 @@ | |||||
| */ | */ | ||||
| #include "b2EdgeShape.h" | #include "b2EdgeShape.h" | ||||
| #include <new> | |||||
| using namespace std; | using namespace std; | ||||
| void b2EdgeShape::Set(const b2Vec2& v1, const b2Vec2& v2) | void b2EdgeShape::Set(const b2Vec2& v1, const b2Vec2& v2) | ||||
| @@ -17,7 +17,6 @@ | |||||
| */ | */ | ||||
| #include "b2PolygonShape.h" | #include "b2PolygonShape.h" | ||||
| #include <new> | |||||
| b2Shape* b2PolygonShape::Clone(b2BlockAllocator* allocator) const | b2Shape* b2PolygonShape::Clone(b2BlockAllocator* allocator) const | ||||
| { | { | ||||
| @@ -17,7 +17,7 @@ | |||||
| */ | */ | ||||
| #include "b2BroadPhase.h" | #include "b2BroadPhase.h" | ||||
| #include <cstring> | |||||
| using namespace std; | using namespace std; | ||||
| b2BroadPhase::b2BroadPhase() | b2BroadPhase::b2BroadPhase() | ||||
| @@ -20,7 +20,6 @@ | |||||
| #define B2_COLLISION_H | #define B2_COLLISION_H | ||||
| #include "../Common/b2Math.h" | #include "../Common/b2Math.h" | ||||
| #include <climits> | |||||
| /// @file | /// @file | ||||
| /// Structures and functions used for computing contact points, distance | /// Structures and functions used for computing contact points, distance | ||||
| @@ -17,10 +17,7 @@ | |||||
| */ | */ | ||||
| #include "b2BlockAllocator.h" | #include "b2BlockAllocator.h" | ||||
| #include <cstdlib> | |||||
| #include <climits> | |||||
| #include <cstring> | |||||
| #include <memory> | |||||
| using namespace std; | using namespace std; | ||||
| int32 b2BlockAllocator::s_blockSizes[b2_blockSizes] = | int32 b2BlockAllocator::s_blockSizes[b2_blockSizes] = | ||||
| @@ -21,11 +21,6 @@ | |||||
| #include "b2Settings.h" | #include "b2Settings.h" | ||||
| #include <cmath> | |||||
| #include <cfloat> | |||||
| #include <cstddef> | |||||
| #include <limits> | |||||
| /// This function is used to ensure that a floating point number is | /// This function is used to ensure that a floating point number is | ||||
| /// not a NaN or infinity. | /// not a NaN or infinity. | ||||
| inline bool b2IsValid(float32 x) | inline bool b2IsValid(float32 x) | ||||
| @@ -17,9 +17,6 @@ | |||||
| */ | */ | ||||
| #include "b2Settings.h" | #include "b2Settings.h" | ||||
| #include <cstdlib> | |||||
| #include <cstdio> | |||||
| #include <cstdarg> | |||||
| b2Version b2_version = {2, 2, 1}; | b2Version b2_version = {2, 2, 1}; | ||||
| @@ -19,11 +19,8 @@ | |||||
| #ifndef B2_SETTINGS_H | #ifndef B2_SETTINGS_H | ||||
| #define B2_SETTINGS_H | #define B2_SETTINGS_H | ||||
| #include <cassert> | |||||
| #include <cmath> | |||||
| #define B2_NOT_USED(x) ((void)(x)) | #define B2_NOT_USED(x) ((void)(x)) | ||||
| #define b2Assert(A) assert(A) | |||||
| #define b2Assert(A) jassert(A) | |||||
| typedef float float32; | typedef float float32; | ||||
| typedef double float64; | typedef double float64; | ||||
| @@ -18,83 +18,17 @@ | |||||
| #include "b2Timer.h" | #include "b2Timer.h" | ||||
| #if defined(_WIN32) | |||||
| float64 b2Timer::s_invFrequency = 0.0f; | |||||
| #include <windows.h> | |||||
| b2Timer::b2Timer() | |||||
| { | |||||
| LARGE_INTEGER largeInteger; | |||||
| if (s_invFrequency == 0.0f) | |||||
| { | |||||
| QueryPerformanceFrequency(&largeInteger); | |||||
| s_invFrequency = float64(largeInteger.QuadPart); | |||||
| if (s_invFrequency > 0.0f) | |||||
| { | |||||
| s_invFrequency = 1000.0f / s_invFrequency; | |||||
| } | |||||
| } | |||||
| QueryPerformanceCounter(&largeInteger); | |||||
| m_start = float64(largeInteger.QuadPart); | |||||
| } | |||||
| void b2Timer::Reset() | |||||
| { | |||||
| LARGE_INTEGER largeInteger; | |||||
| QueryPerformanceCounter(&largeInteger); | |||||
| m_start = float64(largeInteger.QuadPart); | |||||
| } | |||||
| float32 b2Timer::GetMilliseconds() const | |||||
| { | |||||
| LARGE_INTEGER largeInteger; | |||||
| QueryPerformanceCounter(&largeInteger); | |||||
| float64 count = float64(largeInteger.QuadPart); | |||||
| float32 ms = float32(s_invFrequency * (count - m_start)); | |||||
| return ms; | |||||
| } | |||||
| #elif defined(__linux__) || defined (__APPLE__) | |||||
| #include <sys/time.h> | |||||
| b2Timer::b2Timer() | |||||
| b2Timer::b2Timer() | |||||
| { | { | ||||
| Reset(); | Reset(); | ||||
| } | } | ||||
| void b2Timer::Reset() | void b2Timer::Reset() | ||||
| { | { | ||||
| timeval t; | |||||
| gettimeofday(&t, 0); | |||||
| m_start_sec = t.tv_sec; | |||||
| m_start_msec = t.tv_usec * 0.001f; | |||||
| juceStartTime = juce::Time::getCurrentTime(); | |||||
| } | } | ||||
| float32 b2Timer::GetMilliseconds() const | float32 b2Timer::GetMilliseconds() const | ||||
| { | { | ||||
| timeval t; | |||||
| gettimeofday(&t, 0); | |||||
| return (t.tv_sec - m_start_sec) * 1000 + t.tv_usec * 0.001f - m_start_msec; | |||||
| } | |||||
| #else | |||||
| b2Timer::b2Timer() | |||||
| { | |||||
| return static_cast<float32> ((juce::Time::getCurrentTime() - juceStartTime).inMilliseconds()); | |||||
| } | } | ||||
| void b2Timer::Reset() | |||||
| { | |||||
| } | |||||
| float32 b2Timer::GetMilliseconds() const | |||||
| { | |||||
| return 0.0f; | |||||
| } | |||||
| #endif | |||||
| @@ -37,14 +37,7 @@ public: | |||||
| float32 GetMilliseconds() const; | float32 GetMilliseconds() const; | ||||
| private: | private: | ||||
| #if defined(_WIN32) | |||||
| float64 m_start; | |||||
| static float64 s_invFrequency; | |||||
| #elif defined(__linux__) || defined (__APPLE__) | |||||
| unsigned long m_start_sec; | |||||
| unsigned long m_start_msec; | |||||
| #endif | |||||
| juce::Time juceStartTime; | |||||
| }; | }; | ||||
| #endif | #endif | ||||
| @@ -21,7 +21,6 @@ | |||||
| #include "../Common/b2Math.h" | #include "../Common/b2Math.h" | ||||
| #include "../Collision/Shapes/b2Shape.h" | #include "../Collision/Shapes/b2Shape.h" | ||||
| #include <memory> | |||||
| class b2Fixture; | class b2Fixture; | ||||
| class b2Joint; | class b2Joint; | ||||
| @@ -45,6 +45,8 @@ | |||||
| #include "juce_box2d.h" | #include "juce_box2d.h" | ||||
| #include <cstdarg> | |||||
| typedef juce::int8 int8; | typedef juce::int8 int8; | ||||
| typedef juce::int16 int16; | typedef juce::int16 int16; | ||||
| typedef juce::int32 int32; | typedef juce::int32 int32; | ||||
| @@ -59,6 +59,9 @@ | |||||
| #pragma GCC diagnostic ignored "-Wconversion" | #pragma GCC diagnostic ignored "-Wconversion" | ||||
| #endif | #endif | ||||
| #include <climits> | |||||
| #include <cfloat> | |||||
| #include "box2d/Box2D.h" | #include "box2d/Box2D.h" | ||||
| #ifdef __GNUC__ | #ifdef __GNUC__ | ||||
| @@ -51,6 +51,10 @@ | |||||
| #define JUCE_EXCEPTIONS_DISABLED 1 | #define JUCE_EXCEPTIONS_DISABLED 1 | ||||
| #endif | #endif | ||||
| #endif | #endif | ||||
| #define JUCE_CXX14_IS_AVAILABLE (__cplusplus >= 201402L) | |||||
| #define JUCE_CXX17_IS_AVAILABLE (__cplusplus >= 201703L) | |||||
| #endif | #endif | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -79,6 +83,9 @@ | |||||
| #endif | #endif | ||||
| #endif | #endif | ||||
| #define JUCE_CXX14_IS_AVAILABLE (__cplusplus >= 201402L) | |||||
| #define JUCE_CXX17_IS_AVAILABLE (__cplusplus >= 201703L) | |||||
| #endif | #endif | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -106,6 +113,9 @@ | |||||
| #define JUCE_EXCEPTIONS_DISABLED 1 | #define JUCE_EXCEPTIONS_DISABLED 1 | ||||
| #endif | #endif | ||||
| #endif | #endif | ||||
| #define JUCE_CXX14_IS_AVAILABLE (_MSVC_LANG >= 201402L) | |||||
| #define JUCE_CXX17_IS_AVAILABLE (_MSVC_LANG >= 201703L) | |||||
| #endif | #endif | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -72,8 +72,13 @@ struct WaveShaper | |||||
| }; | }; | ||||
| //============================================================================== | //============================================================================== | ||||
| #if JUCE_CXX17_IS_AVAILABLE | |||||
| template <typename Functor> | |||||
| static WaveShaper<typename std::invoke_result<Functor>, Functor> CreateWaveShaper (Functor functionToUse) { return {functionToUse}; } | |||||
| #else | |||||
| template <typename Functor> | template <typename Functor> | ||||
| static WaveShaper<typename std::result_of<Functor>, Functor> CreateWaveShaper (Functor functionToUse) { return {functionToUse}; } | static WaveShaper<typename std::result_of<Functor>, Functor> CreateWaveShaper (Functor functionToUse) { return {functionToUse}; } | ||||
| #endif | |||||
| } // namespace dsp | } // namespace dsp | ||||
| } // namespace juce | } // namespace juce | ||||