From e982c70438a8aee277bcd4fe21cdfd7f9bd76c7f Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 15 Mar 2018 10:45:11 +0000 Subject: [PATCH] Fix juce_box2d build errors when included with other modules using int8, int16, int32 etc. --- .../box2d/Collision/Shapes/b2ChainShape.h | 14 ++-- .../box2d/Collision/Shapes/b2CircleShape.h | 16 ++--- .../box2d/Collision/Shapes/b2EdgeShape.h | 6 +- .../box2d/Collision/Shapes/b2PolygonShape.h | 16 ++--- .../box2d/Collision/Shapes/b2Shape.h | 6 +- .../juce_box2d/box2d/Collision/b2BroadPhase.h | 62 ++++++++--------- .../juce_box2d/box2d/Collision/b2Collision.h | 22 +++---- .../juce_box2d/box2d/Collision/b2Distance.h | 32 ++++----- .../box2d/Collision/b2DynamicTree.h | 66 +++++++++---------- .../box2d/Common/b2BlockAllocator.h | 20 +++--- modules/juce_box2d/box2d/Common/b2Draw.h | 14 ++-- .../juce_box2d/box2d/Common/b2GrowableStack.h | 8 +-- modules/juce_box2d/box2d/Common/b2Math.h | 10 +-- modules/juce_box2d/box2d/Common/b2Settings.h | 14 ++-- .../box2d/Common/b2StackAllocator.h | 18 ++--- .../box2d/Dynamics/Contacts/b2Contact.h | 24 +++---- .../box2d/Dynamics/Joints/b2DistanceJoint.h | 4 +- .../box2d/Dynamics/Joints/b2FrictionJoint.h | 4 +- .../box2d/Dynamics/Joints/b2GearJoint.h | 2 +- .../box2d/Dynamics/Joints/b2Joint.h | 2 +- .../box2d/Dynamics/Joints/b2MouseJoint.h | 4 +- .../box2d/Dynamics/Joints/b2PrismaticJoint.h | 4 +- .../box2d/Dynamics/Joints/b2PulleyJoint.h | 4 +- .../box2d/Dynamics/Joints/b2RevoluteJoint.h | 4 +- .../box2d/Dynamics/Joints/b2RopeJoint.h | 4 +- .../box2d/Dynamics/Joints/b2WeldJoint.h | 4 +- .../box2d/Dynamics/Joints/b2WheelJoint.h | 4 +- modules/juce_box2d/box2d/Dynamics/b2Body.h | 6 +- .../box2d/Dynamics/b2ContactManager.h | 2 +- modules/juce_box2d/box2d/Dynamics/b2Fixture.h | 22 +++---- .../juce_box2d/box2d/Dynamics/b2TimeStep.h | 4 +- modules/juce_box2d/box2d/Dynamics/b2World.h | 28 ++++---- .../box2d/Dynamics/b2WorldCallbacks.h | 2 +- modules/juce_box2d/juce_box2d.cpp | 8 +++ 34 files changed, 231 insertions(+), 229 deletions(-) diff --git a/modules/juce_box2d/box2d/Collision/Shapes/b2ChainShape.h b/modules/juce_box2d/box2d/Collision/Shapes/b2ChainShape.h index 744cac7731..148f8ea78e 100644 --- a/modules/juce_box2d/box2d/Collision/Shapes/b2ChainShape.h +++ b/modules/juce_box2d/box2d/Collision/Shapes/b2ChainShape.h @@ -40,12 +40,12 @@ public: /// Create a loop. This automatically adjusts connectivity. /// @param vertices an array of vertices, these are copied /// @param count the vertex count - void CreateLoop(const b2Vec2* vertices, int32 count); + void CreateLoop(const b2Vec2* vertices, juce::int32 count); /// Create a chain with isolated end vertices. /// @param vertices an array of vertices, these are copied /// @param count the vertex count - void CreateChain(const b2Vec2* vertices, int32 count); + void CreateChain(const b2Vec2* vertices, juce::int32 count); /// Establish connectivity to a vertex that precedes the first vertex. /// Don't call this for loops. @@ -59,10 +59,10 @@ public: b2Shape* Clone(b2BlockAllocator* allocator) const; /// @see b2Shape::GetChildCount - int32 GetChildCount() const; + juce::int32 GetChildCount() const; /// Get a child edge. - void GetChildEdge(b2EdgeShape* edge, int32 index) const; + void GetChildEdge(b2EdgeShape* edge, juce::int32 index) const; /// This always return false. /// @see b2Shape::TestPoint @@ -70,10 +70,10 @@ public: /// Implement b2Shape. bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input, - const b2Transform& transform, int32 childIndex) const; + const b2Transform& transform, juce::int32 childIndex) const; /// @see b2Shape::ComputeAABB - void ComputeAABB(b2AABB* aabb, const b2Transform& transform, int32 childIndex) const; + void ComputeAABB(b2AABB* aabb, const b2Transform& transform, juce::int32 childIndex) const; /// Chains have zero mass. /// @see b2Shape::ComputeMass @@ -83,7 +83,7 @@ public: b2Vec2* m_vertices; /// The vertex count. - int32 m_count; + juce::int32 m_count; b2Vec2 m_prevVertex, m_nextVertex; bool m_hasPrevVertex, m_hasNextVertex; diff --git a/modules/juce_box2d/box2d/Collision/Shapes/b2CircleShape.h b/modules/juce_box2d/box2d/Collision/Shapes/b2CircleShape.h index 65aff1f6d8..c095bd894a 100644 --- a/modules/juce_box2d/box2d/Collision/Shapes/b2CircleShape.h +++ b/modules/juce_box2d/box2d/Collision/Shapes/b2CircleShape.h @@ -31,32 +31,32 @@ public: b2Shape* Clone(b2BlockAllocator* allocator) const; /// @see b2Shape::GetChildCount - int32 GetChildCount() const; + juce::int32 GetChildCount() const; /// Implement b2Shape. bool TestPoint(const b2Transform& transform, const b2Vec2& p) const; /// Implement b2Shape. bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input, - const b2Transform& transform, int32 childIndex) const; + const b2Transform& transform, juce::int32 childIndex) const; /// @see b2Shape::ComputeAABB - void ComputeAABB(b2AABB* aabb, const b2Transform& transform, int32 childIndex) const; + void ComputeAABB(b2AABB* aabb, const b2Transform& transform, juce::int32 childIndex) const; /// @see b2Shape::ComputeMass void ComputeMass(b2MassData* massData, float32 density) const; /// Get the supporting vertex index in the given direction. - int32 GetSupport(const b2Vec2& d) const; + juce::int32 GetSupport(const b2Vec2& d) const; /// Get the supporting vertex in the given direction. const b2Vec2& GetSupportVertex(const b2Vec2& d) const; /// Get the vertex count. - int32 GetVertexCount() const { return 1; } + juce::int32 GetVertexCount() const { return 1; } /// Get a vertex by index. Used by b2Distance. - const b2Vec2& GetVertex(int32 index) const; + const b2Vec2& GetVertex(juce::int32 index) const; /// Position b2Vec2 m_p; @@ -69,7 +69,7 @@ inline b2CircleShape::b2CircleShape() m_p.SetZero(); } -inline int32 b2CircleShape::GetSupport(const b2Vec2 &d) const +inline juce::int32 b2CircleShape::GetSupport(const b2Vec2 &d) const { B2_NOT_USED(d); return 0; @@ -81,7 +81,7 @@ inline const b2Vec2& b2CircleShape::GetSupportVertex(const b2Vec2 &d) const return m_p; } -inline const b2Vec2& b2CircleShape::GetVertex(int32 index) const +inline const b2Vec2& b2CircleShape::GetVertex(juce::int32 index) const { B2_NOT_USED(index); b2Assert(index == 0); diff --git a/modules/juce_box2d/box2d/Collision/Shapes/b2EdgeShape.h b/modules/juce_box2d/box2d/Collision/Shapes/b2EdgeShape.h index 47af03d185..36a2f88196 100644 --- a/modules/juce_box2d/box2d/Collision/Shapes/b2EdgeShape.h +++ b/modules/juce_box2d/box2d/Collision/Shapes/b2EdgeShape.h @@ -36,17 +36,17 @@ public: b2Shape* Clone(b2BlockAllocator* allocator) const; /// @see b2Shape::GetChildCount - int32 GetChildCount() const; + juce::int32 GetChildCount() const; /// @see b2Shape::TestPoint bool TestPoint(const b2Transform& transform, const b2Vec2& p) const; /// Implement b2Shape. bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input, - const b2Transform& transform, int32 childIndex) const; + const b2Transform& transform, juce::int32 childIndex) const; /// @see b2Shape::ComputeAABB - void ComputeAABB(b2AABB* aabb, const b2Transform& transform, int32 childIndex) const; + void ComputeAABB(b2AABB* aabb, const b2Transform& transform, juce::int32 childIndex) const; /// @see b2Shape::ComputeMass void ComputeMass(b2MassData* massData, float32 density) const; diff --git a/modules/juce_box2d/box2d/Collision/Shapes/b2PolygonShape.h b/modules/juce_box2d/box2d/Collision/Shapes/b2PolygonShape.h index e97a81a459..646bb236a2 100644 --- a/modules/juce_box2d/box2d/Collision/Shapes/b2PolygonShape.h +++ b/modules/juce_box2d/box2d/Collision/Shapes/b2PolygonShape.h @@ -34,12 +34,12 @@ public: b2Shape* Clone(b2BlockAllocator* allocator) const; /// @see b2Shape::GetChildCount - int32 GetChildCount() const; + juce::int32 GetChildCount() const; /// Copy vertices. This assumes the vertices define a convex polygon. /// It is assumed that the exterior is the the right of each edge. /// The count must be in the range [3, b2_maxPolygonVertices]. - void Set(const b2Vec2* vertices, int32 vertexCount); + void Set(const b2Vec2* vertices, juce::int32 vertexCount); /// Build vertices to represent an axis-aligned box. /// @param hx the half-width. @@ -58,24 +58,24 @@ public: /// Implement b2Shape. bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input, - const b2Transform& transform, int32 childIndex) const; + const b2Transform& transform, juce::int32 childIndex) const; /// @see b2Shape::ComputeAABB - void ComputeAABB(b2AABB* aabb, const b2Transform& transform, int32 childIndex) const; + void ComputeAABB(b2AABB* aabb, const b2Transform& transform, juce::int32 childIndex) const; /// @see b2Shape::ComputeMass void ComputeMass(b2MassData* massData, float32 density) const; /// Get the vertex count. - int32 GetVertexCount() const { return m_vertexCount; } + juce::int32 GetVertexCount() const { return m_vertexCount; } /// Get a vertex by index. - const b2Vec2& GetVertex(int32 index) const; + const b2Vec2& GetVertex(juce::int32 index) const; b2Vec2 m_centroid; b2Vec2 m_vertices[b2_maxPolygonVertices]; b2Vec2 m_normals[b2_maxPolygonVertices]; - int32 m_vertexCount; + juce::int32 m_vertexCount; }; inline b2PolygonShape::b2PolygonShape() @@ -86,7 +86,7 @@ inline b2PolygonShape::b2PolygonShape() m_centroid.SetZero(); } -inline const b2Vec2& b2PolygonShape::GetVertex(int32 index) const +inline const b2Vec2& b2PolygonShape::GetVertex(juce::int32 index) const { b2Assert(0 <= index && index < m_vertexCount); return m_vertices[index]; diff --git a/modules/juce_box2d/box2d/Collision/Shapes/b2Shape.h b/modules/juce_box2d/box2d/Collision/Shapes/b2Shape.h index 05f175963d..13e3d55a5c 100644 --- a/modules/juce_box2d/box2d/Collision/Shapes/b2Shape.h +++ b/modules/juce_box2d/box2d/Collision/Shapes/b2Shape.h @@ -62,7 +62,7 @@ public: Type GetType() const; /// Get the number of child primitives. - virtual int32 GetChildCount() const = 0; + virtual juce::int32 GetChildCount() const = 0; /// Test a point for containment in this shape. This only works for convex shapes. /// @param xf the shape world transform. @@ -75,13 +75,13 @@ public: /// @param transform the transform to be applied to the shape. /// @param childIndex the child shape index virtual bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input, - const b2Transform& transform, int32 childIndex) const = 0; + const b2Transform& transform, juce::int32 childIndex) const = 0; /// Given a transform, compute the associated axis aligned bounding box for a child shape. /// @param aabb returns the axis aligned box. /// @param xf the world transform of the shape. /// @param childIndex the child shape - virtual void ComputeAABB(b2AABB* aabb, const b2Transform& xf, int32 childIndex) const = 0; + virtual void ComputeAABB(b2AABB* aabb, const b2Transform& xf, juce::int32 childIndex) const = 0; /// Compute the mass properties of this shape using its dimensions and density. /// The inertia tensor is computed about the local origin. diff --git a/modules/juce_box2d/box2d/Collision/b2BroadPhase.h b/modules/juce_box2d/box2d/Collision/b2BroadPhase.h index 59066e8a7b..bbbaeb2865 100644 --- a/modules/juce_box2d/box2d/Collision/b2BroadPhase.h +++ b/modules/juce_box2d/box2d/Collision/b2BroadPhase.h @@ -26,9 +26,9 @@ struct b2Pair { - int32 proxyIdA; - int32 proxyIdB; - int32 next; + juce::int32 proxyIdA; + juce::int32 proxyIdB; + juce::int32 next; }; /// The broad-phase is used for computing pairs and performing volume queries and ray casts. @@ -48,29 +48,29 @@ public: /// Create a proxy with an initial AABB. Pairs are not reported until /// UpdatePairs is called. - int32 CreateProxy(const b2AABB& aabb, void* userData); + juce::int32 CreateProxy(const b2AABB& aabb, void* userData); /// Destroy a proxy. It is up to the client to remove any pairs. - void DestroyProxy(int32 proxyId); + void DestroyProxy(juce::int32 proxyId); /// Call MoveProxy as many times as you like, then when you are done /// call UpdatePairs to finalized the proxy pairs (for your time step). - void MoveProxy(int32 proxyId, const b2AABB& aabb, const b2Vec2& displacement); + void MoveProxy(juce::int32 proxyId, const b2AABB& aabb, const b2Vec2& displacement); /// Call to trigger a re-processing of it's pairs on the next call to UpdatePairs. - void TouchProxy(int32 proxyId); + void TouchProxy(juce::int32 proxyId); /// Get the fat AABB for a proxy. - const b2AABB& GetFatAABB(int32 proxyId) const; + const b2AABB& GetFatAABB(juce::int32 proxyId) const; /// Get user data from a proxy. Returns NULL if the id is invalid. - void* GetUserData(int32 proxyId) const; + void* GetUserData(juce::int32 proxyId) const; /// Test overlap of fat AABBs. - bool TestOverlap(int32 proxyIdA, int32 proxyIdB) const; + bool TestOverlap(juce::int32 proxyIdA, juce::int32 proxyIdB) const; /// Get the number of proxies. - int32 GetProxyCount() const; + juce::int32 GetProxyCount() const; /// Update the pairs. This results in pair callbacks. This can only add pairs. template @@ -92,10 +92,10 @@ public: void RayCast(T* callback, const b2RayCastInput& input) const; /// Get the height of the embedded tree. - int32 GetTreeHeight() const; + juce::int32 GetTreeHeight() const; /// Get the balance of the embedded tree. - int32 GetTreeBalance() const; + juce::int32 GetTreeBalance() const; /// Get the quality metric of the embedded tree. float32 GetTreeQuality() const; @@ -104,24 +104,24 @@ private: friend class b2DynamicTree; - void BufferMove(int32 proxyId); - void UnBufferMove(int32 proxyId); + void BufferMove(juce::int32 proxyId); + void UnBufferMove(juce::int32 proxyId); - bool QueryCallback(int32 proxyId); + bool QueryCallback(juce::int32 proxyId); b2DynamicTree m_tree; - int32 m_proxyCount; + juce::int32 m_proxyCount; - int32* m_moveBuffer; - int32 m_moveCapacity; - int32 m_moveCount; + juce::int32* m_moveBuffer; + juce::int32 m_moveCapacity; + juce::int32 m_moveCount; b2Pair* m_pairBuffer; - int32 m_pairCapacity; - int32 m_pairCount; + juce::int32 m_pairCapacity; + juce::int32 m_pairCount; - int32 m_queryProxyId; + juce::int32 m_queryProxyId; }; /// This is used to sort pairs. @@ -140,34 +140,34 @@ inline bool b2PairLessThan(const b2Pair& pair1, const b2Pair& pair2) return false; } -inline void* b2BroadPhase::GetUserData(int32 proxyId) const +inline void* b2BroadPhase::GetUserData(juce::int32 proxyId) const { return m_tree.GetUserData(proxyId); } -inline bool b2BroadPhase::TestOverlap(int32 proxyIdA, int32 proxyIdB) const +inline bool b2BroadPhase::TestOverlap(juce::int32 proxyIdA, juce::int32 proxyIdB) const { const b2AABB& aabbA = m_tree.GetFatAABB(proxyIdA); const b2AABB& aabbB = m_tree.GetFatAABB(proxyIdB); return b2TestOverlap(aabbA, aabbB); } -inline const b2AABB& b2BroadPhase::GetFatAABB(int32 proxyId) const +inline const b2AABB& b2BroadPhase::GetFatAABB(juce::int32 proxyId) const { return m_tree.GetFatAABB(proxyId); } -inline int32 b2BroadPhase::GetProxyCount() const +inline juce::int32 b2BroadPhase::GetProxyCount() const { return m_proxyCount; } -inline int32 b2BroadPhase::GetTreeHeight() const +inline juce::int32 b2BroadPhase::GetTreeHeight() const { return m_tree.GetHeight(); } -inline int32 b2BroadPhase::GetTreeBalance() const +inline juce::int32 b2BroadPhase::GetTreeBalance() const { return m_tree.GetMaxBalance(); } @@ -184,7 +184,7 @@ void b2BroadPhase::UpdatePairs(T* callback) m_pairCount = 0; // Perform tree queries for all moving proxies. - for (int32 i = 0; i < m_moveCount; ++i) + for (juce::int32 i = 0; i < m_moveCount; ++i) { m_queryProxyId = m_moveBuffer[i]; if (m_queryProxyId == e_nullProxy) @@ -207,7 +207,7 @@ void b2BroadPhase::UpdatePairs(T* callback) std::sort(m_pairBuffer, m_pairBuffer + m_pairCount, b2PairLessThan); // Send the pairs back to the client. - int32 i = 0; + juce::int32 i = 0; while (i < m_pairCount) { b2Pair* primaryPair = m_pairBuffer + i; diff --git a/modules/juce_box2d/box2d/Collision/b2Collision.h b/modules/juce_box2d/box2d/Collision/b2Collision.h index fb32cc646d..150e3beba0 100644 --- a/modules/juce_box2d/box2d/Collision/b2Collision.h +++ b/modules/juce_box2d/box2d/Collision/b2Collision.h @@ -31,7 +31,7 @@ class b2CircleShape; class b2EdgeShape; class b2PolygonShape; -const uint8 b2_nullFeature = UCHAR_MAX; +const juce::uint8 b2_nullFeature = UCHAR_MAX; /// The features that intersect to form the contact point /// This must be 4 bytes or less. @@ -43,17 +43,17 @@ struct b2ContactFeature e_face = 1 }; - uint8 indexA; ///< Feature index on shapeA - uint8 indexB; ///< Feature index on shapeB - uint8 typeA; ///< The feature type on shapeA - uint8 typeB; ///< The feature type on shapeB + juce::uint8 indexA; ///< Feature index on shapeA + juce::uint8 indexB; ///< Feature index on shapeB + juce::uint8 typeA; ///< The feature type on shapeA + juce::uint8 typeB; ///< The feature type on shapeB }; /// Contact ids to facilitate warm starting. union b2ContactID { b2ContactFeature cf; - uint32 key; ///< Used to quickly compare contact ids. + juce::uint32 key; ///< Used to quickly compare contact ids. }; /// A manifold point is a contact point belonging to a contact @@ -103,7 +103,7 @@ struct b2Manifold b2Vec2 localNormal; ///< not use for Type::e_points b2Vec2 localPoint; ///< usage depends on manifold type Type type; - int32 pointCount; ///< the number of manifold points + juce::int32 pointCount; ///< the number of manifold points }; /// This is used to compute the current state of a contact manifold. @@ -240,12 +240,12 @@ void b2CollideEdgeAndPolygon(b2Manifold* manifold, const b2PolygonShape* circleB, const b2Transform& xfB); /// Clipping for contact manifolds. -int32 b2ClipSegmentToLine(b2ClipVertex vOut[2], const b2ClipVertex vIn[2], - const b2Vec2& normal, float32 offset, int32 vertexIndexA); +juce::int32 b2ClipSegmentToLine(b2ClipVertex vOut[2], const b2ClipVertex vIn[2], + const b2Vec2& normal, float32 offset, juce::int32 vertexIndexA); /// Determine if two generic shapes overlap. -bool b2TestOverlap( const b2Shape* shapeA, int32 indexA, - const b2Shape* shapeB, int32 indexB, +bool b2TestOverlap( const b2Shape* shapeA, juce::int32 indexA, + const b2Shape* shapeB, juce::int32 indexB, const b2Transform& xfA, const b2Transform& xfB); // ---------------- Inline Functions ------------------------------------------ diff --git a/modules/juce_box2d/box2d/Collision/b2Distance.h b/modules/juce_box2d/box2d/Collision/b2Distance.h index 6d1f8b05a8..faf9dd119a 100644 --- a/modules/juce_box2d/box2d/Collision/b2Distance.h +++ b/modules/juce_box2d/box2d/Collision/b2Distance.h @@ -32,23 +32,23 @@ struct b2DistanceProxy /// Initialize the proxy using the given shape. The shape /// must remain in scope while the proxy is in use. - void Set(const b2Shape* shape, int32 index); + void Set(const b2Shape* shape, juce::int32 index); /// Get the supporting vertex index in the given direction. - int32 GetSupport(const b2Vec2& d) const; + juce::int32 GetSupport(const b2Vec2& d) const; /// Get the supporting vertex in the given direction. const b2Vec2& GetSupportVertex(const b2Vec2& d) const; /// Get the vertex count. - int32 GetVertexCount() const; + juce::int32 GetVertexCount() const; /// Get a vertex by index. Used by b2Distance. - const b2Vec2& GetVertex(int32 index) const; + const b2Vec2& GetVertex(juce::int32 index) const; b2Vec2 m_buffer[2]; const b2Vec2* m_vertices; - int32 m_count; + juce::int32 m_count; float32 m_radius; }; @@ -57,9 +57,9 @@ struct b2DistanceProxy struct b2SimplexCache { float32 metric; ///< length or area - uint16 count; - uint8 indexA[3]; ///< vertices on shape A - uint8 indexB[3]; ///< vertices on shape B + juce::uint16 count; + juce::uint8 indexA[3]; ///< vertices on shape A + juce::uint8 indexB[3]; ///< vertices on shape B }; /// Input for b2Distance. @@ -80,7 +80,7 @@ struct b2DistanceOutput b2Vec2 pointA; ///< closest point on shapeA b2Vec2 pointB; ///< closest point on shapeB float32 distance; - int32 iterations; ///< number of GJK iterations used + juce::int32 iterations; ///< number of GJK iterations used }; /// Compute the closest points between two shapes. Supports any combination of: @@ -93,22 +93,22 @@ void b2Distance(b2DistanceOutput* output, ////////////////////////////////////////////////////////////////////////// -inline int32 b2DistanceProxy::GetVertexCount() const +inline juce::int32 b2DistanceProxy::GetVertexCount() const { return m_count; } -inline const b2Vec2& b2DistanceProxy::GetVertex(int32 index) const +inline const b2Vec2& b2DistanceProxy::GetVertex(juce::int32 index) const { b2Assert(0 <= index && index < m_count); return m_vertices[index]; } -inline int32 b2DistanceProxy::GetSupport(const b2Vec2& d) const +inline juce::int32 b2DistanceProxy::GetSupport(const b2Vec2& d) const { - int32 bestIndex = 0; + juce::int32 bestIndex = 0; float32 bestValue = b2Dot(m_vertices[0], d); - for (int32 i = 1; i < m_count; ++i) + for (juce::int32 i = 1; i < m_count; ++i) { float32 value = b2Dot(m_vertices[i], d); if (value > bestValue) @@ -123,9 +123,9 @@ inline int32 b2DistanceProxy::GetSupport(const b2Vec2& d) const inline const b2Vec2& b2DistanceProxy::GetSupportVertex(const b2Vec2& d) const { - int32 bestIndex = 0; + juce::int32 bestIndex = 0; float32 bestValue = b2Dot(m_vertices[0], d); - for (int32 i = 1; i < m_count; ++i) + for (juce::int32 i = 1; i < m_count; ++i) { float32 value = b2Dot(m_vertices[i], d); if (value > bestValue) diff --git a/modules/juce_box2d/box2d/Collision/b2DynamicTree.h b/modules/juce_box2d/box2d/Collision/b2DynamicTree.h index bb1d6ee06a..247d68d155 100644 --- a/modules/juce_box2d/box2d/Collision/b2DynamicTree.h +++ b/modules/juce_box2d/box2d/Collision/b2DynamicTree.h @@ -39,15 +39,15 @@ struct b2TreeNode union { - int32 parent; - int32 next; + juce::int32 parent; + juce::int32 next; }; - int32 child1; - int32 child2; + juce::int32 child1; + juce::int32 child2; // leaf = 0, free node = -1 - int32 height; + juce::int32 height; }; /// A dynamic AABB tree broad-phase, inspired by Nathanael Presson's btDbvt. @@ -68,23 +68,23 @@ public: ~b2DynamicTree(); /// Create a proxy. Provide a tight fitting AABB and a userData pointer. - int32 CreateProxy(const b2AABB& aabb, void* userData); + juce::int32 CreateProxy(const b2AABB& aabb, void* userData); /// Destroy a proxy. This asserts if the id is invalid. - void DestroyProxy(int32 proxyId); + void DestroyProxy(juce::int32 proxyId); /// Move a proxy with a swepted AABB. If the proxy has moved outside of its fattened AABB, /// then the proxy is removed from the tree and re-inserted. Otherwise /// the function returns immediately. /// @return true if the proxy was re-inserted. - bool MoveProxy(int32 proxyId, const b2AABB& aabb1, const b2Vec2& displacement); + bool MoveProxy(juce::int32 proxyId, const b2AABB& aabb1, const b2Vec2& displacement); /// Get proxy user data. /// @return the proxy user data or 0 if the id is invalid. - void* GetUserData(int32 proxyId) const; + void* GetUserData(juce::int32 proxyId) const; /// Get the fat AABB for a proxy. - const b2AABB& GetFatAABB(int32 proxyId) const; + const b2AABB& GetFatAABB(juce::int32 proxyId) const; /// Query an AABB for overlapping proxies. The callback class /// is called for each proxy that overlaps the supplied AABB. @@ -106,11 +106,11 @@ public: /// Compute the height of the binary tree in O(N) time. Should not be /// called often. - int32 GetHeight() const; + juce::int32 GetHeight() const; /// Get the maximum balance of an node in the tree. The balance is the difference /// in height of the two children of a node. - int32 GetMaxBalance() const; + juce::int32 GetMaxBalance() const; /// Get the ratio of the sum of the node areas to the root area. float32 GetAreaRatio() const; @@ -120,41 +120,41 @@ public: private: - int32 AllocateNode(); - void FreeNode(int32 node); + juce::int32 AllocateNode(); + void FreeNode(juce::int32 node); - void InsertLeaf(int32 node); - void RemoveLeaf(int32 node); + void InsertLeaf(juce::int32 node); + void RemoveLeaf(juce::int32 node); - int32 Balance(int32 index); + juce::int32 Balance(juce::int32 index); - int32 ComputeHeight() const; - int32 ComputeHeight(int32 nodeId) const; + juce::int32 ComputeHeight() const; + juce::int32 ComputeHeight(juce::int32 nodeId) const; - void ValidateStructure(int32 index) const; - void ValidateMetrics(int32 index) const; + void ValidateStructure(juce::int32 index) const; + void ValidateMetrics(juce::int32 index) const; - int32 m_root; + juce::int32 m_root; b2TreeNode* m_nodes; - int32 m_nodeCount; - int32 m_nodeCapacity; + juce::int32 m_nodeCount; + juce::int32 m_nodeCapacity; - int32 m_freeList; + juce::int32 m_freeList; /// This is used to incrementally traverse the tree for re-balancing. - uint32 m_path; + juce::uint32 m_path; - int32 m_insertionCount; + juce::int32 m_insertionCount; }; -inline void* b2DynamicTree::GetUserData(int32 proxyId) const +inline void* b2DynamicTree::GetUserData(juce::int32 proxyId) const { b2Assert(0 <= proxyId && proxyId < m_nodeCapacity); return m_nodes[proxyId].userData; } -inline const b2AABB& b2DynamicTree::GetFatAABB(int32 proxyId) const +inline const b2AABB& b2DynamicTree::GetFatAABB(juce::int32 proxyId) const { b2Assert(0 <= proxyId && proxyId < m_nodeCapacity); return m_nodes[proxyId].aabb; @@ -163,12 +163,12 @@ inline const b2AABB& b2DynamicTree::GetFatAABB(int32 proxyId) const template inline void b2DynamicTree::Query(T* callback, const b2AABB& aabb) const { - b2GrowableStack stack; + b2GrowableStack stack; stack.Push(m_root); while (stack.GetCount() > 0) { - int32 nodeId = stack.Pop(); + juce::int32 nodeId = stack.Pop(); if (nodeId == b2_nullNode) { continue; @@ -221,12 +221,12 @@ inline void b2DynamicTree::RayCast(T* callback, const b2RayCastInput& input) con segmentAABB.upperBound = b2Max(p1, t); } - b2GrowableStack stack; + b2GrowableStack stack; stack.Push(m_root); while (stack.GetCount() > 0) { - int32 nodeId = stack.Pop(); + juce::int32 nodeId = stack.Pop(); if (nodeId == b2_nullNode) { continue; diff --git a/modules/juce_box2d/box2d/Common/b2BlockAllocator.h b/modules/juce_box2d/box2d/Common/b2BlockAllocator.h index c6799e7a53..1cf634e564 100644 --- a/modules/juce_box2d/box2d/Common/b2BlockAllocator.h +++ b/modules/juce_box2d/box2d/Common/b2BlockAllocator.h @@ -21,10 +21,10 @@ #include "b2Settings.h" -const int32 b2_chunkSize = 16 * 1024; -const int32 b2_maxBlockSize = 640; -const int32 b2_blockSizes = 14; -const int32 b2_chunkArrayIncrement = 128; +const juce::int32 b2_chunkSize = 16 * 1024; +const juce::int32 b2_maxBlockSize = 640; +const juce::int32 b2_blockSizes = 14; +const juce::int32 b2_chunkArrayIncrement = 128; struct b2Block; struct b2Chunk; @@ -39,23 +39,23 @@ public: ~b2BlockAllocator(); /// Allocate memory. This will use b2Alloc if the size is larger than b2_maxBlockSize. - void* Allocate(int32 size); + void* Allocate(juce::int32 size); /// Free memory. This will use b2Free if the size is larger than b2_maxBlockSize. - void Free(void* p, int32 size); + void Free(void* p, juce::int32 size); void Clear(); private: b2Chunk* m_chunks; - int32 m_chunkCount; - int32 m_chunkSpace; + juce::int32 m_chunkCount; + juce::int32 m_chunkSpace; b2Block* m_freeLists[b2_blockSizes]; - static int32 s_blockSizes[b2_blockSizes]; - static uint8 s_blockSizeLookup[b2_maxBlockSize + 1]; + static juce::int32 s_blockSizes[b2_blockSizes]; + static juce::uint8 s_blockSizeLookup[b2_maxBlockSize + 1]; static bool s_blockSizeLookupInitialized; }; diff --git a/modules/juce_box2d/box2d/Common/b2Draw.h b/modules/juce_box2d/box2d/Common/b2Draw.h index c8c4dc2454..2d27c81ddc 100644 --- a/modules/juce_box2d/box2d/Common/b2Draw.h +++ b/modules/juce_box2d/box2d/Common/b2Draw.h @@ -50,22 +50,22 @@ public: }; /// Set the drawing flags. - void SetFlags(uint32 flags); + void SetFlags(juce::uint32 flags); /// Get the drawing flags. - uint32 GetFlags() const; + juce::uint32 GetFlags() const; /// Append flags to the current flags. - void AppendFlags(uint32 flags); + void AppendFlags(juce::uint32 flags); /// Clear flags from the current flags. - void ClearFlags(uint32 flags); + void ClearFlags(juce::uint32 flags); /// Draw a closed polygon provided in CCW order. - virtual void DrawPolygon(const b2Vec2* vertices, int32 vertexCount, const b2Color& color) = 0; + virtual void DrawPolygon(const b2Vec2* vertices, juce::int32 vertexCount, const b2Color& color) = 0; /// Draw a solid closed polygon provided in CCW order. - virtual void DrawSolidPolygon(const b2Vec2* vertices, int32 vertexCount, const b2Color& color) = 0; + virtual void DrawSolidPolygon(const b2Vec2* vertices, juce::int32 vertexCount, const b2Color& color) = 0; /// Draw a circle. virtual void DrawCircle(const b2Vec2& center, float32 radius, const b2Color& color) = 0; @@ -81,7 +81,7 @@ public: virtual void DrawTransform(const b2Transform& xf) = 0; protected: - uint32 m_drawFlags; + juce::uint32 m_drawFlags; }; #endif diff --git a/modules/juce_box2d/box2d/Common/b2GrowableStack.h b/modules/juce_box2d/box2d/Common/b2GrowableStack.h index 271084755c..3a569052da 100644 --- a/modules/juce_box2d/box2d/Common/b2GrowableStack.h +++ b/modules/juce_box2d/box2d/Common/b2GrowableStack.h @@ -25,7 +25,7 @@ /// This is a growable LIFO stack with an initial capacity of N. /// If the stack size exceeds the initial capacity, the heap is used /// to increase the size of the stack. -template +template class b2GrowableStack { public: @@ -70,7 +70,7 @@ public: return m_stack[m_count]; } - int32 GetCount() + juce::int32 GetCount() { return m_count; } @@ -78,8 +78,8 @@ public: private: T* m_stack; T m_array[N]; - int32 m_count; - int32 m_capacity; + juce::int32 m_count; + juce::int32 m_capacity; }; diff --git a/modules/juce_box2d/box2d/Common/b2Math.h b/modules/juce_box2d/box2d/Common/b2Math.h index c8f0a4fddb..f1b3d1708d 100644 --- a/modules/juce_box2d/box2d/Common/b2Math.h +++ b/modules/juce_box2d/box2d/Common/b2Math.h @@ -46,7 +46,7 @@ inline float32 b2InvSqrt(float32 x) union { float32 x; - int32 i; + juce::int32 i; } convert; convert.x = x; @@ -79,13 +79,13 @@ struct b2Vec2 b2Vec2 operator -() const { b2Vec2 v; v.Set(-x, -y); return v; } /// Read from and indexed element. - float32 operator () (int32 i) const + float32 operator () (juce::int32 i) const { return (&x)[i]; } /// Write to an indexed element. - float32& operator () (int32 i) + float32& operator () (juce::int32 i) { return (&x)[i]; } @@ -684,7 +684,7 @@ template inline void b2Swap(T& a, T& b) /// that recursively "folds" the upper bits into the lower bits. This process yields a bit vector with /// the same most significant 1 as x, but all 1's below it. Adding 1 to that value yields the next /// largest power of 2. For a 32-bit value:" -inline uint32 b2NextPowerOfTwo(uint32 x) +inline juce::uint32 b2NextPowerOfTwo(juce::uint32 x) { x |= (x >> 1); x |= (x >> 2); @@ -694,7 +694,7 @@ inline uint32 b2NextPowerOfTwo(uint32 x) return x + 1; } -inline bool b2IsPowerOfTwo(uint32 x) +inline bool b2IsPowerOfTwo(juce::uint32 x) { bool result = x > 0 && (x & (x - 1)) == 0; return result; diff --git a/modules/juce_box2d/box2d/Common/b2Settings.h b/modules/juce_box2d/box2d/Common/b2Settings.h index 7e0a165b54..d367de56e5 100644 --- a/modules/juce_box2d/box2d/Common/b2Settings.h +++ b/modules/juce_box2d/box2d/Common/b2Settings.h @@ -25,12 +25,6 @@ #define B2_NOT_USED(x) ((void)(x)) #define b2Assert(A) assert(A) -typedef signed char int8; -typedef signed short int16; -typedef signed int int32; -typedef unsigned char uint8; -typedef unsigned short uint16; -typedef unsigned int uint32; typedef float float32; typedef double float64; @@ -127,7 +121,7 @@ typedef double float64; // Memory Allocation /// Implement this function to use your own memory allocator. -void* b2Alloc(int32 size); +void* b2Alloc(juce::int32 size); /// If you implement b2Alloc, you should also implement this function. void b2Free(void* mem); @@ -139,9 +133,9 @@ void b2Log(const char* string, ...); /// See http://en.wikipedia.org/wiki/Software_versioning struct b2Version { - int32 major; ///< significant changes - int32 minor; ///< incremental changes - int32 revision; ///< bug fixes + juce::int32 major; ///< significant changes + juce::int32 minor; ///< incremental changes + juce::int32 revision; ///< bug fixes }; /// Current version. diff --git a/modules/juce_box2d/box2d/Common/b2StackAllocator.h b/modules/juce_box2d/box2d/Common/b2StackAllocator.h index d71d9f0ff9..2a81979262 100644 --- a/modules/juce_box2d/box2d/Common/b2StackAllocator.h +++ b/modules/juce_box2d/box2d/Common/b2StackAllocator.h @@ -21,13 +21,13 @@ #include "b2Settings.h" -const int32 b2_stackSize = 100 * 1024; // 100k -const int32 b2_maxStackEntries = 32; +const juce::int32 b2_stackSize = 100 * 1024; // 100k +const juce::int32 b2_maxStackEntries = 32; struct b2StackEntry { char* data; - int32 size; + juce::int32 size; bool usedMalloc; }; @@ -40,21 +40,21 @@ public: b2StackAllocator(); ~b2StackAllocator(); - void* Allocate(int32 size); + void* Allocate(juce::int32 size); void Free(void* p); - int32 GetMaxAllocation() const; + juce::int32 GetMaxAllocation() const; private: char m_data[b2_stackSize]; - int32 m_index; + juce::int32 m_index; - int32 m_allocation; - int32 m_maxAllocation; + juce::int32 m_allocation; + juce::int32 m_maxAllocation; b2StackEntry m_entries[b2_maxStackEntries]; - int32 m_entryCount; + juce::int32 m_entryCount; }; #endif diff --git a/modules/juce_box2d/box2d/Dynamics/Contacts/b2Contact.h b/modules/juce_box2d/box2d/Dynamics/Contacts/b2Contact.h index a5bde5b59c..d223e5b6d3 100644 --- a/modules/juce_box2d/box2d/Dynamics/Contacts/b2Contact.h +++ b/modules/juce_box2d/box2d/Dynamics/Contacts/b2Contact.h @@ -46,8 +46,8 @@ inline float32 b2MixRestitution(float32 restitution1, float32 restitution2) return restitution1 > restitution2 ? restitution1 : restitution2; } -typedef b2Contact* b2ContactCreateFcn( b2Fixture* fixtureA, int32 indexA, - b2Fixture* fixtureB, int32 indexB, +typedef b2Contact* b2ContactCreateFcn( b2Fixture* fixtureA, juce::int32 indexA, + b2Fixture* fixtureB, juce::int32 indexB, b2BlockAllocator* allocator); typedef void b2ContactDestroyFcn(b2Contact* contact, b2BlockAllocator* allocator); @@ -106,14 +106,14 @@ public: const b2Fixture* GetFixtureA() const; /// Get the child primitive index for fixture A. - int32 GetChildIndexA() const; + juce::int32 GetChildIndexA() const; /// Get fixture B in this contact. b2Fixture* GetFixtureB(); const b2Fixture* GetFixtureB() const; /// Get the child primitive index for fixture B. - int32 GetChildIndexB() const; + juce::int32 GetChildIndexB() const; /// Override the default friction mixture. You can call this in b2ContactListener::PreSolve. /// This value persists until set or reset. @@ -173,12 +173,12 @@ protected: static void AddType(b2ContactCreateFcn* createFcn, b2ContactDestroyFcn* destroyFcn, b2Shape::Type typeA, b2Shape::Type typeB); static void InitializeRegisters(); - static b2Contact* Create(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator); + static b2Contact* Create(b2Fixture* fixtureA, juce::int32 indexA, b2Fixture* fixtureB, juce::int32 indexB, b2BlockAllocator* allocator); static void Destroy(b2Contact* contact, b2Shape::Type typeA, b2Shape::Type typeB, b2BlockAllocator* allocator); static void Destroy(b2Contact* contact, b2BlockAllocator* allocator); b2Contact() : m_fixtureA(NULL), m_fixtureB(NULL) {} - b2Contact(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB); + b2Contact(b2Fixture* fixtureA, juce::int32 indexA, b2Fixture* fixtureB, juce::int32 indexB); virtual ~b2Contact() {} void Update(b2ContactListener* listener); @@ -186,7 +186,7 @@ protected: static b2ContactRegister s_registers[b2Shape::e_typeCount][b2Shape::e_typeCount]; static bool s_initialized; - uint32 m_flags; + juce::uint32 m_flags; // World pool and list pointers. b2Contact* m_prev; @@ -199,12 +199,12 @@ protected: b2Fixture* m_fixtureA; b2Fixture* m_fixtureB; - int32 m_indexA; - int32 m_indexB; + juce::int32 m_indexA; + juce::int32 m_indexB; b2Manifold m_manifold; - int32 m_toiCount; + juce::int32 m_toiCount; float32 m_toi; float32 m_friction; @@ -278,7 +278,7 @@ inline b2Fixture* b2Contact::GetFixtureB() return m_fixtureB; } -inline int32 b2Contact::GetChildIndexA() const +inline juce::int32 b2Contact::GetChildIndexA() const { return m_indexA; } @@ -288,7 +288,7 @@ inline const b2Fixture* b2Contact::GetFixtureB() const return m_fixtureB; } -inline int32 b2Contact::GetChildIndexB() const +inline juce::int32 b2Contact::GetChildIndexB() const { return m_indexB; } diff --git a/modules/juce_box2d/box2d/Dynamics/Joints/b2DistanceJoint.h b/modules/juce_box2d/box2d/Dynamics/Joints/b2DistanceJoint.h index d5deb2e6ee..f28979ebd0 100644 --- a/modules/juce_box2d/box2d/Dynamics/Joints/b2DistanceJoint.h +++ b/modules/juce_box2d/box2d/Dynamics/Joints/b2DistanceJoint.h @@ -122,8 +122,8 @@ protected: float32 m_length; // Solver temp - int32 m_indexA; - int32 m_indexB; + juce::int32 m_indexA; + juce::int32 m_indexB; b2Vec2 m_u; b2Vec2 m_rA; b2Vec2 m_rB; diff --git a/modules/juce_box2d/box2d/Dynamics/Joints/b2FrictionJoint.h b/modules/juce_box2d/box2d/Dynamics/Joints/b2FrictionJoint.h index c8fc01eb04..1b8283eb55 100644 --- a/modules/juce_box2d/box2d/Dynamics/Joints/b2FrictionJoint.h +++ b/modules/juce_box2d/box2d/Dynamics/Joints/b2FrictionJoint.h @@ -102,8 +102,8 @@ protected: float32 m_maxTorque; // Solver temp - int32 m_indexA; - int32 m_indexB; + juce::int32 m_indexA; + juce::int32 m_indexB; b2Vec2 m_rA; b2Vec2 m_rB; b2Vec2 m_localCenterA; diff --git a/modules/juce_box2d/box2d/Dynamics/Joints/b2GearJoint.h b/modules/juce_box2d/box2d/Dynamics/Joints/b2GearJoint.h index 7750e83043..4e54d61e23 100644 --- a/modules/juce_box2d/box2d/Dynamics/Joints/b2GearJoint.h +++ b/modules/juce_box2d/box2d/Dynamics/Joints/b2GearJoint.h @@ -113,7 +113,7 @@ protected: float32 m_impulse; // Solver temp - int32 m_indexA, m_indexB, m_indexC, m_indexD; + juce::int32 m_indexA, m_indexB, m_indexC, m_indexD; b2Vec2 m_lcA, m_lcB, m_lcC, m_lcD; float32 m_mA, m_mB, m_mC, m_mD; float32 m_iA, m_iB, m_iC, m_iD; diff --git a/modules/juce_box2d/box2d/Dynamics/Joints/b2Joint.h b/modules/juce_box2d/box2d/Dynamics/Joints/b2Joint.h index 4ad9aa808b..b344bd2093 100644 --- a/modules/juce_box2d/box2d/Dynamics/Joints/b2Joint.h +++ b/modules/juce_box2d/box2d/Dynamics/Joints/b2Joint.h @@ -171,7 +171,7 @@ protected: b2Body* m_bodyA; b2Body* m_bodyB; - int32 m_index; + juce::int32 m_index; bool m_islandFlag; bool m_collideConnected; diff --git a/modules/juce_box2d/box2d/Dynamics/Joints/b2MouseJoint.h b/modules/juce_box2d/box2d/Dynamics/Joints/b2MouseJoint.h index 592df8c918..bf0f511cea 100644 --- a/modules/juce_box2d/box2d/Dynamics/Joints/b2MouseJoint.h +++ b/modules/juce_box2d/box2d/Dynamics/Joints/b2MouseJoint.h @@ -113,8 +113,8 @@ protected: float32 m_gamma; // Solver temp - int32 m_indexA; - int32 m_indexB; + juce::int32 m_indexA; + juce::int32 m_indexB; b2Vec2 m_rB; b2Vec2 m_localCenterB; float32 m_invMassB; diff --git a/modules/juce_box2d/box2d/Dynamics/Joints/b2PrismaticJoint.h b/modules/juce_box2d/box2d/Dynamics/Joints/b2PrismaticJoint.h index 1cf15d33c7..0d556bb6ba 100644 --- a/modules/juce_box2d/box2d/Dynamics/Joints/b2PrismaticJoint.h +++ b/modules/juce_box2d/box2d/Dynamics/Joints/b2PrismaticJoint.h @@ -173,8 +173,8 @@ protected: b2LimitState m_limitState; // Solver temp - int32 m_indexA; - int32 m_indexB; + juce::int32 m_indexA; + juce::int32 m_indexB; b2Vec2 m_localCenterA; b2Vec2 m_localCenterB; float32 m_invMassA; diff --git a/modules/juce_box2d/box2d/Dynamics/Joints/b2PulleyJoint.h b/modules/juce_box2d/box2d/Dynamics/Joints/b2PulleyJoint.h index e2be2051bb..cb674c96af 100644 --- a/modules/juce_box2d/box2d/Dynamics/Joints/b2PulleyJoint.h +++ b/modules/juce_box2d/box2d/Dynamics/Joints/b2PulleyJoint.h @@ -125,8 +125,8 @@ protected: float32 m_impulse; // Solver temp - int32 m_indexA; - int32 m_indexB; + juce::int32 m_indexA; + juce::int32 m_indexB; b2Vec2 m_uA; b2Vec2 m_uB; b2Vec2 m_rA; diff --git a/modules/juce_box2d/box2d/Dynamics/Joints/b2RevoluteJoint.h b/modules/juce_box2d/box2d/Dynamics/Joints/b2RevoluteJoint.h index ce375c16b5..8d7aed052e 100644 --- a/modules/juce_box2d/box2d/Dynamics/Joints/b2RevoluteJoint.h +++ b/modules/juce_box2d/box2d/Dynamics/Joints/b2RevoluteJoint.h @@ -181,8 +181,8 @@ protected: float32 m_upperAngle; // Solver temp - int32 m_indexA; - int32 m_indexB; + juce::int32 m_indexA; + juce::int32 m_indexB; b2Vec2 m_rA; b2Vec2 m_rB; b2Vec2 m_localCenterA; diff --git a/modules/juce_box2d/box2d/Dynamics/Joints/b2RopeJoint.h b/modules/juce_box2d/box2d/Dynamics/Joints/b2RopeJoint.h index b2375de147..296984e14d 100644 --- a/modules/juce_box2d/box2d/Dynamics/Joints/b2RopeJoint.h +++ b/modules/juce_box2d/box2d/Dynamics/Joints/b2RopeJoint.h @@ -96,8 +96,8 @@ protected: float32 m_impulse; // Solver temp - int32 m_indexA; - int32 m_indexB; + juce::int32 m_indexA; + juce::int32 m_indexB; b2Vec2 m_u; b2Vec2 m_rA; b2Vec2 m_rB; diff --git a/modules/juce_box2d/box2d/Dynamics/Joints/b2WeldJoint.h b/modules/juce_box2d/box2d/Dynamics/Joints/b2WeldJoint.h index d38b0c436c..329a51b57b 100644 --- a/modules/juce_box2d/box2d/Dynamics/Joints/b2WeldJoint.h +++ b/modules/juce_box2d/box2d/Dynamics/Joints/b2WeldJoint.h @@ -110,8 +110,8 @@ protected: b2Vec3 m_impulse; // Solver temp - int32 m_indexA; - int32 m_indexB; + juce::int32 m_indexA; + juce::int32 m_indexB; b2Vec2 m_rA; b2Vec2 m_rB; b2Vec2 m_localCenterA; diff --git a/modules/juce_box2d/box2d/Dynamics/Joints/b2WheelJoint.h b/modules/juce_box2d/box2d/Dynamics/Joints/b2WheelJoint.h index b8e26dd0b6..01cb7f7700 100644 --- a/modules/juce_box2d/box2d/Dynamics/Joints/b2WheelJoint.h +++ b/modules/juce_box2d/box2d/Dynamics/Joints/b2WheelJoint.h @@ -159,8 +159,8 @@ protected: bool m_enableMotor; // Solver temp - int32 m_indexA; - int32 m_indexB; + juce::int32 m_indexA; + juce::int32 m_indexB; b2Vec2 m_localCenterA; b2Vec2 m_localCenterB; float32 m_invMassA; diff --git a/modules/juce_box2d/box2d/Dynamics/b2Body.h b/modules/juce_box2d/box2d/Dynamics/b2Body.h index a56e23b59b..6c53cc2583 100644 --- a/modules/juce_box2d/box2d/Dynamics/b2Body.h +++ b/modules/juce_box2d/box2d/Dynamics/b2Body.h @@ -423,9 +423,9 @@ private: b2BodyType m_type; - uint16 m_flags; + juce::uint16 m_flags; - int32 m_islandIndex; + juce::int32 m_islandIndex; b2Transform m_xf; // the body origin transform b2Sweep m_sweep; // the swept motion for CCD @@ -441,7 +441,7 @@ private: b2Body* m_next; b2Fixture* m_fixtureList; - int32 m_fixtureCount; + juce::int32 m_fixtureCount; b2JointEdge* m_jointList; b2ContactEdge* m_contactList; diff --git a/modules/juce_box2d/box2d/Dynamics/b2ContactManager.h b/modules/juce_box2d/box2d/Dynamics/b2ContactManager.h index 54334ae36e..0d9f466bb1 100644 --- a/modules/juce_box2d/box2d/Dynamics/b2ContactManager.h +++ b/modules/juce_box2d/box2d/Dynamics/b2ContactManager.h @@ -43,7 +43,7 @@ public: b2BroadPhase m_broadPhase; b2Contact* m_contactList; - int32 m_contactCount; + juce::int32 m_contactCount; b2ContactFilter* m_contactFilter; b2ContactListener* m_contactListener; b2BlockAllocator* m_allocator; diff --git a/modules/juce_box2d/box2d/Dynamics/b2Fixture.h b/modules/juce_box2d/box2d/Dynamics/b2Fixture.h index 3249c89223..c126b7f7cb 100644 --- a/modules/juce_box2d/box2d/Dynamics/b2Fixture.h +++ b/modules/juce_box2d/box2d/Dynamics/b2Fixture.h @@ -39,16 +39,16 @@ struct b2Filter } /// The collision category bits. Normally you would just set one bit. - uint16 categoryBits; + juce::uint16 categoryBits; /// The collision mask bits. This states the categories that this /// shape would accept for collision. - uint16 maskBits; + juce::uint16 maskBits; /// Collision groups allow a certain group of objects to never collide (negative) /// or always collide (positive). Zero means no collision group. Non-zero group /// filtering always wins against the mask bits. - int16 groupIndex; + juce::int16 groupIndex; }; /// A fixture definition is used to create a fixture. This class defines an @@ -95,8 +95,8 @@ struct b2FixtureProxy { b2AABB aabb; b2Fixture* fixture; - int32 childIndex; - int32 proxyId; + juce::int32 childIndex; + juce::int32 proxyId; }; /// A fixture is used to attach a shape to a body for collision detection. A fixture @@ -159,7 +159,7 @@ public: /// Cast a ray against this shape. /// @param output the ray-cast results. /// @param input the ray-cast input parameters. - bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input, int32 childIndex) const; + bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input, juce::int32 childIndex) const; /// Get the mass data for this fixture. The mass data is based on the density and /// the shape. The rotational inertia is about the shape's origin. This operation @@ -190,10 +190,10 @@ public: /// Get the fixture's AABB. This AABB may be enlarge and/or stale. /// If you need a more accurate AABB, compute it using the shape and /// the body transform. - const b2AABB& GetAABB(int32 childIndex) const; + const b2AABB& GetAABB(juce::int32 childIndex) const; /// Dump this fixture to the log file. - void Dump(int32 bodyIndex); + void Dump(juce::int32 bodyIndex); protected: @@ -226,7 +226,7 @@ protected: float32 m_restitution; b2FixtureProxy* m_proxies; - int32 m_proxyCount; + juce::int32 m_proxyCount; b2Filter m_filter; @@ -326,7 +326,7 @@ inline bool b2Fixture::TestPoint(const b2Vec2& p) const return m_shape->TestPoint(m_body->GetTransform(), p); } -inline bool b2Fixture::RayCast(b2RayCastOutput* output, const b2RayCastInput& input, int32 childIndex) const +inline bool b2Fixture::RayCast(b2RayCastOutput* output, const b2RayCastInput& input, juce::int32 childIndex) const { return m_shape->RayCast(output, input, m_body->GetTransform(), childIndex); } @@ -336,7 +336,7 @@ inline void b2Fixture::GetMassData(b2MassData* massData) const m_shape->ComputeMass(massData, m_density); } -inline const b2AABB& b2Fixture::GetAABB(int32 childIndex) const +inline const b2AABB& b2Fixture::GetAABB(juce::int32 childIndex) const { b2Assert(0 <= childIndex && childIndex < m_proxyCount); return m_proxies[childIndex].aabb; diff --git a/modules/juce_box2d/box2d/Dynamics/b2TimeStep.h b/modules/juce_box2d/box2d/Dynamics/b2TimeStep.h index 9c2163ad91..af60d5a10f 100644 --- a/modules/juce_box2d/box2d/Dynamics/b2TimeStep.h +++ b/modules/juce_box2d/box2d/Dynamics/b2TimeStep.h @@ -40,8 +40,8 @@ struct b2TimeStep float32 dt; // time step float32 inv_dt; // inverse time step (0 if dt == 0). float32 dtRatio; // dt * inv_dt0 - int32 velocityIterations; - int32 positionIterations; + juce::int32 velocityIterations; + juce::int32 positionIterations; bool warmStarting; }; diff --git a/modules/juce_box2d/box2d/Dynamics/b2World.h b/modules/juce_box2d/box2d/Dynamics/b2World.h index 25cd6baccc..2669b5ef33 100644 --- a/modules/juce_box2d/box2d/Dynamics/b2World.h +++ b/modules/juce_box2d/box2d/Dynamics/b2World.h @@ -92,8 +92,8 @@ public: /// @param velocityIterations for the velocity constraint solver. /// @param positionIterations for the position constraint solver. void Step( float32 timeStep, - int32 velocityIterations, - int32 positionIterations); + juce::int32 velocityIterations, + juce::int32 positionIterations); /// Manually clear the force buffer on all bodies. By default, forces are cleared automatically /// after each call to Step. The default behavior is modified by calling SetAutoClearForces. @@ -158,22 +158,22 @@ public: bool GetSubStepping() const { return m_subStepping; } /// Get the number of broad-phase proxies. - int32 GetProxyCount() const; + juce::int32 GetProxyCount() const; /// Get the number of bodies. - int32 GetBodyCount() const; + juce::int32 GetBodyCount() const; /// Get the number of joints. - int32 GetJointCount() const; + juce::int32 GetJointCount() const; /// Get the number of contacts (each may have 0 or more contact points). - int32 GetContactCount() const; + juce::int32 GetContactCount() const; /// Get the height of the dynamic tree. - int32 GetTreeHeight() const; + juce::int32 GetTreeHeight() const; /// Get the balance of the dynamic tree. - int32 GetTreeBalance() const; + juce::int32 GetTreeBalance() const; /// Get the quality metric of the dynamic tree. The smaller the better. /// The minimum is 1. @@ -228,15 +228,15 @@ private: b2BlockAllocator m_blockAllocator; b2StackAllocator m_stackAllocator; - int32 m_flags; + juce::int32 m_flags; b2ContactManager m_contactManager; b2Body* m_bodyList; b2Joint* m_jointList; - int32 m_bodyCount; - int32 m_jointCount; + juce::int32 m_bodyCount; + juce::int32 m_jointCount; b2Vec2 m_gravity; bool m_allowSleep; @@ -288,17 +288,17 @@ inline const b2Contact* b2World::GetContactList() const return m_contactManager.m_contactList; } -inline int32 b2World::GetBodyCount() const +inline juce::int32 b2World::GetBodyCount() const { return m_bodyCount; } -inline int32 b2World::GetJointCount() const +inline juce::int32 b2World::GetJointCount() const { return m_jointCount; } -inline int32 b2World::GetContactCount() const +inline juce::int32 b2World::GetContactCount() const { return m_contactManager.m_contactCount; } diff --git a/modules/juce_box2d/box2d/Dynamics/b2WorldCallbacks.h b/modules/juce_box2d/box2d/Dynamics/b2WorldCallbacks.h index 8890731ff9..52114a295f 100644 --- a/modules/juce_box2d/box2d/Dynamics/b2WorldCallbacks.h +++ b/modules/juce_box2d/box2d/Dynamics/b2WorldCallbacks.h @@ -66,7 +66,7 @@ struct b2ContactImpulse { float32 normalImpulses[b2_maxManifoldPoints]; float32 tangentImpulses[b2_maxManifoldPoints]; - int32 count; + juce::int32 count; }; /// Implement this class to get contact information. You can use these results for diff --git a/modules/juce_box2d/juce_box2d.cpp b/modules/juce_box2d/juce_box2d.cpp index aa1b1ab050..ab6bade7c7 100644 --- a/modules/juce_box2d/juce_box2d.cpp +++ b/modules/juce_box2d/juce_box2d.cpp @@ -45,6 +45,14 @@ #include "juce_box2d.h" +typedef juce::int8 int8; +typedef juce::int16 int16; +typedef juce::int32 int32; +typedef juce::uint8 uint8; +typedef juce::uint16 uint16; +typedef juce::uint32 uint32; + + #include "box2d/Collision/b2BroadPhase.cpp" #include "box2d/Collision/b2CollideCircle.cpp" #include "box2d/Collision/b2CollideEdge.cpp"