diff --git a/modules/juce_box2d/box2d/Collision/Shapes/b2ChainShape.cpp b/modules/juce_box2d/box2d/Collision/Shapes/b2ChainShape.cpp index b8e039849a..3c63de75c1 100644 --- a/modules/juce_box2d/box2d/Collision/Shapes/b2ChainShape.cpp +++ b/modules/juce_box2d/box2d/Collision/Shapes/b2ChainShape.cpp @@ -18,8 +18,7 @@ #include "b2ChainShape.h" #include "b2EdgeShape.h" -#include -#include + using namespace std; b2ChainShape::~b2ChainShape() diff --git a/modules/juce_box2d/box2d/Collision/Shapes/b2CircleShape.cpp b/modules/juce_box2d/box2d/Collision/Shapes/b2CircleShape.cpp index 419de26e5f..c8737f99d3 100644 --- a/modules/juce_box2d/box2d/Collision/Shapes/b2CircleShape.cpp +++ b/modules/juce_box2d/box2d/Collision/Shapes/b2CircleShape.cpp @@ -17,7 +17,7 @@ */ #include "b2CircleShape.h" -#include + using namespace std; b2Shape* b2CircleShape::Clone(b2BlockAllocator* allocator) const diff --git a/modules/juce_box2d/box2d/Collision/Shapes/b2EdgeShape.cpp b/modules/juce_box2d/box2d/Collision/Shapes/b2EdgeShape.cpp index 7f27d85283..f47ff501b0 100644 --- a/modules/juce_box2d/box2d/Collision/Shapes/b2EdgeShape.cpp +++ b/modules/juce_box2d/box2d/Collision/Shapes/b2EdgeShape.cpp @@ -17,7 +17,7 @@ */ #include "b2EdgeShape.h" -#include + using namespace std; void b2EdgeShape::Set(const b2Vec2& v1, const b2Vec2& v2) diff --git a/modules/juce_box2d/box2d/Collision/Shapes/b2PolygonShape.cpp b/modules/juce_box2d/box2d/Collision/Shapes/b2PolygonShape.cpp index daf74f18ac..9742ecfd0e 100644 --- a/modules/juce_box2d/box2d/Collision/Shapes/b2PolygonShape.cpp +++ b/modules/juce_box2d/box2d/Collision/Shapes/b2PolygonShape.cpp @@ -17,7 +17,6 @@ */ #include "b2PolygonShape.h" -#include b2Shape* b2PolygonShape::Clone(b2BlockAllocator* allocator) const { diff --git a/modules/juce_box2d/box2d/Collision/b2BroadPhase.cpp b/modules/juce_box2d/box2d/Collision/b2BroadPhase.cpp index 6dab09f338..ed7d22bd3b 100644 --- a/modules/juce_box2d/box2d/Collision/b2BroadPhase.cpp +++ b/modules/juce_box2d/box2d/Collision/b2BroadPhase.cpp @@ -17,7 +17,7 @@ */ #include "b2BroadPhase.h" -#include + using namespace std; b2BroadPhase::b2BroadPhase() diff --git a/modules/juce_box2d/box2d/Collision/b2Collision.h b/modules/juce_box2d/box2d/Collision/b2Collision.h index 150e3beba0..31effb751a 100644 --- a/modules/juce_box2d/box2d/Collision/b2Collision.h +++ b/modules/juce_box2d/box2d/Collision/b2Collision.h @@ -20,7 +20,6 @@ #define B2_COLLISION_H #include "../Common/b2Math.h" -#include /// @file /// Structures and functions used for computing contact points, distance diff --git a/modules/juce_box2d/box2d/Common/b2BlockAllocator.cpp b/modules/juce_box2d/box2d/Common/b2BlockAllocator.cpp index b9f5060f09..4dd346651d 100644 --- a/modules/juce_box2d/box2d/Common/b2BlockAllocator.cpp +++ b/modules/juce_box2d/box2d/Common/b2BlockAllocator.cpp @@ -17,10 +17,7 @@ */ #include "b2BlockAllocator.h" -#include -#include -#include -#include + using namespace std; int32 b2BlockAllocator::s_blockSizes[b2_blockSizes] = diff --git a/modules/juce_box2d/box2d/Common/b2Math.h b/modules/juce_box2d/box2d/Common/b2Math.h index f1b3d1708d..e42428e6ef 100644 --- a/modules/juce_box2d/box2d/Common/b2Math.h +++ b/modules/juce_box2d/box2d/Common/b2Math.h @@ -21,11 +21,6 @@ #include "b2Settings.h" -#include -#include -#include -#include - /// This function is used to ensure that a floating point number is /// not a NaN or infinity. inline bool b2IsValid(float32 x) diff --git a/modules/juce_box2d/box2d/Common/b2Settings.cpp b/modules/juce_box2d/box2d/Common/b2Settings.cpp index f26cfd82b1..f6593482b1 100644 --- a/modules/juce_box2d/box2d/Common/b2Settings.cpp +++ b/modules/juce_box2d/box2d/Common/b2Settings.cpp @@ -17,9 +17,6 @@ */ #include "b2Settings.h" -#include -#include -#include b2Version b2_version = {2, 2, 1}; diff --git a/modules/juce_box2d/box2d/Common/b2Settings.h b/modules/juce_box2d/box2d/Common/b2Settings.h index d367de56e5..24f0bd3e37 100644 --- a/modules/juce_box2d/box2d/Common/b2Settings.h +++ b/modules/juce_box2d/box2d/Common/b2Settings.h @@ -19,11 +19,8 @@ #ifndef B2_SETTINGS_H #define B2_SETTINGS_H -#include -#include - #define B2_NOT_USED(x) ((void)(x)) -#define b2Assert(A) assert(A) +#define b2Assert(A) jassert(A) typedef float float32; typedef double float64; diff --git a/modules/juce_box2d/box2d/Common/b2Timer.cpp b/modules/juce_box2d/box2d/Common/b2Timer.cpp index 2647f2f190..d833ee652f 100644 --- a/modules/juce_box2d/box2d/Common/b2Timer.cpp +++ b/modules/juce_box2d/box2d/Common/b2Timer.cpp @@ -18,83 +18,17 @@ #include "b2Timer.h" -#if defined(_WIN32) - -float64 b2Timer::s_invFrequency = 0.0f; - -#include - -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 - -b2Timer::b2Timer() +b2Timer::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 { - 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 ((juce::Time::getCurrentTime() - juceStartTime).inMilliseconds()); } - -void b2Timer::Reset() -{ -} - -float32 b2Timer::GetMilliseconds() const -{ - return 0.0f; -} - -#endif diff --git a/modules/juce_box2d/box2d/Common/b2Timer.h b/modules/juce_box2d/box2d/Common/b2Timer.h index 7855031483..bbc16a46bd 100644 --- a/modules/juce_box2d/box2d/Common/b2Timer.h +++ b/modules/juce_box2d/box2d/Common/b2Timer.h @@ -37,14 +37,7 @@ public: float32 GetMilliseconds() const; 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 diff --git a/modules/juce_box2d/box2d/Dynamics/b2Body.h b/modules/juce_box2d/box2d/Dynamics/b2Body.h index 6c53cc2583..c887efb093 100644 --- a/modules/juce_box2d/box2d/Dynamics/b2Body.h +++ b/modules/juce_box2d/box2d/Dynamics/b2Body.h @@ -21,7 +21,6 @@ #include "../Common/b2Math.h" #include "../Collision/Shapes/b2Shape.h" -#include class b2Fixture; class b2Joint; diff --git a/modules/juce_box2d/juce_box2d.cpp b/modules/juce_box2d/juce_box2d.cpp index ab6bade7c7..4054b66918 100644 --- a/modules/juce_box2d/juce_box2d.cpp +++ b/modules/juce_box2d/juce_box2d.cpp @@ -45,6 +45,8 @@ #include "juce_box2d.h" +#include + typedef juce::int8 int8; typedef juce::int16 int16; typedef juce::int32 int32; diff --git a/modules/juce_box2d/juce_box2d.h b/modules/juce_box2d/juce_box2d.h index a3d06abd01..7bf1e42fff 100644 --- a/modules/juce_box2d/juce_box2d.h +++ b/modules/juce_box2d/juce_box2d.h @@ -59,6 +59,9 @@ #pragma GCC diagnostic ignored "-Wconversion" #endif +#include +#include + #include "box2d/Box2D.h" #ifdef __GNUC__ diff --git a/modules/juce_core/system/juce_CompilerSupport.h b/modules/juce_core/system/juce_CompilerSupport.h index 8fed16d5f7..a441ec7e17 100644 --- a/modules/juce_core/system/juce_CompilerSupport.h +++ b/modules/juce_core/system/juce_CompilerSupport.h @@ -51,6 +51,10 @@ #define JUCE_EXCEPTIONS_DISABLED 1 #endif #endif + + #define JUCE_CXX14_IS_AVAILABLE (__cplusplus >= 201402L) + #define JUCE_CXX17_IS_AVAILABLE (__cplusplus >= 201703L) + #endif //============================================================================== @@ -79,6 +83,9 @@ #endif #endif + #define JUCE_CXX14_IS_AVAILABLE (__cplusplus >= 201402L) + #define JUCE_CXX17_IS_AVAILABLE (__cplusplus >= 201703L) + #endif //============================================================================== @@ -106,6 +113,9 @@ #define JUCE_EXCEPTIONS_DISABLED 1 #endif #endif + + #define JUCE_CXX14_IS_AVAILABLE (_MSVC_LANG >= 201402L) + #define JUCE_CXX17_IS_AVAILABLE (_MSVC_LANG >= 201703L) #endif //============================================================================== diff --git a/modules/juce_dsp/processors/juce_WaveShaper.h b/modules/juce_dsp/processors/juce_WaveShaper.h index 693a5d2743..037b198292 100644 --- a/modules/juce_dsp/processors/juce_WaveShaper.h +++ b/modules/juce_dsp/processors/juce_WaveShaper.h @@ -72,8 +72,13 @@ struct WaveShaper }; //============================================================================== +#if JUCE_CXX17_IS_AVAILABLE +template +static WaveShaper, Functor> CreateWaveShaper (Functor functionToUse) { return {functionToUse}; } +#else template static WaveShaper, Functor> CreateWaveShaper (Functor functionToUse) { return {functionToUse}; } +#endif } // namespace dsp } // namespace juce