diff --git a/include/eepp/physics/arbiter.hpp b/include/eepp/physics/arbiter.hpp index e496c30aa..68f44684d 100644 --- a/include/eepp/physics/arbiter.hpp +++ b/include/eepp/physics/arbiter.hpp @@ -11,47 +11,47 @@ class CP_API Arbiter { public: Arbiter( cpArbiter * arbiter ); - cVect TotalImpulse(); + cVect totalImpulse(); - cVect TotalImpulseWithFriction(); + cVect totalImpulseWithFriction(); - void Ignore(); + void ignore(); - void GetShapes( Shape ** a, Shape ** b ); + void getShapes( Shape ** a, Shape ** b ); - void GetBodies( Body ** a, Body ** b); + void getBodies( Body ** a, Body ** b); - bool IsFirstContact(); + bool isFirstContact(); - int GetCount(); + int getCount(); - cVect GetNormal( int i ); + cVect getNormal( int i ); - cVect GetPoint( int i ); + cVect getPoint( int i ); - cpFloat GetDepth( int i ); + cpFloat getDepth( int i ); - cpContactPointSet ContactPointSet(); + cpContactPointSet contactPointSet(); - void ContactPointSet( cpContactPointSet * contact ); + void contactPointSet( cpContactPointSet * contact ); - cpArbiter * GetArbiter() const; + cpArbiter * getArbiter() const; - cpFloat Elasticity(); + cpFloat elasticity(); - void Elasticity( cpFloat value ); + void elasticity( cpFloat value ); - cpFloat Friction(); + cpFloat friction(); - void Friction( cpFloat value ); + void friction( cpFloat value ); - cVect SurfaceVelocity(); + cVect surfaceVelocity(); - void SurfaceVelocity( cVect value ); + void surfaceVelocity( cVect value ); - void UserData( cpDataPointer value ); + void userData( cpDataPointer value ); - cpDataPointer UserData() const; + cpDataPointer userData() const; protected: cpArbiter * mArbiter; }; diff --git a/include/eepp/physics/area.hpp b/include/eepp/physics/area.hpp index 1d0dd02e0..f6afa83a3 100644 --- a/include/eepp/physics/area.hpp +++ b/include/eepp/physics/area.hpp @@ -7,11 +7,11 @@ CP_NAMESPACE_BEGIN class CP_API Area { public: - cpFloat ForCircle( cpFloat r1, cpFloat r2 ); + cpFloat forCircle( cpFloat r1, cpFloat r2 ); - cpFloat ForSegment( cVect a, cVect b, cpFloat r ); + cpFloat forSegment( cVect a, cVect b, cpFloat r ); - cpFloat ForPoly( const int numVerts, const cVect * verts ); + cpFloat forPoly( const int numVerts, const cVect * verts ); }; CP_NAMESPACE_END diff --git a/include/eepp/physics/body.hpp b/include/eepp/physics/body.hpp index 94079131a..2707aaa73 100644 --- a/include/eepp/physics/body.hpp +++ b/include/eepp/physics/body.hpp @@ -72,109 +72,109 @@ class CP_API Body { virtual ~Body(); - void Activate(); + void activate(); - void ActivateStatic( Body *body, Shape * filter ); + void activateStatic( Body *body, Shape * filter ); - void Sleep(); + void sleep(); - void SleepWithGroup( Body * Group ); + void sleepWithGroup( Body * Group ); - bool IsSleeping(); + bool isSleeping(); - bool IsStatic(); + bool isStatic(); - bool IsRogue(); + bool isRogue(); - cpBody * GetBody() const; + cpBody * getBody() const; - cpFloat Mass() const; + cpFloat mass() const; - void Mass( const cpFloat& mass ); + void mass( const cpFloat& mass ); - cpFloat Moment() const; + cpFloat moment() const; - void Moment( const cpFloat& i ); + void moment( const cpFloat& i ); - cVect Pos() const; + cVect pos() const; - void Pos( const cVect& pos ); + void pos( const cVect& pos ); - cVect Vel() const; + cVect vel() const; - void Vel( const cVect& vel ); + void vel( const cVect& vel ); - cVect Force() const; + cVect force() const; - void Force( const cVect& force ); + void force( const cVect& force ); - cpFloat Angle() const; + cpFloat angle() const; - void Angle( const cpFloat& rads ); + void angle( const cpFloat& rads ); - cpFloat AngleDeg(); + cpFloat angleDeg(); - void AngleDeg( const cpFloat& angle ); + void angleDeg( const cpFloat& angle ); - cpFloat AngVel() const; + cpFloat angVel() const; - void AngVel( const cpFloat& angVel ); + void angVel( const cpFloat& angVel ); - cpFloat Torque() const; + cpFloat torque() const; - void Torque( const cpFloat& torque ); + void torque( const cpFloat& torque ); - cVect Rot() const; + cVect rot() const; - cpFloat VelLimit() const; + cpFloat velLimit() const; - void VelLimit( const cpFloat& speed ); + void velLimit( const cpFloat& speed ); - cpFloat AngVelLimit() const; + cpFloat angVelLimit() const; - void AngVelLimit( const cpFloat& speed ); + void angVelLimit( const cpFloat& speed ); - void UpdateVelocity( cVect gravity, cpFloat damping, cpFloat dt ); + void updateVelocity( cVect gravity, cpFloat damping, cpFloat dt ); - void UpdatePosition( cpFloat dt ); + void updatePosition( cpFloat dt ); - cVect Local2World( const cVect v ); + cVect local2World( const cVect v ); - cVect World2Local( const cVect v ); + cVect world2Local( const cVect v ); - void ApplyImpulse( const cVect j, const cVect r ); + void applyImpulse( const cVect j, const cVect r ); - void ResetForces(); + void resetForces(); - void ApplyForce( const cVect f, const cVect r ); + void applyForce( const cVect f, const cVect r ); - cpFloat KineticEnergy(); + cpFloat kineticEnergy(); - void * Data() const; + void * data() const; - void Data( void * data ); + void data( void * data ); - void EachShape( ShapeIteratorFunc Func, void * data ); + void eachShape( ShapeIteratorFunc Func, void * data ); - virtual void OnEachShape( Shape * Shape, ShapeIterator * it ); + virtual void onEachShape( Shape * Shape, ShapeIterator * it ); - void EachConstraint( ConstraintIteratorFunc Func, void * data ); + void eachConstraint( ConstraintIteratorFunc Func, void * data ); - virtual void OnEachConstraint( Constraint * Constraint, ConstraintIterator * it ); + virtual void onEachConstraint( Constraint * Constraint, ConstraintIterator * it ); - void EachArbiter( ArbiterIteratorFunc Func, void * data ); + void eachArbiter( ArbiterIteratorFunc Func, void * data ); - virtual void OnEachArbiter( Arbiter * Arbiter, ArbiterIterator * it ); + virtual void onEachArbiter( Arbiter * Arbiter, ArbiterIterator * it ); - void VelocityFunc( BodyVelocityFunc func ); + void velocityFunc( BodyVelocityFunc func ); - void PositionFunc( BodyPositionFunc func ); + void positionFunc( BodyPositionFunc func ); protected: friend class Space; - static void BodyVelocityFuncWrapper( cpBody *body, cpVect gravity, cpFloat damping, cpFloat dt ); + static void bodyVelocityFuncWrapper( cpBody *body, cpVect gravity, cpFloat damping, cpFloat dt ); - static void BodyPositionFuncWrapper( cpBody* body, cpFloat dt ); + static void bodyPositionFuncWrapper( cpBody* body, cpFloat dt ); cpBody * mBody; void * mData; @@ -183,7 +183,7 @@ class CP_API Body { BodyPositionFunc mPositionFunc; - void SetData(); + void setData(); }; CP_NAMESPACE_END diff --git a/include/eepp/physics/constraints/constraint.hpp b/include/eepp/physics/constraints/constraint.hpp index dff7b2f7e..d7abf1972 100644 --- a/include/eepp/physics/constraints/constraint.hpp +++ b/include/eepp/physics/constraints/constraint.hpp @@ -14,31 +14,31 @@ class CP_API Constraint { virtual ~Constraint(); - cpConstraint * GetConstraint() const; + cpConstraint * getConstraint() const; - Body * A(); + Body * a(); - Body * B(); + Body * b(); - cpFloat MaxForce(); + cpFloat maxForce(); - void MaxForce( const cpFloat& maxforce ); + void maxForce( const cpFloat& maxforce ); - cpFloat MaxBias(); + cpFloat maxBias(); - void MaxBias( const cpFloat& maxbias ); + void maxBias( const cpFloat& maxbias ); - virtual void Draw(); + virtual void draw(); - cpFloat ErrorBias(); + cpFloat errorBias(); - void ErrorBias( cpFloat value ); + void errorBias( cpFloat value ); - void Data( void * data ); + void data( void * data ); - void * Data() const; + void * data() const; - cpFloat Impulse(); + cpFloat impulse(); protected: cpConstraint * mConstraint; @@ -46,7 +46,7 @@ class CP_API Constraint { Constraint(); - void SetData(); + void setData(); }; CP_NAMESPACE_END diff --git a/include/eepp/physics/constraints/dampedrotaryspring.hpp b/include/eepp/physics/constraints/dampedrotaryspring.hpp index 6f6818c78..bd3b0e308 100644 --- a/include/eepp/physics/constraints/dampedrotaryspring.hpp +++ b/include/eepp/physics/constraints/dampedrotaryspring.hpp @@ -9,19 +9,19 @@ class CP_API DampedRotarySpring : public Constraint { public: DampedRotarySpring( Body * a, Body * b, cpFloat restAngle, cpFloat stiffness, cpFloat damping ); - cpFloat RestAngle(); + cpFloat restAngle(); - void RestAngle( const cpFloat& restangle ); + void restAngle( const cpFloat& restangle ); - cpFloat Stiffness(); + cpFloat stiffness(); - void Stiffness( const cpFloat& stiffness ); + void stiffness( const cpFloat& stiffness ); - cpFloat Damping(); + cpFloat damping(); - void Damping( const cpFloat& damping ); + void damping( const cpFloat& damping ); - virtual void Draw(); + virtual void draw(); }; CP_NAMESPACE_END diff --git a/include/eepp/physics/constraints/dampedspring.hpp b/include/eepp/physics/constraints/dampedspring.hpp index d054c80fd..1216e5367 100644 --- a/include/eepp/physics/constraints/dampedspring.hpp +++ b/include/eepp/physics/constraints/dampedspring.hpp @@ -9,32 +9,32 @@ class CP_API DampedSpring : public Constraint { public: DampedSpring( Body * a, Body * b, cVect anchr1, cVect anchr2, cpFloat restLength, cpFloat stiffness, cpFloat damping ); - cVect Anchr1(); + cVect anchr1(); - void Anchr1( const cVect& anchr1 ); + void anchr1( const cVect& anchr1 ); - cVect Anchr2(); + cVect anchr2(); - void Anchr2( const cVect& anchr2 ); + void anchr2( const cVect& anchr2 ); - cpFloat RestLength(); + cpFloat restLength(); - void RestLength( const cpFloat& restlength ); + void restLength( const cpFloat& restlength ); - cpFloat Stiffness(); + cpFloat stiffness(); - void Stiffness( const cpFloat& stiffness ); + void stiffness( const cpFloat& stiffness ); - cpFloat Damping(); + cpFloat damping(); - void Damping( const cpFloat& damping ); + void damping( const cpFloat& damping ); - virtual void Draw(); + virtual void draw(); #ifdef PHYSICS_RENDERER_ENABLED - cpFloat DrawPointSize(); + cpFloat drawPointSize(); - virtual void DrawPointSize( const cpFloat& size ); + virtual void drawPointSize( const cpFloat& size ); protected: cpFloat mDrawPointSize; #endif diff --git a/include/eepp/physics/constraints/gearjoint.hpp b/include/eepp/physics/constraints/gearjoint.hpp index d57369261..fff6afbe9 100644 --- a/include/eepp/physics/constraints/gearjoint.hpp +++ b/include/eepp/physics/constraints/gearjoint.hpp @@ -9,15 +9,15 @@ class CP_API GearJoint : public Constraint { public: GearJoint( Body * a, Body * b, cpFloat phase, cpFloat ratio ); - cpFloat Phase(); + cpFloat phase(); - void Phase( const cpFloat& phase ); + void phase( const cpFloat& phase ); - cpFloat Ratio(); + cpFloat ratio(); - void Ratio( const cpFloat& ratio ); + void ratio( const cpFloat& ratio ); - virtual void Draw(); + virtual void draw(); }; CP_NAMESPACE_END diff --git a/include/eepp/physics/constraints/groovejoint.hpp b/include/eepp/physics/constraints/groovejoint.hpp index f06740d3f..82eee8f88 100644 --- a/include/eepp/physics/constraints/groovejoint.hpp +++ b/include/eepp/physics/constraints/groovejoint.hpp @@ -9,24 +9,24 @@ class CP_API GrooveJoint : public Constraint { public: GrooveJoint( Body * a, Body * b, cVect groove_a, cVect groove_b, cVect anchr2 ); - cVect Anchr2(); + cVect anchr2(); - void Anchr2( const cVect& anchr2 ); + void anchr2( const cVect& anchr2 ); - cVect GrooveA(); + cVect grooveA(); - void GrooveA( const cVect& groove_a ); + void grooveA( const cVect& groove_a ); - cVect GrooveB(); + cVect grooveB(); - void GrooveB( const cVect& groove_b ); + void grooveB( const cVect& groove_b ); - virtual void Draw(); + virtual void draw(); #ifdef PHYSICS_RENDERER_ENABLED - cpFloat DrawPointSize(); + cpFloat drawPointSize(); - virtual void DrawPointSize( const cpFloat& size ); + virtual void drawPointSize( const cpFloat& size ); protected: cpFloat mDrawPointSize; #endif diff --git a/include/eepp/physics/constraints/pinjoint.hpp b/include/eepp/physics/constraints/pinjoint.hpp index 231aaf463..e25bbe2fd 100644 --- a/include/eepp/physics/constraints/pinjoint.hpp +++ b/include/eepp/physics/constraints/pinjoint.hpp @@ -9,24 +9,24 @@ class CP_API PinJoint : public Constraint { public: PinJoint( Body * a, Body * b, cVect anchr1, cVect anchr2 ); - cVect Anchr1(); + cVect anchr1(); - void Anchr1( const cVect& anchr1 ); + void anchr1( const cVect& anchr1 ); - cVect Anchr2(); + cVect anchr2(); - void Anchr2( const cVect& anchr2 ); + void anchr2( const cVect& anchr2 ); - cpFloat Dist(); + cpFloat dist(); - void Dist( const cpFloat& dist ); + void dist( const cpFloat& dist ); - virtual void Draw(); + virtual void draw(); #ifdef PHYSICS_RENDERER_ENABLED - cpFloat DrawPointSize(); + cpFloat drawPointSize(); - virtual void DrawPointSize( const cpFloat& size ); + virtual void drawPointSize( const cpFloat& size ); protected: cpFloat mDrawPointSize; #endif diff --git a/include/eepp/physics/constraints/pivotjoint.hpp b/include/eepp/physics/constraints/pivotjoint.hpp index 3343a0d21..7cbc06420 100644 --- a/include/eepp/physics/constraints/pivotjoint.hpp +++ b/include/eepp/physics/constraints/pivotjoint.hpp @@ -11,20 +11,20 @@ class CP_API PivotJoint : public Constraint { PivotJoint( Body * a, Body * b, cVect anchr1, cVect anchr2 ); - cVect Anchr1(); + cVect anchr1(); - void Anchr1( const cVect& anchr1 ); + void anchr1( const cVect& anchr1 ); - cVect Anchr2(); + cVect anchr2(); - void Anchr2( const cVect& anchr2 ); + void anchr2( const cVect& anchr2 ); - virtual void Draw(); + virtual void draw(); #ifdef PHYSICS_RENDERER_ENABLED - cpFloat DrawPointSize(); + cpFloat drawPointSize(); - virtual void DrawPointSize( const cpFloat& size ); + virtual void drawPointSize( const cpFloat& size ); protected: cpFloat mDrawPointSize; #endif diff --git a/include/eepp/physics/constraints/ratchetjoint.hpp b/include/eepp/physics/constraints/ratchetjoint.hpp index ae1290e6f..6ab9d4f56 100644 --- a/include/eepp/physics/constraints/ratchetjoint.hpp +++ b/include/eepp/physics/constraints/ratchetjoint.hpp @@ -9,19 +9,19 @@ class CP_API RatchetJoint : public Constraint { public: RatchetJoint( Body * a, Body * b, cpFloat phase, cpFloat ratchet ); - cpFloat Angle(); + cpFloat angle(); - void Angle( const cpFloat& angle ); + void angle( const cpFloat& angle ); - cpFloat Phase(); + cpFloat phase(); - void Phase( const cpFloat& phase ); + void phase( const cpFloat& phase ); - cpFloat Ratchet(); + cpFloat ratchet(); - void Ratchet( const cpFloat& ratchet ); + void ratchet( const cpFloat& ratchet ); - virtual void Draw(); + virtual void draw(); }; CP_NAMESPACE_END diff --git a/include/eepp/physics/constraints/rotarylimitjoint.hpp b/include/eepp/physics/constraints/rotarylimitjoint.hpp index 5c28b1b12..ea6a26553 100644 --- a/include/eepp/physics/constraints/rotarylimitjoint.hpp +++ b/include/eepp/physics/constraints/rotarylimitjoint.hpp @@ -9,15 +9,15 @@ class CP_API RotaryLimitJoint : public Constraint { public: RotaryLimitJoint( Body * a, Body * b, cpFloat min, cpFloat max ); - cpFloat Min(); + cpFloat min(); - void Min( const cpFloat& min ); + void min( const cpFloat& min ); - cpFloat Max(); + cpFloat max(); - void Max( const cpFloat& max ); + void max( const cpFloat& max ); - virtual void Draw(); + virtual void draw(); }; CP_NAMESPACE_END diff --git a/include/eepp/physics/constraints/simplemotor.hpp b/include/eepp/physics/constraints/simplemotor.hpp index 5cdce1854..b8730fb37 100644 --- a/include/eepp/physics/constraints/simplemotor.hpp +++ b/include/eepp/physics/constraints/simplemotor.hpp @@ -9,11 +9,11 @@ class CP_API SimpleMotor : public Constraint { public: SimpleMotor( Body * a, Body * b, cpFloat rate ); - cpFloat Rate(); + cpFloat rate(); - void Rate( const cpFloat& rate ); + void rate( const cpFloat& rate ); - virtual void Draw(); + virtual void draw(); }; CP_NAMESPACE_END diff --git a/include/eepp/physics/constraints/slidejoint.hpp b/include/eepp/physics/constraints/slidejoint.hpp index 32363b10a..f5b592ddd 100644 --- a/include/eepp/physics/constraints/slidejoint.hpp +++ b/include/eepp/physics/constraints/slidejoint.hpp @@ -9,28 +9,28 @@ class CP_API SlideJoint : public Constraint { public: SlideJoint( Body * a, Body *b, cVect anchr1, cVect anchr2, cpFloat min, cpFloat max ); - cVect Anchr1(); + cVect anchr1(); - void Anchr1( const cVect& anchr1 ); + void anchr1( const cVect& anchr1 ); - cVect Anchr2(); + cVect anchr2(); - void Anchr2( const cVect& anchr2 ); + void anchr2( const cVect& anchr2 ); - cpFloat Min(); + cpFloat min(); - void Min( const cpFloat& min ); + void min( const cpFloat& min ); - cpFloat Max(); + cpFloat max(); - void Max( const cpFloat& max ); + void max( const cpFloat& max ); - virtual void Draw(); + virtual void draw(); #ifdef PHYSICS_RENDERER_ENABLED - cpFloat DrawPointSize(); + cpFloat drawPointSize(); - virtual void DrawPointSize( const cpFloat& size ); + virtual void drawPointSize( const cpFloat& size ); protected: cpFloat mDrawPointSize; #endif diff --git a/include/eepp/physics/moment.hpp b/include/eepp/physics/moment.hpp index 9b820655f..71690346b 100644 --- a/include/eepp/physics/moment.hpp +++ b/include/eepp/physics/moment.hpp @@ -7,13 +7,13 @@ CP_NAMESPACE_BEGIN class CP_API Moment { public: - static cpFloat ForCircle( cpFloat m, cpFloat r1, cpFloat r2, cVect offset ); + static cpFloat forCircle( cpFloat m, cpFloat r1, cpFloat r2, cVect offset ); - static cpFloat ForSegment( cpFloat m, cVect a, cVect b); + static cpFloat forSegment( cpFloat m, cVect a, cVect b); - static cpFloat ForPoly( cpFloat m, int numVerts, const cVect *verts, cVect offset ); + static cpFloat forPoly( cpFloat m, int numVerts, const cVect *verts, cVect offset ); - static cpFloat ForBox( cpFloat m, cpFloat width, cpFloat height ); + static cpFloat forBox( cpFloat m, cpFloat width, cpFloat height ); }; CP_NAMESPACE_END diff --git a/include/eepp/physics/physicshelper.hpp b/include/eepp/physics/physicshelper.hpp index c8792af86..89490f9e6 100644 --- a/include/eepp/physics/physicshelper.hpp +++ b/include/eepp/physics/physicshelper.hpp @@ -78,7 +78,7 @@ typedef cpBB cBB; #ifdef PHYSICS_RENDERER_ENABLED -inline ColorA ColorFromPointer(void *ptr) { +inline ColorA colorFromPointer(void *ptr) { unsigned long val = (long)ptr; // hash the pointer up nicely @@ -104,7 +104,7 @@ inline ColorA ColorFromPointer(void *ptr) { return ColorA(r, g, b, 255); } -inline ColorA ColorForShape( cpShape *shape, cpSpace *space ) { +inline ColorA colorForShape( cpShape *shape, cpSpace *space ) { cpBody *body = shape->body; int nc; @@ -120,7 +120,7 @@ inline ColorA ColorForShape( cpShape *shape, cpSpace *space ) { } } - return ColorFromPointer( shape ); + return colorFromPointer( shape ); } #endif diff --git a/include/eepp/physics/physicsmanager.hpp b/include/eepp/physics/physicsmanager.hpp index 8c14fdfd3..41e8fc0b8 100644 --- a/include/eepp/physics/physicsmanager.hpp +++ b/include/eepp/physics/physicsmanager.hpp @@ -43,11 +43,11 @@ class CP_API PhysicsManager { *** This is a lazy deallocation for the lazy programmers. It is disabled by default. *** To work properly set as active before allocating anything, activate it just after the singleton instantiation. */ - void MemoryManager( bool MemoryManager ); + void memoryManager( bool memoryManager ); - const bool& MemoryManager() const; + const bool& memoryManager() const; - PhysicsManager::DrawSpaceOptions * GetDrawOptions(); + PhysicsManager::DrawSpaceOptions * getDrawOptions(); protected: DrawSpaceOptions mOptions; @@ -64,21 +64,21 @@ class CP_API PhysicsManager { PhysicsManager(); - void AddBodyFree( Body * body ); + void addBodyFree( Body * body ); - void RemoveBodyFree( Body * body ); + void removeBodyFree( Body * body ); - void AddShapeFree( Shape * shape ); + void addShapeFree( Shape * shape ); - void RemoveShapeFree( Shape * shape ); + void removeShapeFree( Shape * shape ); - void AddConstraintFree( Constraint * constraint ); + void addConstraintFree( Constraint * constraint ); - void RemoveConstraintFree( Constraint * constraint ); + void removeConstraintFree( Constraint * constraint ); - void AddSpace( Space * space ); + void addSpace( Space * space ); - void RemoveSpace( Space * space ); + void removeSpace( Space * space ); }; CP_NAMESPACE_END diff --git a/include/eepp/physics/shape.hpp b/include/eepp/physics/shape.hpp index 985084d76..3ac2a5fab 100644 --- a/include/eepp/physics/shape.hpp +++ b/include/eepp/physics/shape.hpp @@ -13,21 +13,21 @@ class Space; class CP_API Shape { public: - static void ResetShapeIdCounter(); + static void resetShapeIdCounter(); static void Free( Shape * shape, bool DeleteBody = false ); - cpShape * GetShape() const; + cpShape * getShape() const; virtual ~Shape(); - Physics::Body * Body() const; + Physics::Body * body() const; - void Body( Physics::Body * body ); + void body( Physics::Body * body ); - cBB BB() const; + cBB bb() const; - void BB( const cBB& bb ); + void bb( const cBB& bb ); bool Sensor(); @@ -37,64 +37,64 @@ class CP_API Shape { void e( const cpFloat& e ); - cpFloat Elasticity() const; + cpFloat elasticity() const; - void Elasticity( const cpFloat& e ); + void elasticity( const cpFloat& e ); cpFloat u() const; void u( const cpFloat& u ); - cpFloat Friction() const; + cpFloat friction() const; - void Friction( const cpFloat& u ); + void friction( const cpFloat& u ); - cVect SurfaceVel() const; + cVect surfaceVel() const; - void SurfaceVel( const cVect& vel ); + void surfaceVel( const cVect& vel ); - cpCollisionType CollisionType() const; + cpCollisionType collisionType() const; - void CollisionType( const cpCollisionType& type ); + void collisionType( const cpCollisionType& type ); - cpGroup Group() const; + cpGroup group() const; - void Group( const cpGroup& group ); + void group( const cpGroup& group ); - cpLayers Layers() const; + cpLayers layers() const; - void Layers( const cpLayers& layers ); + void layers( const cpLayers& layers ); - cBB CacheBB(); + cBB cacheBB(); - cBB Update( cVect pos, cVect rot ); + cBB update( cVect pos, cVect rot ); - bool PointQuery( cVect p ); + bool pointQuery( cVect p ); - cpShapeType Type() const; + cpShapeType type() const; - ShapePoly * GetAsPoly(); + ShapePoly * getAsPoly(); - ShapeCircle * GetAsCircle(); + ShapeCircle * getAsCircle(); - ShapeSegment * GetAsSegment(); + ShapeSegment * getAsSegment(); - virtual void Draw( Space * space ); + virtual void draw( Space * space ); - virtual void DrawBorder( Space * space ); + virtual void drawBorder( Space * space ); - virtual void DrawBB(); + virtual void drawBB(); - void * Data() const; + void * data() const; - void Data( void * data ); + void data( void * data ); protected: Shape(); cpShape * mShape; void * mData; - void SetData(); + void setData(); }; CP_NAMESPACE_END diff --git a/include/eepp/physics/shapecircle.hpp b/include/eepp/physics/shapecircle.hpp index 9905007a9..dcf62caf8 100644 --- a/include/eepp/physics/shapecircle.hpp +++ b/include/eepp/physics/shapecircle.hpp @@ -11,15 +11,15 @@ class CP_API ShapeCircle : public Shape { ShapeCircle( Physics::Body * body, cpFloat radius, cVect offset ); - cVect Offset(); + cVect offset(); - virtual void Offset( const cVect& offset ); + virtual void offset( const cVect& offset ); - cpFloat Radius(); + cpFloat radius(); - virtual void Radius( const cpFloat& radius ); + virtual void radius( const cpFloat& radius ); - virtual void Draw( Space * space ); + virtual void draw( Space * space ); }; CP_NAMESPACE_END diff --git a/include/eepp/physics/shapecirclesprite.hpp b/include/eepp/physics/shapecirclesprite.hpp index f268f2615..cccc8f7c4 100644 --- a/include/eepp/physics/shapecirclesprite.hpp +++ b/include/eepp/physics/shapecirclesprite.hpp @@ -20,18 +20,18 @@ class CP_API ShapeCircleSprite : public ShapeCircle { virtual ~ShapeCircleSprite(); - virtual void Draw( Space * space ); + virtual void draw( Space * space ); - virtual void Radius( const cpFloat& radius ); + virtual void radius( const cpFloat& radius ); - virtual void Offset( const cVect &offset ); + virtual void offset( const cVect &offset ); - Sprite * GetSprite() const; + Sprite * getSprite() const; protected: Sprite * mSprite; bool mSpriteAutoDelete; - void OffsetSet(); + void offsetSet(); }; CP_NAMESPACE_END diff --git a/include/eepp/physics/shapepoint.hpp b/include/eepp/physics/shapepoint.hpp index a8fbb4196..592bf17d7 100644 --- a/include/eepp/physics/shapepoint.hpp +++ b/include/eepp/physics/shapepoint.hpp @@ -11,20 +11,20 @@ class CP_API ShapePoint : public Shape { ShapePoint( Physics::Body * body, cpFloat radius, cVect offset ); - cVect Offset(); + cVect offset(); - virtual void Offset( const cVect& offset ); + virtual void offset( const cVect& offset ); - cpFloat Radius(); + cpFloat radius(); - virtual void Radius( const cpFloat& radius ); + virtual void radius( const cpFloat& radius ); - virtual void Draw( Space * space ); + virtual void draw( Space * space ); #ifdef PHYSICS_RENDERER_ENABLED - cpFloat DrawRadius(); + cpFloat drawRadius(); - virtual void DrawRadius( const cpFloat& radius ); + virtual void drawRadius( const cpFloat& radius ); protected: cpFloat mDrawRadius; #endif diff --git a/include/eepp/physics/shapepoly.hpp b/include/eepp/physics/shapepoly.hpp index 2fd3ccb3f..bd48c0998 100644 --- a/include/eepp/physics/shapepoly.hpp +++ b/include/eepp/physics/shapepoly.hpp @@ -15,21 +15,21 @@ class CP_API ShapePoly : public Shape { ShapePoly( Physics::Body * body, cpFloat width, cpFloat height ); - static bool Validate( const cVect * verts, const int numVerts ); + static bool validate( const cVect * verts, const int numVerts ); - int GetNumVerts(); + int getNumVerts(); - cVect GetVert( int idx ); + cVect getVert( int idx ); - void SetVerts( int numVerts, cVect *verts, cVect offset ); + void setVerts( int numVerts, cVect *verts, cVect offset ); - virtual void Draw( Space * space ); + virtual void draw( Space * space ); - virtual void DrawBorder( Space * space ); + virtual void drawBorder( Space * space ); - static void Recenter( int numVerts, cVect * verts ); + static void recenter( int numVerts, cVect * verts ); - static cVect Centroid( int numVerts, const cVect * verts ); + static cVect centroid( int numVerts, const cVect * verts ); }; CP_NAMESPACE_END diff --git a/include/eepp/physics/shapepolysprite.hpp b/include/eepp/physics/shapepolysprite.hpp index 4786e3afd..4372b00ac 100644 --- a/include/eepp/physics/shapepolysprite.hpp +++ b/include/eepp/physics/shapepolysprite.hpp @@ -24,15 +24,15 @@ class CP_API ShapePolySprite : public ShapePoly { virtual ~ShapePolySprite(); - virtual void Draw( Space * space ); + virtual void draw( Space * space ); - Sprite * GetSprite() const; + Sprite * getSprite() const; protected: Sprite * mSprite; bool mSpriteAutoDelete; Vector2i mOffset; - void OffsetSet( cVect center ); + void offsetSet( cVect center ); }; CP_NAMESPACE_END diff --git a/include/eepp/physics/shapesegment.hpp b/include/eepp/physics/shapesegment.hpp index 50ee5c92c..96a0eeba1 100644 --- a/include/eepp/physics/shapesegment.hpp +++ b/include/eepp/physics/shapesegment.hpp @@ -11,25 +11,25 @@ class CP_API ShapeSegment : public Shape { ShapeSegment( Physics::Body * body, cVect a, cVect b, cpFloat radius ); - cVect A(); + cVect a(); - cVect B(); + cVect b(); - cVect Normal(); + cVect normal(); - cpFloat Radius(); + cpFloat radius(); - void Radius( const cpFloat& radius ); + void radius( const cpFloat& radius ); - void Endpoints( const cVect& a, const cVect& b ); + void endpoints( const cVect& a, const cVect& b ); - bool Query( cVect a, cVect b, cpSegmentQueryInfo * info ); + bool query( cVect a, cVect b, cpSegmentQueryInfo * info ); - static cVect QueryHitPoint( const cVect start, const cVect end, const cpSegmentQueryInfo info ); + static cVect queryHitPoint( const cVect start, const cVect end, const cpSegmentQueryInfo info ); - static cpFloat QueryHitDist( const cVect start, const cVect end, const cpSegmentQueryInfo info ); + static cpFloat queryHitDist( const cVect start, const cVect end, const cpSegmentQueryInfo info ); - virtual void Draw( Space * space ); + virtual void draw( Space * space ); }; CP_NAMESPACE_END diff --git a/include/eepp/physics/space.hpp b/include/eepp/physics/space.hpp index 5f5363eaf..65a376744 100644 --- a/include/eepp/physics/space.hpp +++ b/include/eepp/physics/space.hpp @@ -22,9 +22,9 @@ class CP_API Space { typedef cb::Callback3 BodyIteratorFunc; typedef cb::Callback3 ShapeIteratorFunc; - class cCollisionHandler { + class CollisionHandler { public: - cCollisionHandler() : + CollisionHandler() : a( 0 ), b( 0 ), data( NULL ) @@ -50,9 +50,9 @@ class CP_API Space { void * data; }; - class cPostStepCallback { + class PostStepCallbackCont { public: - cPostStepCallback() : + PostStepCallbackCont() : Data( NULL ) {} @@ -60,9 +60,9 @@ class CP_API Space { void * Data; }; - class cBBQuery { + class BBQuery { public: - cBBQuery() : + BBQuery() : Data( NULL ) {} @@ -71,9 +71,9 @@ class CP_API Space { void * Data; }; - class cSegmentQuery { + class SegmentQuery { public: - cSegmentQuery() + SegmentQuery() {} Physics::Space * Space; @@ -81,9 +81,9 @@ class CP_API Space { void * Data; }; - class cPointQuery { + class PointQuery { public: - cPointQuery() : + PointQuery() : Data( NULL ) {} @@ -126,133 +126,133 @@ class CP_API Space { virtual ~Space(); - void Step( const cpFloat& dt ); + void step( const cpFloat& dt ); - void Update(); + void update(); - Body * StatiBody() const; + Body * staticBody() const; - const int& Iterations() const; + const int& iterations() const; - void Iterations( const int& iterations ); + void iterations( const int& iterations ); - cVect Gravity() const; + cVect gravity() const; - void Gravity( const cVect& gravity ); + void gravity( const cVect& gravity ); - const cpFloat& Damping() const; + const cpFloat& damping() const; - void Damping( const cpFloat& damping ); + void damping( const cpFloat& damping ); - const cpFloat& IdleSpeedThreshold() const; + const cpFloat& idleSpeedThreshold() const; - void IdleSpeedThreshold( const cpFloat& idleSpeedThreshold ); + void idleSpeedThreshold( const cpFloat& idleSpeedThreshold ); - const cpFloat& SleepTimeThreshold() const; + const cpFloat& sleepTimeThreshold() const; - void SleepTimeThreshold( const cpFloat& sleepTimeThreshold ); + void sleepTimeThreshold( const cpFloat& sleepTimeThreshold ); - void CollisionSlop( cpFloat slop ); + void collisionSlop( cpFloat slop ); - cpFloat CollisionSlop() const; + cpFloat collisionSlop() const; - void CollisionBias( cpFloat bias ); + void collisionBias( cpFloat bias ); - cpFloat CollisionBias() const; + cpFloat collisionBias() const; - cpTimestamp CollisionPersistence(); + cpTimestamp collisionPersistence(); - void CollisionPersistence( cpTimestamp value ); + void collisionPersistence( cpTimestamp value ); - bool EnableContactGraph(); + bool enableContactGraph(); - void EnableContactGraph( bool value ); + void enableContactGraph( bool value ); - bool Contains( Shape * shape ); + bool contains( Shape * shape ); - bool Contains( Body * body ); + bool contains( Body * body ); - bool Contains( Constraint * constraint ); + bool contains( Constraint * constraint ); - Shape * AddShape( Shape * shape ); + Shape * addShape( Shape * shape ); - Shape * AddStatiShape( Shape *shape ); + Shape * addStaticShape( Shape *shape ); - Body * AddBody( Body * body ); + Body * addBody( Body * body ); - Constraint * AddConstraint( Constraint * constraint ); + Constraint * addConstraint( Constraint * constraint ); - void RemoveShape( Shape * shape ); + void removeShape( Shape * shape ); - void RemoveStatiShape( Shape * shape ); + void removeStatiShape( Shape * shape ); - void RemoveBody( Body * body ); + void removeBody( Body * body ); - void RemoveConstraint( Constraint * constraint ); + void removeConstraint( Constraint * constraint ); - cpSpace * GetSpace() const; + cpSpace * getSpace() const; - void ActivateShapesTouchingShape( Shape * shape ); + void activateShapesTouchingShape( Shape * shape ); - virtual void Draw(); + virtual void draw(); - Shape * PointQueryFirst( cVect point, cpLayers layers, cpGroup group ); + Shape * pointQueryFirst( cVect point, cpLayers layers, cpGroup group ); - Shape * SegmentQueryFirst( cVect start, cVect end, cpLayers layers, cpGroup group, cpSegmentQueryInfo * out ); + Shape * segmentQueryFirst( cVect start, cVect end, cpLayers layers, cpGroup group, cpSegmentQueryInfo * out ); - void AddCollisionHandler( const cCollisionHandler& handler ); + void addCollisionHandler( const CollisionHandler& handler ); - void RemoveCollisionHandler( cpCollisionType a, cpCollisionType b ); + void removeCollisionHandler( cpCollisionType a, cpCollisionType b ); - void SetDefaultCollisionHandler( const cCollisionHandler& handler ); + void setDefaultCollisionHandler( const CollisionHandler& handler ); - void AddPostStepCallback( PostStepCallback postStep, void * obj, void * data ); + void addPostStepCallback( PostStepCallback postStep, void * obj, void * data ); - virtual cpBool OnCollisionBegin( Arbiter * arb, void * data ); + virtual cpBool onCollisionBegin( Arbiter * arb, void * data ); - virtual cpBool OnCollisionPreSolve( Arbiter * arb, void * data ); + virtual cpBool onCollisionPreSolve( Arbiter * arb, void * data ); - virtual void OnCollisionPostSolve( Arbiter * arb, void * data ); + virtual void onCollisionPostSolve( Arbiter * arb, void * data ); - virtual void OnCollisionSeparate( Arbiter * arb, void * data ); + virtual void onCollisionSeparate( Arbiter * arb, void * data ); - virtual void OnPostStepCallback( void * obj, void * data ); + virtual void onPostStepCallback( void * obj, void * data ); - virtual void OnBBQuery( Shape * shape, cBBQuery * query ); + virtual void onBBQuery( Shape * shape, BBQuery * query ); - virtual void OnSegmentQuery( Shape * shape, cpFloat t, cVect n , cSegmentQuery * query ); + virtual void onSegmentQuery( Shape * shape, cpFloat t, cVect n , SegmentQuery * query ); - virtual void OnPointQuery( Shape * shape, cPointQuery * query ); + virtual void onPointQuery( Shape * shape, PointQuery * query ); - void BBQuery( cBB bb, cpLayers layers, cpGroup group, BBQueryFunc func, void * data ); + void bbQuery( cBB bb, cpLayers layers, cpGroup group, BBQueryFunc func, void * data ); - void SegmentQuery( cVect start, cVect end, cpLayers layers, cpGroup group, SegmentQueryFunc func, void * data ); + void segmentQuery( cVect start, cVect end, cpLayers layers, cpGroup group, SegmentQueryFunc func, void * data ); - void PointQuery( cVect point, cpLayers layers, cpGroup group, PointQueryFunc func, void * data ); + void pointQuery( cVect point, cpLayers layers, cpGroup group, PointQueryFunc func, void * data ); - void Data( void * data ); + void data( void * data ); - void * Data() const; + void * data() const; - void ReindexShape( Shape * shape ); + void reindexShape( Shape * shape ); - void ReindexShapesForBody( Body *body ); + void reindexShapesForBody( Body *body ); - void ReindexStatic(); + void reindexStatic(); - void UseSpatialHash( cpFloat dim, int count ); + void useSpatialHash( cpFloat dim, int count ); - void EachShape( ShapeIteratorFunc Func, void * data ); + void eachShape( ShapeIteratorFunc Func, void * data ); - virtual void OnEachShape( Shape * Shape, ShapeIterator * it ); + virtual void onEachShape( Shape * Shape, ShapeIterator * it ); - void EachBody( BodyIteratorFunc Func, void * data ); + void eachBody( BodyIteratorFunc Func, void * data ); - virtual void OnEachBody( Body * Body, BodyIterator * it ); + virtual void onEachBody( Body * Body, BodyIterator * it ); - void ConvertBodyToDynamic( Body * body, cpFloat mass, cpFloat moment ); + void convertBodyToDynamic( Body * body, cpFloat mass, cpFloat moment ); - void ConvertBodyToStatic( Body * body ); + void convertBodyToStatic( Body * body ); protected: cpSpace * mSpace; Body * mStatiBody; @@ -260,9 +260,9 @@ class CP_API Space { std::list mBodys; std::list mShapes; std::list mConstraints; - std::map< cpHashValue, cCollisionHandler > mCollisions; - cCollisionHandler mCollisionsDefault; - std::list< cPostStepCallback* > mPostStepCallbacks; + std::map< cpHashValue, CollisionHandler > mCollisions; + CollisionHandler mCollisionsDefault; + std::list< PostStepCallbackCont* > mPostStepCallbacks; }; CP_NAMESPACE_END diff --git a/projects/linux/ee.creator.user b/projects/linux/ee.creator.user index 6ca114ccb..efc2bf26d 100644 --- a/projects/linux/ee.creator.user +++ b/projects/linux/ee.creator.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/src/eepp/physics/arbiter.cpp b/src/eepp/physics/arbiter.cpp index 831471f2e..7e7d01ad9 100644 --- a/src/eepp/physics/arbiter.cpp +++ b/src/eepp/physics/arbiter.cpp @@ -6,19 +6,19 @@ Arbiter::Arbiter( cpArbiter * arbiter ) { mArbiter = arbiter; } -cVect Arbiter::TotalImpulse() { +cVect Arbiter::totalImpulse() { return tovect( cpArbiterTotalImpulse( mArbiter ) ); } -cVect Arbiter::TotalImpulseWithFriction() { +cVect Arbiter::totalImpulseWithFriction() { return tovect( cpArbiterTotalImpulseWithFriction( mArbiter ) ); } -void Arbiter::Ignore() { +void Arbiter::ignore() { return cpArbiterIgnore( mArbiter ); } -void Arbiter::GetShapes( Shape ** a, Shape ** b ) { +void Arbiter::getShapes( Shape ** a, Shape ** b ) { cpShape * tA; cpShape * tB; @@ -35,7 +35,7 @@ void Arbiter::GetShapes( Shape ** a, Shape ** b ) { *b = NULL; } -void Arbiter::GetBodies( Body ** a, Body ** b) { +void Arbiter::getBodies( Body ** a, Body ** b) { cpBody * tA; cpBody * tB; @@ -52,67 +52,67 @@ void Arbiter::GetBodies( Body ** a, Body ** b) { *b = NULL; } -bool Arbiter::IsFirstContact() { +bool Arbiter::isFirstContact() { return 0 != cpArbiterIsFirstContact( mArbiter ); } -int Arbiter::GetCount() { +int Arbiter::getCount() { return cpArbiterGetCount( mArbiter ); } -cVect Arbiter::GetNormal( int i ) { +cVect Arbiter::getNormal( int i ) { return tovect( cpArbiterGetNormal( mArbiter, i ) ); } -cVect Arbiter::GetPoint( int i ) { +cVect Arbiter::getPoint( int i ) { return tovect( cpArbiterGetPoint( mArbiter, i ) ); } -cpFloat Arbiter::GetDepth( int i ) { +cpFloat Arbiter::getDepth( int i ) { return cpArbiterGetDepth( mArbiter, i ); } -cpContactPointSet Arbiter::ContactPointSet() { +cpContactPointSet Arbiter::contactPointSet() { return cpArbiterGetContactPointSet( mArbiter ); } -void Arbiter::ContactPointSet( cpContactPointSet * contact ) { +void Arbiter::contactPointSet( cpContactPointSet * contact ) { cpArbiterSetContactPointSet( mArbiter, contact ); } -cpArbiter * Arbiter::GetArbiter() const { +cpArbiter * Arbiter::getArbiter() const { return mArbiter; } -cpFloat Arbiter::Elasticity() { +cpFloat Arbiter::elasticity() { return cpArbiterGetElasticity( mArbiter); } -void Arbiter::Elasticity( cpFloat value ) { +void Arbiter::elasticity( cpFloat value ) { cpArbiterSetElasticity( mArbiter, value ); } -cpFloat Arbiter::Friction() { +cpFloat Arbiter::friction() { return cpArbiterGetFriction( mArbiter ); } -void Arbiter::Friction( cpFloat value ) { +void Arbiter::friction( cpFloat value ) { cpArbiterSetFriction( mArbiter, value ); } -cVect Arbiter::SurfaceVelocity() { +cVect Arbiter::surfaceVelocity() { return tovect( cpArbiterGetSurfaceVelocity( mArbiter ) ); } -void Arbiter::SurfaceVelocity( cVect value ) { +void Arbiter::surfaceVelocity( cVect value ) { cpArbiterSetSurfaceVelocity( mArbiter, tocpv( value ) ); } -void Arbiter::UserData( cpDataPointer value ) { +void Arbiter::userData( cpDataPointer value ) { cpArbiterSetUserData( mArbiter, value ); } -cpDataPointer Arbiter::UserData() const { +cpDataPointer Arbiter::userData() const { return cpArbiterGetUserData( mArbiter ); } diff --git a/src/eepp/physics/area.cpp b/src/eepp/physics/area.cpp index a09f9f93e..d9c5cc387 100644 --- a/src/eepp/physics/area.cpp +++ b/src/eepp/physics/area.cpp @@ -2,15 +2,15 @@ CP_NAMESPACE_BEGIN -cpFloat Area::ForCircle( cpFloat r1, cpFloat r2 ) { +cpFloat Area::forCircle( cpFloat r1, cpFloat r2 ) { return cpAreaForCircle( r1, r2 ); } -cpFloat Area::ForSegment( cVect a, cVect b, cpFloat r ) { +cpFloat Area::forSegment( cVect a, cVect b, cpFloat r ) { return cpAreaForSegment( tocpv( a ), tocpv( b ), r ); } -cpFloat Area::ForPoly( const int numVerts, const cVect * verts ) { +cpFloat Area::forPoly( const int numVerts, const cVect * verts ) { return cpAreaForPoly( numVerts, constcasttocpv( verts ) ); } diff --git a/src/eepp/physics/body.cpp b/src/eepp/physics/body.cpp index 0cb05b02e..dff25c762 100644 --- a/src/eepp/physics/body.cpp +++ b/src/eepp/physics/body.cpp @@ -26,169 +26,169 @@ Body::Body( cpBody * body ) : mBody( body ), mData( NULL ) { - SetData(); + setData(); } Body::Body( cpFloat m, cpFloat i ) : mBody( cpBodyNew( m, i ) ), mData( NULL ) { - SetData(); + setData(); } Body::Body() : mBody( cpBodyNewStatic() ), mData( NULL ) { - SetData(); + setData(); } Body::~Body() { if ( NULL != mBody ) cpBodyFree( mBody ); - PhysicsManager::instance()->RemoveBodyFree( this ); + PhysicsManager::instance()->removeBodyFree( this ); } -void Body::SetData() { +void Body::setData() { mBody->data = (void*)this; - PhysicsManager::instance()->AddBodyFree( this ); + PhysicsManager::instance()->addBodyFree( this ); } -void Body::Activate() { +void Body::activate() { cpBodyActivate( mBody ); } -void Body::ActivateStatic( Body *body, Shape * filter ) { - cpBodyActivateStatic( mBody, filter->GetShape() ); +void Body::activateStatic( Body *body, Shape * filter ) { + cpBodyActivateStatic( mBody, filter->getShape() ); } -void Body::Sleep() { +void Body::sleep() { cpBodySleep( mBody ); } -void Body::SleepWithGroup( Body * Group ) { - cpBodySleepWithGroup( mBody, Group->GetBody() ); +void Body::sleepWithGroup( Body * Group ) { + cpBodySleepWithGroup( mBody, Group->getBody() ); } -bool Body::IsSleeping() { +bool Body::isSleeping() { return cpFalse != cpBodyIsSleeping( mBody ); } -bool Body::IsStatic() { +bool Body::isStatic() { return cpFalse != cpBodyIsStatic( mBody ); } -bool Body::IsRogue() { +bool Body::isRogue() { return cpFalse != cpBodyIsRogue( mBody ); } -cpBody * Body::GetBody() const { +cpBody * Body::getBody() const { return mBody; } -cpFloat Body::Mass() const { +cpFloat Body::mass() const { return cpBodyGetMass( mBody ); } -void Body::Mass( const cpFloat& mass ) { +void Body::mass( const cpFloat& mass ) { cpBodySetMass( mBody, mass ); } -cpFloat Body::Moment() const { +cpFloat Body::moment() const { return cpBodyGetMoment( mBody ); } -void Body::Moment( const cpFloat& i ) { +void Body::moment( const cpFloat& i ) { cpBodySetMoment( mBody, i ); } -cVect Body::Pos() const { +cVect Body::pos() const { return tovect( cpBodyGetPos( mBody ) ); } -void Body::Pos( const cVect& pos ) { +void Body::pos( const cVect& pos ) { cpBodySetPos( mBody, tocpv( pos ) ); } -cVect Body::Vel() const { +cVect Body::vel() const { return tovect( cpBodyGetVel( mBody ) ); } -void Body::Vel( const cVect& vel ) { +void Body::vel( const cVect& vel ) { cpBodySetVel( mBody, tocpv( vel ) ); } -cVect Body::Force() const { +cVect Body::force() const { return tovect( cpBodyGetForce( mBody ) ); } -void Body::Force( const cVect& force ) { +void Body::force( const cVect& force ) { cpBodySetForce( mBody, tocpv( force ) ); } -cpFloat Body::Angle() const { +cpFloat Body::angle() const { return cpBodyGetAngle( mBody ); } -void Body::Angle( const cpFloat& rads ) { +void Body::angle( const cpFloat& rads ) { cpBodySetAngle( mBody, rads ); } -cpFloat Body::AngleDeg() { +cpFloat Body::angleDeg() { return cpDegrees( mBody->a ); } -void Body::AngleDeg( const cpFloat& angle ) { - Angle( cpRadians( angle ) ); +void Body::angleDeg( const cpFloat& angle ) { + this->angle( cpRadians( angle ) ); } -cpFloat Body::AngVel() const { +cpFloat Body::angVel() const { return cpBodyGetAngVel( mBody ); } -void Body::AngVel( const cpFloat& rotVel ) { +void Body::angVel( const cpFloat& rotVel ) { cpBodySetAngVel( mBody, rotVel ); } -cpFloat Body::Torque() const { +cpFloat Body::torque() const { return cpBodyGetTorque( mBody ); } -void Body::Torque( const cpFloat& torque ) { +void Body::torque( const cpFloat& torque ) { cpBodySetTorque( mBody, torque ); } -cVect Body::Rot() const { +cVect Body::rot() const { return tovect( cpBodyGetRot( mBody ) ); } -cpFloat Body::VelLimit() const { +cpFloat Body::velLimit() const { return cpBodyGetVelLimit( mBody ); } -void Body::VelLimit( const cpFloat& speed ) { +void Body::velLimit( const cpFloat& speed ) { cpBodySetVelLimit( mBody, speed ); } -cpFloat Body::AngVelLimit() const { +cpFloat Body::angVelLimit() const { return cpBodyGetAngVelLimit( mBody ); } -void Body::AngVelLimit( const cpFloat& speed ) { +void Body::angVelLimit( const cpFloat& speed ) { cpBodySetAngVelLimit( mBody, speed ); } -void Body::UpdateVelocity( cVect gravity, cpFloat damping, cpFloat dt ) { +void Body::updateVelocity( cVect gravity, cpFloat damping, cpFloat dt ) { cpBodyUpdateVelocity( mBody, tocpv( gravity ), damping, dt ); } -void Body::UpdatePosition( cpFloat dt ) { +void Body::updatePosition( cpFloat dt ) { cpBodyUpdatePosition( mBody, dt ); } -void Body::BodyVelocityFuncWrapper( cpBody *body, cpVect gravity, cpFloat damping, cpFloat dt ) { +void Body::bodyVelocityFuncWrapper( cpBody *body, cpVect gravity, cpFloat damping, cpFloat dt ) { Body * tBody = reinterpret_cast( body->data ); if ( tBody->mVelocityFunc.IsSet() ) { @@ -196,13 +196,13 @@ void Body::BodyVelocityFuncWrapper( cpBody *body, cpVect gravity, cpFloat dampin } } -void Body::VelocityFunc( BodyVelocityFunc func ) { - mBody->velocity_func = &Body::BodyVelocityFuncWrapper; +void Body::velocityFunc( BodyVelocityFunc func ) { + mBody->velocity_func = &Body::bodyVelocityFuncWrapper; mVelocityFunc = func; } -void Body::BodyPositionFuncWrapper( cpBody* body, cpFloat dt ) { +void Body::bodyPositionFuncWrapper( cpBody* body, cpFloat dt ) { Body * tBody = reinterpret_cast( body->data ); if ( tBody->mPositionFunc.IsSet() ) { @@ -210,55 +210,55 @@ void Body::BodyPositionFuncWrapper( cpBody* body, cpFloat dt ) { } } -void Body::PositionFunc( BodyPositionFunc func ) { - mBody->position_func = &Body::BodyPositionFuncWrapper; +void Body::positionFunc( BodyPositionFunc func ) { + mBody->position_func = &Body::bodyPositionFuncWrapper; mPositionFunc = func; } -cVect Body::Local2World( const cVect v ) { +cVect Body::local2World( const cVect v ) { return tovect( cpBodyLocal2World( mBody, tocpv( v ) ) ); } -cVect Body::World2Local( const cVect v ) { +cVect Body::world2Local( const cVect v ) { return tovect( cpBodyWorld2Local( mBody, tocpv( v ) ) ); } -void Body::ApplyImpulse( const cVect j, const cVect r ) { +void Body::applyImpulse( const cVect j, const cVect r ) { cpBodyApplyImpulse( mBody, tocpv( j ), tocpv( r ) ); } -void Body::ResetForces() { +void Body::resetForces() { cpBodyResetForces( mBody ); } -void Body::ApplyForce( const cVect f, const cVect r ) { +void Body::applyForce( const cVect f, const cVect r ) { cpBodyApplyForce( mBody, tocpv( f ), tocpv( r ) ); } -cpFloat Body::KineticEnergy() { +cpFloat Body::kineticEnergy() { return cpBodyKineticEnergy( mBody ); } -void * Body::Data() const { +void * Body::data() const { return mData; } -void Body::Data( void * data ) { +void Body::data( void * data ) { mData = data; } static void BodyShapeIteratorFunc ( cpBody * body, cpShape * shape, void * data ) { Body::ShapeIterator * it = reinterpret_cast ( data ); - it->Body->OnEachShape( reinterpret_cast( shape->data ), it ); + it->Body->onEachShape( reinterpret_cast( shape->data ), it ); } -void Body::EachShape( ShapeIteratorFunc Func, void * data ) { +void Body::eachShape( ShapeIteratorFunc Func, void * data ) { ShapeIterator it( this, data, Func ); cpBodyEachShape( mBody, &BodyShapeIteratorFunc, (void*)&it ); } -void Body::OnEachShape( Shape * Shape, ShapeIterator * it ) { +void Body::onEachShape( Shape * Shape, ShapeIterator * it ) { if ( it->Func.IsSet() ) { it->Func( it->Body, Shape, it->Data ); } @@ -266,15 +266,15 @@ void Body::OnEachShape( Shape * Shape, ShapeIterator * it ) { static void BodyConstraintIteratorFunc( cpBody * body, cpConstraint * constraint, void * data ) { Body::ConstraintIterator * it = reinterpret_cast ( data ); - it->Body->OnEachConstraint( reinterpret_cast ( constraint->data ), it ); + it->Body->onEachConstraint( reinterpret_cast ( constraint->data ), it ); } -void Body::EachConstraint( ConstraintIteratorFunc Func, void * data ) { +void Body::eachConstraint( ConstraintIteratorFunc Func, void * data ) { ConstraintIterator it( this, data, Func ); cpBodyEachConstraint( mBody, &BodyConstraintIteratorFunc, (void*)&it ); } -void Body::OnEachConstraint( Constraint * Constraint, ConstraintIterator * it ) { +void Body::onEachConstraint( Constraint * Constraint, ConstraintIterator * it ) { if ( it->Func.IsSet() ) { it->Func( this, Constraint, it->Data ); } @@ -283,15 +283,15 @@ void Body::OnEachConstraint( Constraint * Constraint, ConstraintIterator * it ) static void BodyArbiterIteratorFunc( cpBody * body, cpArbiter * arbiter, void * data ) { Body::ArbiterIterator * it = reinterpret_cast ( data ); Arbiter tarb( arbiter ); - it->Body->OnEachArbiter( &tarb, it ); + it->Body->onEachArbiter( &tarb, it ); } -void Body::EachArbiter( ArbiterIteratorFunc Func, void * data ) { +void Body::eachArbiter( ArbiterIteratorFunc Func, void * data ) { ArbiterIterator it( this, data, Func ); cpBodyEachArbiter( mBody, &BodyArbiterIteratorFunc, (void*)&it ); } -void Body::OnEachArbiter( Arbiter * Arbiter, ArbiterIterator * it ) { +void Body::onEachArbiter( Arbiter * Arbiter, ArbiterIterator * it ) { if ( it->Func.IsSet() ) { it->Func( this, Arbiter, it->Data ); } diff --git a/src/eepp/physics/constraints/constraint.cpp b/src/eepp/physics/constraints/constraint.cpp index 8e78c0e81..91ff31e93 100644 --- a/src/eepp/physics/constraints/constraint.cpp +++ b/src/eepp/physics/constraints/constraint.cpp @@ -11,7 +11,7 @@ Constraint::Constraint( cpConstraint * Constraint ) : mData( NULL ) { mConstraint = Constraint; - SetData(); + setData(); } Constraint::Constraint() : @@ -23,63 +23,63 @@ Constraint::Constraint() : Constraint::~Constraint() { cpConstraintFree( mConstraint ); - PhysicsManager::instance()->RemoveConstraintFree( this ); + PhysicsManager::instance()->removeConstraintFree( this ); } -void Constraint::SetData() { +void Constraint::setData() { mConstraint->data = (void*)this; - PhysicsManager::instance()->AddConstraintFree( this ); + PhysicsManager::instance()->addConstraintFree( this ); } -cpConstraint * Constraint::GetConstraint() const { +cpConstraint * Constraint::getConstraint() const { return mConstraint; } -Body * Constraint::A() { +Body * Constraint::a() { return reinterpret_cast( mConstraint->a->data ); } -Body * Constraint::B() { +Body * Constraint::b() { return reinterpret_cast( mConstraint->b->data ); } -cpFloat Constraint::MaxForce() { +cpFloat Constraint::maxForce() { return mConstraint->maxForce; } -void Constraint::MaxForce( const cpFloat& maxforce ) { +void Constraint::maxForce( const cpFloat& maxforce ) { mConstraint->maxForce = maxforce; } -cpFloat Constraint::MaxBias() { +cpFloat Constraint::maxBias() { return mConstraint->maxBias; } -void Constraint::MaxBias( const cpFloat& maxbias ) { +void Constraint::maxBias( const cpFloat& maxbias ) { mConstraint->maxBias = maxbias; } -cpFloat Constraint::ErrorBias() { +cpFloat Constraint::errorBias() { return cpConstraintGetErrorBias( mConstraint ); } -void Constraint::ErrorBias( cpFloat value ) { +void Constraint::errorBias( cpFloat value ) { cpConstraintSetErrorBias( mConstraint, value ); } -void Constraint::Data( void * data ) { +void Constraint::data( void * data ) { mData = data; } -void * Constraint::Data() const { +void * Constraint::data() const { return mData; } -cpFloat Constraint::Impulse() { +cpFloat Constraint::impulse() { return cpConstraintGetImpulse( mConstraint ); } -void Constraint::Draw() { +void Constraint::draw() { } CP_NAMESPACE_END diff --git a/src/eepp/physics/constraints/dampedrotaryspring.cpp b/src/eepp/physics/constraints/dampedrotaryspring.cpp index 329dae1b8..b101ab6c2 100644 --- a/src/eepp/physics/constraints/dampedrotaryspring.cpp +++ b/src/eepp/physics/constraints/dampedrotaryspring.cpp @@ -3,35 +3,35 @@ CP_NAMESPACE_BEGIN DampedRotarySpring::DampedRotarySpring( Body * a, Body * b, cpFloat restAngle, cpFloat stiffness, cpFloat damping ) { - mConstraint = cpDampedRotarySpringNew( a->GetBody(), b->GetBody(), restAngle, stiffness, damping ); - SetData(); + mConstraint = cpDampedRotarySpringNew( a->getBody(), b->getBody(), restAngle, stiffness, damping ); + setData(); } -cpFloat DampedRotarySpring::RestAngle() { +cpFloat DampedRotarySpring::restAngle() { return cpDampedRotarySpringGetRestAngle( mConstraint ); } -void DampedRotarySpring::RestAngle( const cpFloat& restangle ) { +void DampedRotarySpring::restAngle( const cpFloat& restangle ) { cpDampedRotarySpringSetRestAngle( mConstraint, restangle ); } -cpFloat DampedRotarySpring::Stiffness() { +cpFloat DampedRotarySpring::stiffness() { return cpDampedRotarySpringGetStiffness( mConstraint ); } -void DampedRotarySpring::Stiffness( const cpFloat& stiffness ) { +void DampedRotarySpring::stiffness( const cpFloat& stiffness ) { cpDampedRotarySpringSetStiffness( mConstraint, stiffness ); } -cpFloat DampedRotarySpring::Damping() { +cpFloat DampedRotarySpring::damping() { return cpDampedRotarySpringGetDamping( mConstraint ); } -void DampedRotarySpring::Damping( const cpFloat& damping ) { +void DampedRotarySpring::damping( const cpFloat& damping ) { cpDampedRotarySpringSetDamping( mConstraint, damping ); } -void DampedRotarySpring::Draw() { +void DampedRotarySpring::draw() { // Not implemented } diff --git a/src/eepp/physics/constraints/dampedspring.cpp b/src/eepp/physics/constraints/dampedspring.cpp index 91b38b096..027f0a4ac 100644 --- a/src/eepp/physics/constraints/dampedspring.cpp +++ b/src/eepp/physics/constraints/dampedspring.cpp @@ -15,51 +15,51 @@ DampedSpring::DampedSpring( Body * a, Body * b, cVect anchr1, cVect anchr2, cpFl : mDrawPointSize( 5.f ) #endif { - mConstraint = cpDampedSpringNew( a->GetBody(), b->GetBody(), tocpv( anchr1 ), tocpv( anchr2 ), restLength, stiffness, damping ); - SetData(); + mConstraint = cpDampedSpringNew( a->getBody(), b->getBody(), tocpv( anchr1 ), tocpv( anchr2 ), restLength, stiffness, damping ); + setData(); } -cVect DampedSpring::Anchr1() { +cVect DampedSpring::anchr1() { return tovect( cpDampedSpringGetAnchr1( mConstraint ) ); } -void DampedSpring::Anchr1( const cVect& anchr1 ) { +void DampedSpring::anchr1( const cVect& anchr1 ) { cpDampedSpringSetAnchr1( mConstraint, tocpv( anchr1 ) ); } -cVect DampedSpring::Anchr2() { +cVect DampedSpring::anchr2() { return tovect( cpDampedSpringGetAnchr2( mConstraint ) ); } -void DampedSpring::Anchr2( const cVect& anchr2 ) { +void DampedSpring::anchr2( const cVect& anchr2 ) { cpDampedSpringSetAnchr2( mConstraint, tocpv( anchr2 ) ); } -cpFloat DampedSpring::RestLength() { +cpFloat DampedSpring::restLength() { return cpDampedSpringGetRestLength( mConstraint ); } -void DampedSpring::RestLength( const cpFloat& restlength ) { +void DampedSpring::restLength( const cpFloat& restlength ) { cpDampedSpringSetRestLength( mConstraint, restlength ); } -cpFloat DampedSpring::Stiffness() { +cpFloat DampedSpring::stiffness() { return cpDampedSpringGetStiffness( mConstraint ); } -void DampedSpring::Stiffness( const cpFloat& stiffness ) { +void DampedSpring::stiffness( const cpFloat& stiffness ) { cpDampedSpringSetStiffness( mConstraint, stiffness ); } -cpFloat DampedSpring::Damping() { +cpFloat DampedSpring::damping() { return cpDampedSpringGetDamping( mConstraint ); } -void DampedSpring::Damping( const cpFloat& damping ) { +void DampedSpring::damping( const cpFloat& damping ) { cpDampedSpringSetDamping( mConstraint, damping ); } -void DampedSpring::Draw() { +void DampedSpring::draw() { #ifdef PHYSICS_RENDERER_ENABLED static const float springVAR[] = { 0.00f, 0.0f, @@ -135,11 +135,11 @@ void DampedSpring::Draw() { #ifdef PHYSICS_RENDERER_ENABLED -cpFloat DampedSpring::DrawPointSize() { +cpFloat DampedSpring::drawPointSize() { return mDrawPointSize; } -void DampedSpring::DrawPointSize( const cpFloat& size ) { +void DampedSpring::drawPointSize( const cpFloat& size ) { mDrawPointSize = size; } #endif diff --git a/src/eepp/physics/constraints/gearjoint.cpp b/src/eepp/physics/constraints/gearjoint.cpp index fb7876279..1afc76255 100644 --- a/src/eepp/physics/constraints/gearjoint.cpp +++ b/src/eepp/physics/constraints/gearjoint.cpp @@ -3,27 +3,27 @@ CP_NAMESPACE_BEGIN GearJoint::GearJoint( Body * a, Body * b, cpFloat phase, cpFloat ratio ) { - mConstraint = cpGearJointNew( a->GetBody(), b->GetBody(), phase, ratio ); - SetData(); + mConstraint = cpGearJointNew( a->getBody(), b->getBody(), phase, ratio ); + setData(); } -cpFloat GearJoint::Phase() { +cpFloat GearJoint::phase() { return cpGearJointGetPhase( mConstraint ); } -void GearJoint::Phase( const cpFloat& phase ) { +void GearJoint::phase( const cpFloat& phase ) { cpGearJointSetPhase( mConstraint, phase ); } -cpFloat GearJoint::Ratio() { +cpFloat GearJoint::ratio() { return cpGearJointGetRatio( mConstraint ); } -void GearJoint::Ratio( const cpFloat& ratio ) { +void GearJoint::ratio( const cpFloat& ratio ) { cpGearJointSetRatio( mConstraint, ratio ); } -void GearJoint::Draw() { +void GearJoint::draw() { // Not implemented } diff --git a/src/eepp/physics/constraints/groovejoint.cpp b/src/eepp/physics/constraints/groovejoint.cpp index f224af5d2..ad01422c3 100644 --- a/src/eepp/physics/constraints/groovejoint.cpp +++ b/src/eepp/physics/constraints/groovejoint.cpp @@ -12,35 +12,35 @@ GrooveJoint::GrooveJoint( Body * a, Body * b, cVect groove_a, cVect groove_b, cV : mDrawPointSize( 5.f ) #endif { - mConstraint = cpGrooveJointNew( a->GetBody(), b->GetBody(), tocpv( groove_a ), tocpv( groove_b ), tocpv( anchr2 ) ); - SetData(); + mConstraint = cpGrooveJointNew( a->getBody(), b->getBody(), tocpv( groove_a ), tocpv( groove_b ), tocpv( anchr2 ) ); + setData(); } -cVect GrooveJoint::Anchr2() { +cVect GrooveJoint::anchr2() { return tovect( cpGrooveJointGetAnchr2( mConstraint ) ); } -void GrooveJoint::Anchr2( const cVect& anchr2 ) { +void GrooveJoint::anchr2( const cVect& anchr2 ) { cpGrooveJointSetAnchr2( mConstraint, tocpv( anchr2 ) ); } -cVect GrooveJoint::GrooveA() { +cVect GrooveJoint::grooveA() { return tovect( cpGrooveJointGetGrooveA( mConstraint ) ); } -void GrooveJoint::GrooveA( const cVect& groove_a ) { +void GrooveJoint::grooveA( const cVect& groove_a ) { cpGrooveJointSetGrooveA( mConstraint, tocpv( groove_a ) ); } -cVect GrooveJoint::GrooveB() { +cVect GrooveJoint::grooveB() { return tovect( cpGrooveJointGetGrooveB( mConstraint ) ); } -void GrooveJoint::GrooveB( const cVect& groove_b ) { +void GrooveJoint::grooveB( const cVect& groove_b ) { cpGrooveJointSetGrooveB( mConstraint, tocpv( groove_b ) ); } -void GrooveJoint::Draw() { +void GrooveJoint::draw() { #ifdef PHYSICS_RENDERER_ENABLED if ( mDrawPointSize <= 0 ) return; @@ -69,11 +69,11 @@ void GrooveJoint::Draw() { } #ifdef PHYSICS_RENDERER_ENABLED -cpFloat GrooveJoint::DrawPointSize() { +cpFloat GrooveJoint::drawPointSize() { return mDrawPointSize; } -void GrooveJoint::DrawPointSize( const cpFloat& size ) { +void GrooveJoint::drawPointSize( const cpFloat& size ) { mDrawPointSize = size; } #endif diff --git a/src/eepp/physics/constraints/pinjoint.cpp b/src/eepp/physics/constraints/pinjoint.cpp index d08071102..8ec0edde9 100644 --- a/src/eepp/physics/constraints/pinjoint.cpp +++ b/src/eepp/physics/constraints/pinjoint.cpp @@ -12,35 +12,35 @@ PinJoint::PinJoint( Body * a, Body * b, cVect anchr1, cVect anchr2 ) : mDrawPointSize( 5.f ) #endif { - mConstraint = cpPinJointNew( a->GetBody(), b->GetBody(), tocpv( anchr1 ), tocpv( anchr2 ) ); - SetData(); + mConstraint = cpPinJointNew( a->getBody(), b->getBody(), tocpv( anchr1 ), tocpv( anchr2 ) ); + setData(); } -cVect PinJoint::Anchr1() { +cVect PinJoint::anchr1() { return tovect( cpPinJointGetAnchr1( mConstraint ) ); } -void PinJoint::Anchr1( const cVect& anchr1 ) { +void PinJoint::anchr1( const cVect& anchr1 ) { cpPinJointSetAnchr1( mConstraint, tocpv( anchr1 ) ); } -cVect PinJoint::Anchr2() { +cVect PinJoint::anchr2() { return tovect( cpPinJointGetAnchr2( mConstraint ) ); } -void PinJoint::Anchr2( const cVect& anchr2 ) { +void PinJoint::anchr2( const cVect& anchr2 ) { cpPinJointSetAnchr2( mConstraint, tocpv( anchr2 ) ); } -cpFloat PinJoint::Dist() { +cpFloat PinJoint::dist() { return cpPinJointGetDist( mConstraint ); } -void PinJoint::Dist( const cpFloat& dist ) { +void PinJoint::dist( const cpFloat& dist ) { cpPinJointSetDist( mConstraint, dist ); } -void PinJoint::Draw() { +void PinJoint::draw() { #ifdef PHYSICS_RENDERER_ENABLED if ( mDrawPointSize <= 0 ) return; @@ -71,11 +71,11 @@ void PinJoint::Draw() { } #ifdef PHYSICS_RENDERER_ENABLED -cpFloat PinJoint::DrawPointSize() { +cpFloat PinJoint::drawPointSize() { return mDrawPointSize; } -void PinJoint::DrawPointSize( const cpFloat& size ) { +void PinJoint::drawPointSize( const cpFloat& size ) { mDrawPointSize = size; } #endif diff --git a/src/eepp/physics/constraints/pivotjoint.cpp b/src/eepp/physics/constraints/pivotjoint.cpp index b11914cf0..8f7de67d8 100644 --- a/src/eepp/physics/constraints/pivotjoint.cpp +++ b/src/eepp/physics/constraints/pivotjoint.cpp @@ -12,8 +12,8 @@ PivotJoint::PivotJoint( Body * a, Body * b, cVect pivot ) : mDrawPointSize( 10.f ) #endif { - mConstraint = cpPivotJointNew( a->GetBody(), b->GetBody(), tocpv( pivot ) ); - SetData(); + mConstraint = cpPivotJointNew( a->getBody(), b->getBody(), tocpv( pivot ) ); + setData(); } PivotJoint::PivotJoint( Body * a, Body * b, cVect anchr1, cVect anchr2 ) @@ -21,27 +21,27 @@ PivotJoint::PivotJoint( Body * a, Body * b, cVect anchr1, cVect anchr2 ) : mDrawPointSize( 10.f ) #endif { - mConstraint = cpPivotJointNew2( a->GetBody(), b->GetBody(), tocpv( anchr1 ), tocpv( anchr2 ) ); - SetData(); + mConstraint = cpPivotJointNew2( a->getBody(), b->getBody(), tocpv( anchr1 ), tocpv( anchr2 ) ); + setData(); } -cVect PivotJoint::Anchr1() { +cVect PivotJoint::anchr1() { return tovect( cpPivotJointGetAnchr1( mConstraint ) ); } -void PivotJoint::Anchr1( const cVect& anchr1 ) { +void PivotJoint::anchr1( const cVect& anchr1 ) { cpPivotJointSetAnchr1( mConstraint, tocpv( anchr1 ) ); } -cVect PivotJoint::Anchr2() { +cVect PivotJoint::anchr2() { return tovect( cpPivotJointGetAnchr2( mConstraint ) ); } -void PivotJoint::Anchr2( const cVect& anchr2 ) { +void PivotJoint::anchr2( const cVect& anchr2 ) { cpPivotJointSetAnchr2( mConstraint, tocpv( anchr2 ) ); } -void PivotJoint::Draw() { +void PivotJoint::draw() { #ifdef PHYSICS_RENDERER_ENABLED if ( mDrawPointSize <= 0 ) return; @@ -66,11 +66,11 @@ void PivotJoint::Draw() { } #ifdef PHYSICS_RENDERER_ENABLED -cpFloat PivotJoint::DrawPointSize() { +cpFloat PivotJoint::drawPointSize() { return mDrawPointSize; } -void PivotJoint::DrawPointSize( const cpFloat& size ) { +void PivotJoint::drawPointSize( const cpFloat& size ) { mDrawPointSize = size; } #endif diff --git a/src/eepp/physics/constraints/ratchetjoint.cpp b/src/eepp/physics/constraints/ratchetjoint.cpp index 73623b425..1c83f6538 100644 --- a/src/eepp/physics/constraints/ratchetjoint.cpp +++ b/src/eepp/physics/constraints/ratchetjoint.cpp @@ -3,35 +3,35 @@ CP_NAMESPACE_BEGIN RatchetJoint::RatchetJoint( Body * a, Body * b, cpFloat phase, cpFloat ratchet ) { - mConstraint = cpRatchetJointNew( a->GetBody(), b->GetBody(), phase, ratchet ); - SetData(); + mConstraint = cpRatchetJointNew( a->getBody(), b->getBody(), phase, ratchet ); + setData(); } -cpFloat RatchetJoint::Angle() { +cpFloat RatchetJoint::angle() { return cpRatchetJointGetAngle( mConstraint ); } -void RatchetJoint::Angle( const cpFloat& angle ) { +void RatchetJoint::angle( const cpFloat& angle ) { cpRatchetJointSetAngle( mConstraint, angle ); } -cpFloat RatchetJoint::Phase() { +cpFloat RatchetJoint::phase() { return cpRatchetJointGetPhase( mConstraint ); } -void RatchetJoint::Phase( const cpFloat& phase ) { +void RatchetJoint::phase( const cpFloat& phase ) { cpRatchetJointSetPhase( mConstraint, phase ); } -cpFloat RatchetJoint::Ratchet() { +cpFloat RatchetJoint::ratchet() { return cpRatchetJointGetRatchet( mConstraint ); } -void RatchetJoint::Ratchet( const cpFloat& ratchet ) { +void RatchetJoint::ratchet( const cpFloat& ratchet ) { cpRatchetJointSetRatchet( mConstraint, ratchet ); } -void RatchetJoint::Draw() { +void RatchetJoint::draw() { // Not implemented } diff --git a/src/eepp/physics/constraints/rotarylimitjoint.cpp b/src/eepp/physics/constraints/rotarylimitjoint.cpp index 462b60276..1f92f08c0 100644 --- a/src/eepp/physics/constraints/rotarylimitjoint.cpp +++ b/src/eepp/physics/constraints/rotarylimitjoint.cpp @@ -3,27 +3,27 @@ CP_NAMESPACE_BEGIN RotaryLimitJoint::RotaryLimitJoint( Body * a, Body * b, cpFloat min, cpFloat max ) { - mConstraint = cpRotaryLimitJointNew( a->GetBody(), b->GetBody(), min, max ); - SetData(); + mConstraint = cpRotaryLimitJointNew( a->getBody(), b->getBody(), min, max ); + setData(); } -cpFloat RotaryLimitJoint::Min() { +cpFloat RotaryLimitJoint::min() { return cpRotaryLimitJointGetMin( mConstraint ); } -void RotaryLimitJoint::Min( const cpFloat& min ) { +void RotaryLimitJoint::min( const cpFloat& min ) { cpRotaryLimitJointSetMin( mConstraint, min ); } -cpFloat RotaryLimitJoint::Max() { +cpFloat RotaryLimitJoint::max() { return cpRotaryLimitJointGetMax( mConstraint ); } -void RotaryLimitJoint::Max( const cpFloat& max ) { +void RotaryLimitJoint::max( const cpFloat& max ) { cpRotaryLimitJointSetMax( mConstraint, max ); } -void RotaryLimitJoint::Draw() { +void RotaryLimitJoint::draw() { // Not implemented } diff --git a/src/eepp/physics/constraints/simplemotor.cpp b/src/eepp/physics/constraints/simplemotor.cpp index 7ad9ef899..2fa606818 100644 --- a/src/eepp/physics/constraints/simplemotor.cpp +++ b/src/eepp/physics/constraints/simplemotor.cpp @@ -3,19 +3,19 @@ CP_NAMESPACE_BEGIN SimpleMotor::SimpleMotor( Body * a, Body * b, cpFloat rate ) { - mConstraint = cpSimpleMotorNew( a->GetBody(), b->GetBody(), rate ); - SetData(); + mConstraint = cpSimpleMotorNew( a->getBody(), b->getBody(), rate ); + setData(); } -cpFloat SimpleMotor::Rate() { +cpFloat SimpleMotor::rate() { return cpSimpleMotorGetRate( mConstraint ); } -void SimpleMotor::Rate( const cpFloat& rate ) { +void SimpleMotor::rate( const cpFloat& rate ) { cpSimpleMotorSetRate( mConstraint, rate ); } -void SimpleMotor::Draw() { +void SimpleMotor::draw() { // Not implemented } diff --git a/src/eepp/physics/constraints/slidejoint.cpp b/src/eepp/physics/constraints/slidejoint.cpp index faccb6914..2f50b2b0d 100644 --- a/src/eepp/physics/constraints/slidejoint.cpp +++ b/src/eepp/physics/constraints/slidejoint.cpp @@ -12,43 +12,43 @@ SlideJoint::SlideJoint( Body * a, Body *b, cVect anchr1, cVect anchr2, cpFloat m : mDrawPointSize( 5.f ) #endif { - mConstraint = cpSlideJointNew( a->GetBody(), b->GetBody(), tocpv( anchr1 ), tocpv( anchr2 ), min, max ); - SetData(); + mConstraint = cpSlideJointNew( a->getBody(), b->getBody(), tocpv( anchr1 ), tocpv( anchr2 ), min, max ); + setData(); } -cVect SlideJoint::Anchr1() { +cVect SlideJoint::anchr1() { return tovect( cpSlideJointGetAnchr1( mConstraint ) ); } -void SlideJoint::Anchr1( const cVect& anchr1 ) { +void SlideJoint::anchr1( const cVect& anchr1 ) { cpSlideJointSetAnchr1( mConstraint, tocpv( anchr1 ) ); } -cVect SlideJoint::Anchr2() { +cVect SlideJoint::anchr2() { return tovect( cpSlideJointGetAnchr2( mConstraint ) ); } -void SlideJoint::Anchr2( const cVect& anchr2 ) { +void SlideJoint::anchr2( const cVect& anchr2 ) { cpSlideJointSetAnchr2( mConstraint, tocpv( anchr2 ) ); } -cpFloat SlideJoint::Min() { +cpFloat SlideJoint::min() { return cpSlideJointGetMin( mConstraint ); } -void SlideJoint::Min( const cpFloat& min ) { +void SlideJoint::min( const cpFloat& min ) { cpSlideJointSetMin( mConstraint, min ); } -cpFloat SlideJoint::Max() { +cpFloat SlideJoint::max() { return cpSlideJointGetMax( mConstraint ); } -void SlideJoint::Max( const cpFloat& max ) { +void SlideJoint::max( const cpFloat& max ) { cpSlideJointSetMax( mConstraint, max ); } -void SlideJoint::Draw() { +void SlideJoint::draw() { #ifdef PHYSICS_RENDERER_ENABLED if ( mDrawPointSize <= 0 ) return; @@ -77,11 +77,11 @@ void SlideJoint::Draw() { } #ifdef PHYSICS_RENDERER_ENABLED -cpFloat SlideJoint::DrawPointSize() { +cpFloat SlideJoint::drawPointSize() { return mDrawPointSize; } -void SlideJoint::DrawPointSize( const cpFloat& size ) { +void SlideJoint::drawPointSize( const cpFloat& size ) { mDrawPointSize = size; } #endif diff --git a/src/eepp/physics/moment.cpp b/src/eepp/physics/moment.cpp index 47e5413e4..40961e7e1 100644 --- a/src/eepp/physics/moment.cpp +++ b/src/eepp/physics/moment.cpp @@ -2,19 +2,19 @@ CP_NAMESPACE_BEGIN -cpFloat Moment::ForCircle( cpFloat m, cpFloat r1, cpFloat r2, cVect offset ) { +cpFloat Moment::forCircle( cpFloat m, cpFloat r1, cpFloat r2, cVect offset ) { return cpMomentForCircle( m, r1, r2, tocpv( offset ) ); } -cpFloat Moment::ForSegment( cpFloat m, cVect a, cVect b) { +cpFloat Moment::forSegment( cpFloat m, cVect a, cVect b) { return cpMomentForSegment( m, tocpv( a ), tocpv( b ) ); } -cpFloat Moment::ForPoly( cpFloat m, int numVerts, const cVect *verts, cVect offset ) { +cpFloat Moment::forPoly( cpFloat m, int numVerts, const cVect *verts, cVect offset ) { return cpMomentForPoly( m, numVerts, constcasttocpv( verts ), tocpv( offset ) ); } -cpFloat Moment::ForBox( cpFloat m, cpFloat width, cpFloat height ) { +cpFloat Moment::forBox( cpFloat m, cpFloat width, cpFloat height ) { return cpMomentForBox( m, width, height ); } diff --git a/src/eepp/physics/physicsmanager.cpp b/src/eepp/physics/physicsmanager.cpp index d595ec931..166dbd005 100644 --- a/src/eepp/physics/physicsmanager.cpp +++ b/src/eepp/physics/physicsmanager.cpp @@ -36,65 +36,65 @@ PhysicsManager::~PhysicsManager() { } } -PhysicsManager::DrawSpaceOptions * PhysicsManager::GetDrawOptions() { +PhysicsManager::DrawSpaceOptions * PhysicsManager::getDrawOptions() { return &mOptions; } -void PhysicsManager::MemoryManager( bool MemoryManager ) { +void PhysicsManager::memoryManager( bool MemoryManager ) { mMemoryManager = MemoryManager; } -const bool& PhysicsManager::MemoryManager() const { +const bool& PhysicsManager::memoryManager() const { return mMemoryManager; } -void PhysicsManager::AddBodyFree( Body * body ) { +void PhysicsManager::addBodyFree( Body * body ) { if ( mMemoryManager ) { if ( std::find( mBodysFree.begin(), mBodysFree.end(), body ) == mBodysFree.end() ) mBodysFree.push_back( body ); } } -void PhysicsManager::RemoveBodyFree( Body * body ) { +void PhysicsManager::removeBodyFree( Body * body ) { if ( mMemoryManager ) { mBodysFree.remove( body ); } } -void PhysicsManager::AddShapeFree( Shape * shape ) { +void PhysicsManager::addShapeFree( Shape * shape ) { if ( mMemoryManager ) { if ( std::find( mShapesFree.begin(), mShapesFree.end(), shape ) == mShapesFree.end() ) mShapesFree.push_back( shape ); } } -void PhysicsManager::RemoveShapeFree( Shape * shape ) { +void PhysicsManager::removeShapeFree( Shape * shape ) { if ( mMemoryManager ) { mShapesFree.remove( shape ); } } -void PhysicsManager::AddConstraintFree( Constraint * constraint ) { +void PhysicsManager::addConstraintFree( Constraint * constraint ) { if ( mMemoryManager ) { if ( std::find( mConstraintFree.begin(), mConstraintFree.end(), constraint ) == mConstraintFree.end() ) mConstraintFree.push_back( constraint ); } } -void PhysicsManager::RemoveConstraintFree( Constraint * constraint ) { +void PhysicsManager::removeConstraintFree( Constraint * constraint ) { if ( mMemoryManager ) { mConstraintFree.remove( constraint ); } } -void PhysicsManager::AddSpace( Space * space ) { +void PhysicsManager::addSpace( Space * space ) { if ( mMemoryManager ) { if ( std::find( mSpaces.begin(), mSpaces.end(), space ) == mSpaces.end() ) mSpaces.push_back( space ); } } -void PhysicsManager::RemoveSpace( Space * space ) { +void PhysicsManager::removeSpace( Space * space ) { if ( mMemoryManager ) { mSpaces.remove( space ); } diff --git a/src/eepp/physics/shape.cpp b/src/eepp/physics/shape.cpp index 758d86f72..34e53ef43 100644 --- a/src/eepp/physics/shape.cpp +++ b/src/eepp/physics/shape.cpp @@ -11,13 +11,13 @@ using namespace EE::Graphics; CP_NAMESPACE_BEGIN -void Shape::ResetShapeIdCounter() { +void Shape::resetShapeIdCounter() { cpResetShapeIdCounter(); } void Shape::Free( Shape * shape, bool DeleteBody ) { if ( DeleteBody ) { - Physics::Body * b = shape->Body(); + Physics::Body * b = shape->body(); cpSAFE_DELETE( b ); } @@ -32,43 +32,43 @@ Shape::Shape() : Shape::~Shape() { cpShapeFree( mShape ); - PhysicsManager::instance()->RemoveShapeFree( this ); + PhysicsManager::instance()->removeShapeFree( this ); } -void Shape::SetData() { +void Shape::setData() { mShape->data = (void*)this; - PhysicsManager::instance()->AddShapeFree( this ); + PhysicsManager::instance()->addShapeFree( this ); } -cpShape * Shape::GetShape() const { +cpShape * Shape::getShape() const { return mShape; } -cBB Shape::CacheBB() { +cBB Shape::cacheBB() { return tocbb( cpShapeCacheBB( mShape ) ); } -cBB Shape::Update( cVect pos, cVect rot ) { +cBB Shape::update( cVect pos, cVect rot ) { return tocbb( cpShapeUpdate( mShape, tocpv( pos ), tocpv( rot ) ) ); } -bool Shape::PointQuery( cVect p ) { +bool Shape::pointQuery( cVect p ) { return 0 != cpShapePointQuery( mShape, tocpv( p ) ); } -Physics::Body * Shape::Body() const { +Physics::Body * Shape::body() const { return reinterpret_cast( mShape->body->data ); } -void Shape::Body( Physics::Body * body ) { - mShape->body = body->GetBody(); +void Shape::body( Physics::Body * body ) { + mShape->body = body->getBody(); } -cBB Shape::BB() const { +cBB Shape::bb() const { return tocbb( mShape->bb ); } -void Shape::BB( const cBB& bb ) { +void Shape::bb( const cBB& bb ) { mShape->bb = tocpbb( bb ); } @@ -88,11 +88,11 @@ void Shape::e( const cpFloat& e ) { mShape->e = e; } -cpFloat Shape::Elasticity() const { +cpFloat Shape::elasticity() const { return e(); } -void Shape::Elasticity( const cpFloat& e ) { +void Shape::elasticity( const cpFloat& e ) { this->e( e ); } @@ -104,69 +104,69 @@ void Shape::u( const cpFloat& u ) { mShape->u = u; } -cpFloat Shape::Friction() const { +cpFloat Shape::friction() const { return u(); } -void Shape::Friction( const cpFloat& u ) { +void Shape::friction( const cpFloat& u ) { this->u( u ); } -cVect Shape::SurfaceVel() const { +cVect Shape::surfaceVel() const { return tovect( mShape->surface_v ); } -void Shape::SurfaceVel( const cVect& vel ) { +void Shape::surfaceVel( const cVect& vel ) { mShape->surface_v = tocpv( vel ); } -cpCollisionType Shape::CollisionType() const { +cpCollisionType Shape::collisionType() const { return mShape->collision_type; } -void Shape::CollisionType( const cpCollisionType& type ) { +void Shape::collisionType( const cpCollisionType& type ) { mShape->collision_type = type; } -cpGroup Shape::Group() const { +cpGroup Shape::group() const { return mShape->group; } -void Shape::Group( const cpGroup& group ) { +void Shape::group( const cpGroup& group ) { mShape->group = group; } -cpLayers Shape::Layers() const { +cpLayers Shape::layers() const { return mShape->layers; } -void Shape::Layers( const cpLayers& layers ) { +void Shape::layers( const cpLayers& layers ) { mShape->layers = layers; } -cpShapeType Shape::Type() const { +cpShapeType Shape::type() const { return mShape->CP_PRIVATE(klass)->type; } -ShapePoly * Shape::GetAsPoly() { - eeASSERT( Type() == CP_POLY_SHAPE ); +ShapePoly * Shape::getAsPoly() { + eeASSERT( type() == CP_POLY_SHAPE ); return reinterpret_cast( this ); } -ShapeCircle * Shape::GetAsCircle() { - eeASSERT( Type() == CP_CIRCLE_SHAPE ); +ShapeCircle * Shape::getAsCircle() { + eeASSERT( type() == CP_CIRCLE_SHAPE ); return reinterpret_cast( this ); } -ShapeSegment * Shape::GetAsSegment() { - eeASSERT( Type() == CP_SEGMENT_SHAPE ); +ShapeSegment * Shape::getAsSegment() { + eeASSERT( type() == CP_SEGMENT_SHAPE ); return reinterpret_cast( this ); } -void Shape::DrawBB() { +void Shape::drawBB() { #ifdef PHYSICS_RENDERER_ENABLED Primitives P; P.setColor( ColorA( 76, 128, 76, 255 ) ); @@ -178,18 +178,18 @@ void Shape::DrawBB() { #endif } -void * Shape::Data() const { +void * Shape::data() const { return mData; } -void Shape::Data( void * data ) { +void Shape::data( void * data ) { mData = data; } -void Shape::Draw( Space * space ) { +void Shape::draw( Space * space ) { } -void Shape::DrawBorder( Space * space ) { +void Shape::drawBorder( Space * space ) { } CP_NAMESPACE_END diff --git a/src/eepp/physics/shapecircle.cpp b/src/eepp/physics/shapecircle.cpp index 4e6595ca0..17840e632 100644 --- a/src/eepp/physics/shapecircle.cpp +++ b/src/eepp/physics/shapecircle.cpp @@ -15,33 +15,33 @@ ShapeCircle * ShapeCircle::New( Physics::Body * body, cpFloat radius, cVect offs } ShapeCircle::ShapeCircle( Physics::Body * body, cpFloat radius, cVect offset ) { - mShape = cpCircleShapeNew( body->GetBody(), radius, tocpv( offset ) ); - SetData(); + mShape = cpCircleShapeNew( body->getBody(), radius, tocpv( offset ) ); + setData(); } -cVect ShapeCircle::Offset() { +cVect ShapeCircle::offset() { return tovect( cpCircleShapeGetOffset( mShape ) ); } -void ShapeCircle::Offset( const cVect &offset ) { +void ShapeCircle::offset( const cVect &offset ) { cpCircleShapeSetOffset( mShape, tocpv( offset ) ); } -cpFloat ShapeCircle::Radius() { +cpFloat ShapeCircle::radius() { return cpCircleShapeGetRadius( mShape ); } -void ShapeCircle::Radius( const cpFloat& radius ) { +void ShapeCircle::radius( const cpFloat& radius ) { cpCircleShapeSetRadius( mShape, radius ); } -void ShapeCircle::Draw( Space * space ) { +void ShapeCircle::draw( Space * space ) { #ifdef PHYSICS_RENDERER_ENABLED Primitives p; cpCircleShape * cs = (cpCircleShape*)mShape; - p.setColor( ColorForShape( mShape, space->GetSpace() ) ); + p.setColor( colorForShape( mShape, space->getSpace() ) ); p.drawCircle( Vector2f( cs->CP_PRIVATE(tc).x, cs->CP_PRIVATE(tc).y ), cs->CP_PRIVATE(r) ); #endif diff --git a/src/eepp/physics/shapecirclesprite.cpp b/src/eepp/physics/shapecirclesprite.cpp index 5189d60f4..8e539333e 100644 --- a/src/eepp/physics/shapecirclesprite.cpp +++ b/src/eepp/physics/shapecirclesprite.cpp @@ -15,7 +15,7 @@ ShapeCircleSprite::ShapeCircleSprite( Physics::Body * body, cpFloat radius, cVec mSprite( Sprite ), mSpriteAutoDelete( AutoDeleteSprite ) { - OffsetSet(); + offsetSet(); } ShapeCircleSprite::~ShapeCircleSprite() { @@ -23,31 +23,31 @@ ShapeCircleSprite::~ShapeCircleSprite() { eeSAFE_DELETE( mSprite ); } -void ShapeCircleSprite::Draw( Space * space ) { - cVect Pos = Body()->Pos(); +void ShapeCircleSprite::draw( Space * space ) { + cVect Pos = body()->pos(); mSprite->position( Pos.x, Pos.y ); - mSprite->angle( Body()->AngleDeg() ); + mSprite->angle( body()->angleDeg() ); mSprite->draw(); } -void ShapeCircleSprite::OffsetSet() { - mSprite->size( Sizef( ShapeCircle::Radius() * 2, ShapeCircle::Radius() * 2 ) ); - mSprite->offset( Vector2i( -ShapeCircle::Radius() + ShapeCircle::Offset().x, -ShapeCircle::Radius() + ShapeCircle::Offset().y ) ); +void ShapeCircleSprite::offsetSet() { + mSprite->size( Sizef( ShapeCircle::radius() * 2, ShapeCircle::radius() * 2 ) ); + mSprite->offset( Vector2i( -ShapeCircle::radius() + ShapeCircle::offset().x, -ShapeCircle::radius() + ShapeCircle::offset().y ) ); } -Sprite * ShapeCircleSprite::GetSprite() const { +Sprite * ShapeCircleSprite::getSprite() const { return mSprite; } -void ShapeCircleSprite::Radius( const cpFloat& radius ) { - ShapeCircle::Radius( radius ); - OffsetSet(); +void ShapeCircleSprite::radius( const cpFloat& radius ) { + ShapeCircle::radius( radius ); + offsetSet(); } -void ShapeCircleSprite::Offset( const cVect &offset ) { - ShapeCircle::Offset( offset ); - OffsetSet(); +void ShapeCircleSprite::offset( const cVect &offset ) { + ShapeCircle::offset( offset ); + offsetSet(); } CP_NAMESPACE_END diff --git a/src/eepp/physics/shapepoint.cpp b/src/eepp/physics/shapepoint.cpp index a3a0b0897..61f34fe7f 100644 --- a/src/eepp/physics/shapepoint.cpp +++ b/src/eepp/physics/shapepoint.cpp @@ -19,27 +19,27 @@ ShapePoint::ShapePoint( Physics::Body * body, cpFloat radius, cVect offset ) : mDrawRadius( radius ) #endif { - mShape = cpCircleShapeNew( body->GetBody(), radius, tocpv( offset ) ); - SetData(); + mShape = cpCircleShapeNew( body->getBody(), radius, tocpv( offset ) ); + setData(); } -cVect ShapePoint::Offset() { +cVect ShapePoint::offset() { return tovect( cpCircleShapeGetOffset( mShape ) ); } -void ShapePoint::Offset( const cVect &offset ) { +void ShapePoint::offset( const cVect &offset ) { cpCircleShapeSetOffset( mShape, tocpv( offset ) ); } -cpFloat ShapePoint::Radius() { +cpFloat ShapePoint::radius() { return cpCircleShapeGetRadius( mShape ); } -void ShapePoint::Radius( const cpFloat& radius ) { +void ShapePoint::radius( const cpFloat& radius ) { cpCircleShapeSetRadius( mShape, radius ); } -void ShapePoint::Draw( Space * space ) { +void ShapePoint::draw( Space * space ) { #ifdef PHYSICS_RENDERER_ENABLED BatchRenderer * BR = GlobalBatchRenderer::instance(); @@ -47,7 +47,7 @@ void ShapePoint::Draw( Space * space ) { BR->setTexture( NULL ); BR->pointsBegin(); - BR->pointSetColor( ColorForShape( mShape, space->GetSpace() ) ); + BR->pointSetColor( colorForShape( mShape, space->getSpace() ) ); cpCircleShape * cs = (cpCircleShape*)mShape; @@ -58,11 +58,11 @@ void ShapePoint::Draw( Space * space ) { } #ifdef PHYSICS_RENDERER_ENABLED -cpFloat ShapePoint::DrawRadius() { +cpFloat ShapePoint::drawRadius() { return mDrawRadius; } -void ShapePoint::DrawRadius( const cpFloat& radius ) { +void ShapePoint::drawRadius( const cpFloat& radius ) { mDrawRadius = radius; } #endif diff --git a/src/eepp/physics/shapepoly.cpp b/src/eepp/physics/shapepoly.cpp index 91a76f747..b36a7d25d 100644 --- a/src/eepp/physics/shapepoly.cpp +++ b/src/eepp/physics/shapepoly.cpp @@ -18,42 +18,42 @@ ShapePoly * ShapePoly::New( Physics::Body * body, cpFloat width, cpFloat height } ShapePoly::ShapePoly( Physics::Body * body, int numVerts, cVect *verts, cVect offset ) { - mShape = cpPolyShapeNew( body->GetBody(), numVerts, casttocpv( verts ), tocpv( offset ) ); - SetData(); + mShape = cpPolyShapeNew( body->getBody(), numVerts, casttocpv( verts ), tocpv( offset ) ); + setData(); } ShapePoly::ShapePoly( Physics::Body * body, cpFloat width, cpFloat height ) : Shape() { - mShape = cpBoxShapeNew( body->GetBody(), width, height ); - SetData(); + mShape = cpBoxShapeNew( body->getBody(), width, height ); + setData(); } -bool ShapePoly::Validate( const cVect * verts, const int numVerts ) { +bool ShapePoly::validate( const cVect * verts, const int numVerts ) { return 0 != cpPolyValidate( constcasttocpv( verts ), numVerts ); } -int ShapePoly::GetNumVerts() { +int ShapePoly::getNumVerts() { return cpPolyShapeGetNumVerts( mShape ); } -cVect ShapePoly::GetVert( int idx ) { +cVect ShapePoly::getVert( int idx ) { return tovect( cpPolyShapeGetVert( mShape, idx ) ); } -void ShapePoly::SetVerts( int numVerts, cVect *verts, cVect offset ) { +void ShapePoly::setVerts( int numVerts, cVect *verts, cVect offset ) { cpPolyShapeSetVerts( mShape, numVerts, casttocpv( verts ), tocpv( offset ) ); } -void ShapePoly::Recenter( int numVerts, cVect *verts ) { +void ShapePoly::recenter( int numVerts, cVect *verts ) { cpRecenterPoly( numVerts, casttocpv( verts ) ); } -cVect ShapePoly::Centroid( int numVerts, const cVect * verts ) { +cVect ShapePoly::centroid( int numVerts, const cVect * verts ) { return tovect( cpCentroidForPoly( numVerts, constcasttocpv( verts ) ) ); } -void ShapePoly::Draw( Space * space ) { +void ShapePoly::draw( Space * space ) { #ifdef PHYSICS_RENDERER_ENABLED cpPolyShape * poly = (cpPolyShape*)mShape; @@ -61,7 +61,7 @@ void ShapePoly::Draw( Space * space ) { BR->setTexture( NULL ); - ColorA Col = ColorForShape( (cpShape *)poly, space->GetSpace() ); + ColorA Col = colorForShape( (cpShape *)poly, space->getSpace() ); if( !poly->CP_PRIVATE(shape).sensor ){ if ( 4 != poly->CP_PRIVATE(numVerts) ) { @@ -85,13 +85,13 @@ void ShapePoly::Draw( Space * space ) { #endif } -void ShapePoly::DrawBorder( Space *space ) { +void ShapePoly::drawBorder( Space *space ) { #ifdef PHYSICS_RENDERER_ENABLED cpPolyShape * poly = (cpPolyShape*)mShape; BatchRenderer * BR = GlobalBatchRenderer::instance(); - ColorA Col = ColorForShape( (cpShape *)poly, space->GetSpace() ); + ColorA Col = colorForShape( (cpShape *)poly, space->getSpace() ); BR->lineLoopBegin(); BR->lineLoopSetColor( Col ); diff --git a/src/eepp/physics/shapepolysprite.cpp b/src/eepp/physics/shapepolysprite.cpp index a4d96b209..86f51c2f9 100644 --- a/src/eepp/physics/shapepolysprite.cpp +++ b/src/eepp/physics/shapepolysprite.cpp @@ -19,7 +19,7 @@ ShapePolySprite::ShapePolySprite( Physics::Body * body, int numVerts, cVect *ver mSprite( Sprite ), mSpriteAutoDelete( AutoDeleteSprite ) { - OffsetSet( Centroid( numVerts, verts ) ); + offsetSet( centroid( numVerts, verts ) ); } ShapePolySprite::ShapePolySprite( Physics::Body * body, cpFloat width, cpFloat height, Sprite * Sprite, bool AutoDeleteSprite ) : @@ -28,7 +28,7 @@ ShapePolySprite::ShapePolySprite( Physics::Body * body, cpFloat width, cpFloat h mSpriteAutoDelete( AutoDeleteSprite ) { mSprite->size( Sizef( width, height ) ); - OffsetSet( cVectNew( width / 2, height / 2 ) ); + offsetSet( cVectNew( width / 2, height / 2 ) ); } ShapePolySprite::~ShapePolySprite() { @@ -36,22 +36,22 @@ ShapePolySprite::~ShapePolySprite() { eeSAFE_DELETE( mSprite ); } -void ShapePolySprite::Draw( Space * space ) { - cVect Pos = Body()->Pos(); +void ShapePolySprite::draw( Space * space ) { + cVect Pos = body()->pos(); mSprite->offset( mOffset ); mSprite->position( Pos.x, Pos.y ); - mSprite->angle( Body()->AngleDeg() ); + mSprite->angle( body()->angleDeg() ); mSprite->draw(); } -void ShapePolySprite::OffsetSet( cVect center ) { +void ShapePolySprite::offsetSet( cVect center ) { cVect myCenter = cVectNew( ( mSprite->size().x / 2 ), ( mSprite->size().y / 2 ) ); mOffset = Vector2i( (Int32)( -myCenter.x + ( center.x - myCenter.x ) ) , (Int32)( -myCenter.y + ( center.y - myCenter.y ) ) ); } -Sprite * ShapePolySprite::GetSprite() const { +Sprite * ShapePolySprite::getSprite() const { return mSprite; } diff --git a/src/eepp/physics/shapesegment.cpp b/src/eepp/physics/shapesegment.cpp index 84caf0dd9..1302f3e4f 100644 --- a/src/eepp/physics/shapesegment.cpp +++ b/src/eepp/physics/shapesegment.cpp @@ -16,47 +16,47 @@ ShapeSegment * ShapeSegment::New( Physics::Body * body, cVect a, cVect b, cpFloa } ShapeSegment::ShapeSegment( Physics::Body * body, cVect a, cVect b, cpFloat radius ) { - mShape = cpSegmentShapeNew( body->GetBody(), tocpv( a ), tocpv( b ), radius ); - SetData(); + mShape = cpSegmentShapeNew( body->getBody(), tocpv( a ), tocpv( b ), radius ); + setData(); } -cVect ShapeSegment::A() { +cVect ShapeSegment::a() { return tovect( cpSegmentShapeGetA( mShape ) ); } -cVect ShapeSegment::B() { +cVect ShapeSegment::b() { return tovect( cpSegmentShapeGetB( mShape ) ); } -cVect ShapeSegment::Normal() { +cVect ShapeSegment::normal() { return tovect( cpSegmentShapeGetNormal( mShape ) ); } -cpFloat ShapeSegment::Radius() { +cpFloat ShapeSegment::radius() { return cpSegmentShapeGetRadius( mShape ); } -void ShapeSegment::Radius( const cpFloat& radius ) { +void ShapeSegment::radius( const cpFloat& radius ) { cpSegmentShapeSetRadius( mShape, radius ); } -void ShapeSegment::Endpoints( const cVect& a, const cVect& b ) { +void ShapeSegment::endpoints( const cVect& a, const cVect& b ) { cpSegmentShapeSetEndpoints( mShape, tocpv( a ), tocpv( b ) ); } -bool ShapeSegment::Query( cVect a, cVect b, cpSegmentQueryInfo * info ) { +bool ShapeSegment::query( cVect a, cVect b, cpSegmentQueryInfo * info ) { return 0 != cpShapeSegmentQuery( mShape, tocpv( a ), tocpv( b ), info ); } -cVect ShapeSegment::QueryHitPoint( const cVect start, const cVect end, const cpSegmentQueryInfo info ) { +cVect ShapeSegment::queryHitPoint( const cVect start, const cVect end, const cpSegmentQueryInfo info ) { return tovect( cpSegmentQueryHitPoint( tocpv( start ), tocpv( end ), info ) ); } -cpFloat ShapeSegment::QueryHitDist( const cVect start, const cVect end, const cpSegmentQueryInfo info ) { +cpFloat ShapeSegment::queryHitDist( const cVect start, const cVect end, const cpSegmentQueryInfo info ) { return cpSegmentQueryHitDist( tocpv( start ), tocpv( end ), info ); } -void ShapeSegment::Draw( Space * space ) { +void ShapeSegment::draw( Space * space ) { #ifdef PHYSICS_RENDERER_ENABLED static const float pillVAR[] = { 0.0000f, 1.0000f, 1.0f, @@ -116,7 +116,7 @@ void ShapeSegment::Draw( Space * space ) { GLi->vertexPointer( 3, GL_FLOAT, 0, pillVAR, pillVAR_count * sizeof(float) * 3 ); if( !seg->CP_PRIVATE(shape).sensor ) { - ColorA C = ColorForShape( mShape, space->GetSpace() ); + ColorA C = colorForShape( mShape, space->getSpace() ); tcolors.assign( tcolors.size(), C ); diff --git a/src/eepp/physics/space.cpp b/src/eepp/physics/space.cpp index 66ba04c5d..4b44ab973 100644 --- a/src/eepp/physics/space.cpp +++ b/src/eepp/physics/space.cpp @@ -24,8 +24,8 @@ Space::Space() : mSpace->data = (void*)this; mStatiBody = cpNew( Body, ( mSpace->staticBody ) ); - PhysicsManager::instance()->RemoveBodyFree( mStatiBody ); - PhysicsManager::instance()->AddSpace( this ); + PhysicsManager::instance()->removeBodyFree( mStatiBody ); + PhysicsManager::instance()->addSpace( this ); } Space::~Space() { @@ -47,198 +47,198 @@ Space::~Space() { cpSAFE_DELETE( mStatiBody ); - PhysicsManager::instance()->RemoveSpace( this ); + PhysicsManager::instance()->removeSpace( this ); } -void Space::Data( void * data ) { +void Space::data( void * data ) { mData = data; } -void * Space::Data() const { +void * Space::data() const { return mData; } -void Space::Step( const cpFloat& dt ) { +void Space::step( const cpFloat& dt ) { cpSpaceStep( mSpace, dt ); } -void Space::Update() { +void Space::update() { #ifdef PHYSICS_RENDERER_ENABLED - Step( Window::Engine::instance()->elapsed().asSeconds() ); + step( Window::Engine::instance()->elapsed().asSeconds() ); #else Step( 1 / 60 ); #endif } -const int& Space::Iterations() const { +const int& Space::iterations() const { return mSpace->iterations; } -void Space::Iterations( const int& iterations ) { +void Space::iterations( const int& iterations ) { mSpace->iterations = iterations; } -cVect Space::Gravity() const { +cVect Space::gravity() const { return tovect( mSpace->gravity ); } -void Space::Gravity( const cVect& gravity ) { +void Space::gravity( const cVect& gravity ) { mSpace->gravity = tocpv( gravity ); } -const cpFloat& Space::Damping() const { +const cpFloat& Space::damping() const { return mSpace->damping; } -void Space::Damping( const cpFloat& damping ) { +void Space::damping( const cpFloat& damping ) { mSpace->damping = damping; } -const cpFloat& Space::IdleSpeedThreshold() const { +const cpFloat& Space::idleSpeedThreshold() const { return mSpace->idleSpeedThreshold; } -void Space::IdleSpeedThreshold( const cpFloat& idleSpeedThreshold ) { +void Space::idleSpeedThreshold( const cpFloat& idleSpeedThreshold ) { mSpace->idleSpeedThreshold = idleSpeedThreshold; } -const cpFloat& Space::SleepTimeThreshold() const { +const cpFloat& Space::sleepTimeThreshold() const { return mSpace->sleepTimeThreshold; } -void Space::SleepTimeThreshold( const cpFloat& sleepTimeThreshold ) { +void Space::sleepTimeThreshold( const cpFloat& sleepTimeThreshold ) { mSpace->sleepTimeThreshold = sleepTimeThreshold; } -void Space::CollisionSlop( cpFloat slop ) { +void Space::collisionSlop( cpFloat slop ) { mSpace->collisionSlop = slop; } -cpFloat Space::CollisionSlop() const { +cpFloat Space::collisionSlop() const { return mSpace->collisionSlop; } -void Space::CollisionBias( cpFloat bias ) { +void Space::collisionBias( cpFloat bias ) { mSpace->collisionBias = bias; } -cpFloat Space::CollisionBias() const { +cpFloat Space::collisionBias() const { return mSpace->collisionBias; } -cpTimestamp Space::CollisionPersistence() { +cpTimestamp Space::collisionPersistence() { return cpSpaceGetCollisionPersistence( mSpace ); } -void Space::CollisionPersistence( cpTimestamp value ) { +void Space::collisionPersistence( cpTimestamp value ) { cpSpaceSetCollisionPersistence( mSpace, value ); } -bool Space::EnableContactGraph() { +bool Space::enableContactGraph() { return cpTrue == cpSpaceGetEnableContactGraph( mSpace ); } -void Space::EnableContactGraph( bool value ) { +void Space::enableContactGraph( bool value ) { cpSpaceSetEnableContactGraph( mSpace, value ); } -Body * Space::StatiBody() const { +Body * Space::staticBody() const { return mStatiBody; } -bool Space::Contains( Shape * shape ) { - return cpTrue == cpSpaceContainsShape( mSpace, shape->GetShape() ); +bool Space::contains( Shape * shape ) { + return cpTrue == cpSpaceContainsShape( mSpace, shape->getShape() ); } -bool Space::Contains( Body * body ) { - return cpTrue == cpSpaceContainsBody( mSpace, body->GetBody() ); +bool Space::contains( Body * body ) { + return cpTrue == cpSpaceContainsBody( mSpace, body->getBody() ); } -bool Space::Contains( Constraint * constraint ) { - return cpTrue == cpSpaceContainsConstraint( mSpace, constraint->GetConstraint() ); +bool Space::contains( Constraint * constraint ) { + return cpTrue == cpSpaceContainsConstraint( mSpace, constraint->getConstraint() ); } -Shape * Space::AddShape( Shape * shape ) { - cpSpaceAddShape( mSpace, shape->GetShape() ); +Shape * Space::addShape( Shape * shape ) { + cpSpaceAddShape( mSpace, shape->getShape() ); mShapes.push_back( shape ); - PhysicsManager::instance()->RemoveShapeFree( shape ); + PhysicsManager::instance()->removeShapeFree( shape ); return shape; } -Shape * Space::AddStatiShape( Shape * shape ) { - cpSpaceAddStaticShape( mSpace, shape->GetShape() ); +Shape * Space::addStaticShape( Shape * shape ) { + cpSpaceAddStaticShape( mSpace, shape->getShape() ); mShapes.push_back( shape ); - PhysicsManager::instance()->RemoveShapeFree( shape ); + PhysicsManager::instance()->removeShapeFree( shape ); return shape; } -Body * Space::AddBody( Body * body ) { - cpSpaceAddBody( mSpace, body->GetBody() ); +Body * Space::addBody( Body * body ) { + cpSpaceAddBody( mSpace, body->getBody() ); mBodys.push_back( body ); - PhysicsManager::instance()->RemoveBodyFree( body ); + PhysicsManager::instance()->removeBodyFree( body ); return body; } -Constraint * Space::AddConstraint( Constraint * constraint ) { - cpSpaceAddConstraint( mSpace, constraint->GetConstraint() ); +Constraint * Space::addConstraint( Constraint * constraint ) { + cpSpaceAddConstraint( mSpace, constraint->getConstraint() ); mConstraints.push_back( constraint ); - PhysicsManager::instance()->RemoveConstraintFree( constraint ); + PhysicsManager::instance()->removeConstraintFree( constraint ); return constraint; } -void Space::RemoveShape( Shape * shape ) { +void Space::removeShape( Shape * shape ) { if ( NULL != shape ) { - cpSpaceRemoveShape( mSpace, shape->GetShape() ); + cpSpaceRemoveShape( mSpace, shape->getShape() ); mShapes.remove( shape ); - PhysicsManager::instance()->AddShapeFree( shape ); + PhysicsManager::instance()->addShapeFree( shape ); } } -void Space::RemoveStatiShape( Shape * shape ) { +void Space::removeStatiShape( Shape * shape ) { if ( NULL != shape ) { - cpSpaceRemoveStaticShape( mSpace, shape->GetShape() ); + cpSpaceRemoveStaticShape( mSpace, shape->getShape() ); mShapes.remove( shape ); - PhysicsManager::instance()->AddShapeFree( shape ); + PhysicsManager::instance()->addShapeFree( shape ); } } -void Space::RemoveBody( Body * body ) { +void Space::removeBody( Body * body ) { if ( NULL != body ) { - cpSpaceRemoveBody( mSpace, body->GetBody() ); + cpSpaceRemoveBody( mSpace, body->getBody() ); mBodys.remove( body ); - PhysicsManager::instance()->RemoveBodyFree( body ); + PhysicsManager::instance()->removeBodyFree( body ); } } -void Space::RemoveConstraint( Constraint * constraint ) { +void Space::removeConstraint( Constraint * constraint ) { if ( NULL != constraint ) { - cpSpaceRemoveConstraint( mSpace, constraint->GetConstraint() ); + cpSpaceRemoveConstraint( mSpace, constraint->getConstraint() ); mConstraints.remove( constraint ); - PhysicsManager::instance()->AddConstraintFree( constraint ); + PhysicsManager::instance()->addConstraintFree( constraint ); } } -Shape * Space::PointQueryFirst( cVect point, cpLayers layers, cpGroup group ) { +Shape * Space::pointQueryFirst( cVect point, cpLayers layers, cpGroup group ) { cpShape * shape = cpSpacePointQueryFirst( mSpace, tocpv( point ), layers, group ); if ( NULL != shape ) { @@ -248,7 +248,7 @@ Shape * Space::PointQueryFirst( cVect point, cpLayers layers, cpGroup group ) { return NULL; } -Shape * Space::SegmentQueryFirst( cVect start, cVect end, cpLayers layers, cpGroup group, cpSegmentQueryInfo * out ) { +Shape * Space::segmentQueryFirst( cVect start, cVect end, cpLayers layers, cpGroup group, cpSegmentQueryInfo * out ) { cpShape * shape = cpSpaceSegmentQueryFirst( mSpace, tocpv( start ), tocpv( end ), layers, group, out ); if ( NULL != shape ) { @@ -258,39 +258,39 @@ Shape * Space::SegmentQueryFirst( cVect start, cVect end, cpLayers layers, cpGro return NULL; } -cpSpace * Space::GetSpace() const { +cpSpace * Space::getSpace() const { return mSpace; } -void Space::ActivateShapesTouchingShape( Shape * shape ) { - cpSpaceActivateShapesTouchingShape( mSpace, shape->GetShape() ); +void Space::activateShapesTouchingShape( Shape * shape ) { + cpSpaceActivateShapesTouchingShape( mSpace, shape->getShape() ); } #ifdef PHYSICS_RENDERER_ENABLED static void drawObject( cpShape * shape, cpSpace * space ) { - reinterpret_cast ( shape->data )->Draw( reinterpret_cast( space->data ) ); + reinterpret_cast ( shape->data )->draw( reinterpret_cast( space->data ) ); } static void drawObjectBorder( cpShape * shape, cpSpace * space ) { - reinterpret_cast ( shape->data )->DrawBorder( reinterpret_cast( space->data ) ); + reinterpret_cast ( shape->data )->drawBorder( reinterpret_cast( space->data ) ); } static void drawBB( cpShape *shape, void * unused ) { - reinterpret_cast ( shape->data )->DrawBB(); + reinterpret_cast ( shape->data )->drawBB(); } static void drawConstraint( cpConstraint *constraint ) { - reinterpret_cast ( constraint->data )->Draw(); + reinterpret_cast ( constraint->data )->draw(); } #endif -void Space::Draw() { +void Space::draw() { #ifdef PHYSICS_RENDERER_ENABLED BatchRenderer * BR = GlobalBatchRenderer::instance(); BR->setBlendMode( ALPHA_NORMAL ); - PhysicsManager::DrawSpaceOptions * options = PhysicsManager::instance()->GetDrawOptions(); + PhysicsManager::DrawSpaceOptions * options = PhysicsManager::instance()->getDrawOptions(); cpFloat lw = BR->getLineWidth(); cpFloat ps = BR->getPointSize(); @@ -368,60 +368,60 @@ static cpBool RecieverCollisionBeginFunc( cpArbiter * arb, cpSpace * space, void Space * tspace = reinterpret_cast( space->data ); Arbiter tarb( arb ); - return tspace->OnCollisionBegin( &tarb, data ); + return tspace->onCollisionBegin( &tarb, data ); } static cpBool RecieverCollisionPreSolveFunc( cpArbiter * arb, cpSpace * space, void * data ) { Space * tspace = reinterpret_cast( space->data ); Arbiter tarb( arb ); - return tspace->OnCollisionPreSolve( &tarb, data ); + return tspace->onCollisionPreSolve( &tarb, data ); } static void RecieverCollisionPostSolve( cpArbiter * arb, cpSpace * space, void * data ) { Space * tspace = reinterpret_cast( space->data ); Arbiter tarb( arb ); - tspace->OnCollisionPostSolve( &tarb, data ); + tspace->onCollisionPostSolve( &tarb, data ); } static void RecieverCollisionSeparateFunc( cpArbiter * arb, cpSpace * space, void * data ) { Space * tspace = reinterpret_cast( space->data ); Arbiter tarb( arb ); - tspace->OnCollisionSeparate( &tarb, data ); + tspace->onCollisionSeparate( &tarb, data ); } static void RecieverPostStepCallback( cpSpace * space, void * obj, void * data ) { Space * tspace = reinterpret_cast( space->data ); - tspace->OnPostStepCallback( obj, data ); + tspace->onPostStepCallback( obj, data ); } static void RecieverBBQueryFunc( cpShape * shape, void * data ) { - Space::cBBQuery * query = reinterpret_cast( data ); + Space::BBQuery * query = reinterpret_cast( data ); - query->Space->OnBBQuery( reinterpret_cast( shape->data ), query ); + query->Space->onBBQuery( reinterpret_cast( shape->data ), query ); } static void RecieverSegmentQueryFunc( cpShape *shape, cpFloat t, cpVect n, void * data ) { - Space::cSegmentQuery * query = reinterpret_cast( data ); + Space::SegmentQuery * query = reinterpret_cast( data ); - query->Space->OnSegmentQuery( reinterpret_cast( shape->data ), t, tovect( n ), query ); + query->Space->onSegmentQuery( reinterpret_cast( shape->data ), t, tovect( n ), query ); } static void RecieverPointQueryFunc( cpShape * shape, void * data ) { - Space::cPointQuery * query = reinterpret_cast( data ); + Space::PointQuery * query = reinterpret_cast( data ); - query->Space->OnPointQuery( reinterpret_cast( shape->data ), query ); + query->Space->onPointQuery( reinterpret_cast( shape->data ), query ); } -cpBool Space::OnCollisionBegin( Arbiter * arb, void * data ) { +cpBool Space::onCollisionBegin( Arbiter * arb, void * data ) { cpHashValue hash = (cpHashValue)data; //if ( NULL != data ) { - std::map< cpHashValue, cCollisionHandler >::iterator it = mCollisions.find( hash ); - cCollisionHandler handler = static_cast( it->second ); + std::map< cpHashValue, CollisionHandler >::iterator it = mCollisions.find( hash ); + CollisionHandler handler = static_cast( it->second ); if ( it != mCollisions.end() && handler.begin.IsSet() ) { return handler.begin( arb, this, handler.data ); @@ -435,12 +435,12 @@ cpBool Space::OnCollisionBegin( Arbiter * arb, void * data ) { return 1; } -cpBool Space::OnCollisionPreSolve( Arbiter * arb, void * data ) { +cpBool Space::onCollisionPreSolve( Arbiter * arb, void * data ) { cpHashValue hash = (cpHashValue)data; //if ( NULL != data ) { - std::map< cpHashValue, cCollisionHandler >::iterator it = mCollisions.find( hash ); - cCollisionHandler handler = static_cast( it->second ); + std::map< cpHashValue, CollisionHandler >::iterator it = mCollisions.find( hash ); + CollisionHandler handler = static_cast( it->second ); if ( it != mCollisions.end() && handler.preSolve.IsSet() ) { return handler.preSolve( arb, this, handler.data ); @@ -454,12 +454,12 @@ cpBool Space::OnCollisionPreSolve( Arbiter * arb, void * data ) { return 1; } -void Space::OnCollisionPostSolve( Arbiter * arb, void * data ) { +void Space::onCollisionPostSolve( Arbiter * arb, void * data ) { cpHashValue hash = (cpHashValue)data; //if ( NULL != data ) { - std::map< cpHashValue, cCollisionHandler >::iterator it = mCollisions.find( hash ); - cCollisionHandler handler = static_cast( it->second ); + std::map< cpHashValue, CollisionHandler >::iterator it = mCollisions.find( hash ); + CollisionHandler handler = static_cast( it->second ); if ( it != mCollisions.end() && handler.postSolve.IsSet() ) { handler.postSolve( arb, this, handler.data ); @@ -472,12 +472,12 @@ void Space::OnCollisionPostSolve( Arbiter * arb, void * data ) { } } -void Space::OnCollisionSeparate( Arbiter * arb, void * data ) { +void Space::onCollisionSeparate( Arbiter * arb, void * data ) { cpHashValue hash = (cpHashValue)data; //if ( NULL != data ) { - std::map< cpHashValue, cCollisionHandler >::iterator it = mCollisions.find( hash ); - cCollisionHandler handler = static_cast( it->second ); + std::map< cpHashValue, CollisionHandler >::iterator it = mCollisions.find( hash ); + CollisionHandler handler = static_cast( it->second ); if ( it != mCollisions.end() && handler.separate.IsSet() ) { handler.separate( arb, this, handler.data ); @@ -490,8 +490,8 @@ void Space::OnCollisionSeparate( Arbiter * arb, void * data ) { } } -void Space::OnPostStepCallback( void * obj, void * data ) { - cPostStepCallback * Cb = reinterpret_cast ( data ); +void Space::onPostStepCallback( void * obj, void * data ) { + PostStepCallbackCont * Cb = reinterpret_cast ( data ); if ( Cb->Callback.IsSet() ) { Cb->Callback( this, obj, Cb->Data ); @@ -501,25 +501,25 @@ void Space::OnPostStepCallback( void * obj, void * data ) { cpSAFE_DELETE( Cb ); } -void Space::OnBBQuery( Shape * shape, cBBQuery * query ) { +void Space::onBBQuery( Shape * shape, BBQuery * query ) { if ( query->Func.IsSet() ) { query->Func( shape, query->Data ); } } -void Space::OnSegmentQuery( Shape * shape, cpFloat t, cVect n , cSegmentQuery * query ) { +void Space::onSegmentQuery( Shape * shape, cpFloat t, cVect n , SegmentQuery * query ) { if ( query->Func.IsSet() ) { query->Func( shape, t, n, query->Data ); } } -void Space::OnPointQuery( Shape * shape, cPointQuery * query ) { +void Space::onPointQuery( Shape * shape, PointQuery * query ) { if ( query->Func.IsSet() ) { query->Func( shape, query->Data ); } } -void Space::AddCollisionHandler( const cCollisionHandler& handler ) { +void Space::addCollisionHandler( const CollisionHandler& handler ) { cpHashValue hash = CP_HASH_PAIR( handler.a, handler.b ); cpCollisionBeginFunc f1 = ( handler.begin.IsSet() ) ? &RecieverCollisionBeginFunc : NULL; @@ -533,13 +533,13 @@ void Space::AddCollisionHandler( const cCollisionHandler& handler ) { mCollisions[ hash ] = handler; } -void Space::RemoveCollisionHandler( cpCollisionType a, cpCollisionType b ) { +void Space::removeCollisionHandler( cpCollisionType a, cpCollisionType b ) { cpSpaceRemoveCollisionHandler( mSpace, a, b ); mCollisions.erase( CP_HASH_PAIR( a, b ) ); } -void Space::SetDefaultCollisionHandler( const cCollisionHandler& handler ) { +void Space::setDefaultCollisionHandler( const CollisionHandler& handler ) { cpCollisionBeginFunc f1 = ( handler.begin.IsSet() ) ? &RecieverCollisionBeginFunc : NULL; cpCollisionPreSolveFunc f2 = ( handler.preSolve.IsSet() ) ? &RecieverCollisionPreSolveFunc : NULL; cpCollisionPostSolveFunc f3 = ( handler.postSolve.IsSet() ) ? &RecieverCollisionPostSolve : NULL; @@ -550,8 +550,8 @@ void Space::SetDefaultCollisionHandler( const cCollisionHandler& handler ) { mCollisionsDefault = handler; } -void Space::AddPostStepCallback( PostStepCallback postStep, void * obj, void * data ) { - cPostStepCallback * PostStepCb = cpNew( cPostStepCallback, () ); +void Space::addPostStepCallback(PostStepCallback postStep, void * obj, void * data ) { + PostStepCallbackCont * PostStepCb = cpNew( PostStepCallbackCont, () ); PostStepCb->Callback = postStep, PostStepCb->Data = data; @@ -559,8 +559,8 @@ void Space::AddPostStepCallback( PostStepCallback postStep, void * obj, void * d mPostStepCallbacks.push_back( PostStepCb ); } -void Space::BBQuery( cBB bb, cpLayers layers, cpGroup group, BBQueryFunc func, void * data ) { - cBBQuery tBBQuery; +void Space::bbQuery( cBB bb, cpLayers layers, cpGroup group, BBQueryFunc func, void * data ) { + BBQuery tBBQuery; tBBQuery.Space = this; tBBQuery.Data = data; tBBQuery.Func = func; @@ -568,8 +568,8 @@ void Space::BBQuery( cBB bb, cpLayers layers, cpGroup group, BBQueryFunc func, v cpSpaceBBQuery( mSpace, tocpbb( bb ), layers, group, &RecieverBBQueryFunc, reinterpret_cast( &tBBQuery ) ); } -void Space::SegmentQuery( cVect start, cVect end, cpLayers layers, cpGroup group, SegmentQueryFunc func, void * data ) { - cSegmentQuery tSegmentQuery; +void Space::segmentQuery( cVect start, cVect end, cpLayers layers, cpGroup group, SegmentQueryFunc func, void * data ) { + SegmentQuery tSegmentQuery; tSegmentQuery.Space = this; tSegmentQuery.Data = data; @@ -578,8 +578,8 @@ void Space::SegmentQuery( cVect start, cVect end, cpLayers layers, cpGroup group cpSpaceSegmentQuery( mSpace, tocpv( start ), tocpv( end ), layers, group, &RecieverSegmentQueryFunc, reinterpret_cast( &tSegmentQuery ) ); } -void Space::PointQuery( cVect point, cpLayers layers, cpGroup group, PointQueryFunc func, void * data ) { - cPointQuery tPointQuery; +void Space::pointQuery( cVect point, cpLayers layers, cpGroup group, PointQueryFunc func, void * data ) { + PointQuery tPointQuery; tPointQuery.Space = this; tPointQuery.Data = data; tPointQuery.Func = func; @@ -587,33 +587,33 @@ void Space::PointQuery( cVect point, cpLayers layers, cpGroup group, PointQueryF cpSpacePointQuery( mSpace, tocpv( point ), layers, group, &RecieverPointQueryFunc, reinterpret_cast( &tPointQuery ) ); } -void Space::ReindexShape( Shape * shape ) { - cpSpaceReindexShape( mSpace, shape->GetShape() ); +void Space::reindexShape( Shape * shape ) { + cpSpaceReindexShape( mSpace, shape->getShape() ); } -void Space::ReindexShapesForBody( Body *body ) { - cpSpaceReindexShapesForBody( mSpace, body->GetBody() ); +void Space::reindexShapesForBody( Body *body ) { + cpSpaceReindexShapesForBody( mSpace, body->getBody() ); } -void Space::ReindexStatic() { +void Space::reindexStatic() { cpSpaceReindexStatic( mSpace ); } -void Space::UseSpatialHash( cpFloat dim, int count ) { +void Space::useSpatialHash( cpFloat dim, int count ) { cpSpaceUseSpatialHash( mSpace, dim, count ); } static void SpaceBodyIteratorFunc( cpBody * body, void *data ) { Space::BodyIterator * it = reinterpret_cast ( data ); - it->Space->OnEachBody( reinterpret_cast( body->data ), it ); + it->Space->onEachBody( reinterpret_cast( body->data ), it ); } -void Space::EachBody( BodyIteratorFunc Func, void * data ) { +void Space::eachBody( BodyIteratorFunc Func, void * data ) { BodyIterator it( this, data, Func ); cpSpaceEachBody( mSpace, &SpaceBodyIteratorFunc, (void*)&it ); } -void Space::OnEachBody( Body * Body, BodyIterator * it ) { +void Space::onEachBody( Body * Body, BodyIterator * it ) { if ( it->Func.IsSet() ) { it->Func( it->Space, Body, it->Data ); } @@ -621,26 +621,26 @@ void Space::OnEachBody( Body * Body, BodyIterator * it ) { static void SpaceShapeIteratorFunc ( cpShape * shape, void * data ) { Space::ShapeIterator * it = reinterpret_cast ( data ); - it->Space->OnEachShape( reinterpret_cast( shape->data ), it ); + it->Space->onEachShape( reinterpret_cast( shape->data ), it ); } -void Space::EachShape( ShapeIteratorFunc Func, void * data ) { +void Space::eachShape( ShapeIteratorFunc Func, void * data ) { ShapeIterator it( this, data, Func ); cpSpaceEachShape( mSpace, &SpaceShapeIteratorFunc, (void*)&it ); } -void Space::OnEachShape( Shape * Shape, ShapeIterator * it ) { +void Space::onEachShape( Shape * Shape, ShapeIterator * it ) { if ( it->Func.IsSet() ) { it->Func( it->Space, Shape, it->Data ); } } -void Space::ConvertBodyToDynamic( Body * body, cpFloat mass, cpFloat moment ) { - cpSpaceConvertBodyToDynamic( mSpace, body->GetBody(), mass, moment ); +void Space::convertBodyToDynamic( Body * body, cpFloat mass, cpFloat moment ) { + cpSpaceConvertBodyToDynamic( mSpace, body->getBody(), mass, moment ); } -void Space::ConvertBodyToStatic(Body * body ) { - cpSpaceConvertBodyToStatic( mSpace, body->GetBody() ); +void Space::convertBodyToStatic(Body * body ) { + cpSpaceConvertBodyToStatic( mSpace, body->getBody() ); } CP_NAMESPACE_END diff --git a/src/examples/physics/physics.cpp b/src/examples/physics/physics.cpp index bd6e158c0..d7a5ed1b2 100644 --- a/src/examples/physics/physics.cpp +++ b/src/examples/physics/physics.cpp @@ -34,7 +34,7 @@ EE::Window::Window * mWindow; Input * KM; void DefaultDrawOptions() { - PhysicsManager::DrawSpaceOptions * DSO = PhysicsManager::instance()->GetDrawOptions(); + PhysicsManager::DrawSpaceOptions * DSO = PhysicsManager::instance()->getDrawOptions(); DSO->DrawBBs = false; DSO->DrawShapes = true; DSO->DrawShapesBorders = true; @@ -95,13 +95,13 @@ int get_pixel(int x, int y) { Shape * make_ball( cpFloat x, cpFloat y ) { Body * body = Body::New( 1.0, INFINITY ); - body->Pos( cVectNew( x, y ) ); + body->pos( cVectNew( x, y ) ); ShapePoint * shape = ShapePoint::New( body, 0.95, cVectZero ); - shape->DrawRadius( 4 ); - shape->Elasticity( 0.0 ); - shape->Friction( 0.0 ); + shape->drawRadius( 4 ); + shape->elasticity( 0.0 ); + shape->friction( 0.0 ); return shape; } @@ -116,12 +116,12 @@ void Demo1Create() { mWindow->caption( "eepp - Physics - Logo Smash" ); mSpace = Physics::Space::New(); - mSpace->Iterations( 1 ); + mSpace->iterations( 1 ); // The space will contain a very large number of similary sized objects. // This is the perfect candidate for using the spatial hash. // Generally you will never need to do this. - mSpace->UseSpatialHash( 2.0, 10000 ); + mSpace->useSpatialHash( 2.0, 10000 ); bodyCount = 0; @@ -137,21 +137,21 @@ void Demo1Create() { shape = make_ball( pX + x * 4, pY + y * 4 ); - mSpace->AddBody( shape->Body() ); - mSpace->AddShape( shape ); + mSpace->addBody( shape->body() ); + mSpace->addShape( shape ); bodyCount++; } } - body = mSpace->AddBody( Body::New( INFINITY, INFINITY ) ); - body->Pos( cVectNew( 0, mWindow->getHeight() / 2 + 16 ) ); - body->Vel( cVectNew( 400, 0 ) ); + body = mSpace->addBody( Body::New( INFINITY, INFINITY ) ); + body->pos( cVectNew( 0, mWindow->getHeight() / 2 + 16 ) ); + body->vel( cVectNew( 400, 0 ) ); - shape = mSpace->AddShape( ShapeCircle::New( body, 8.0f, cVectZero ) ); - shape->Elasticity( 0.0 ); - shape->Friction( 0.0 ); - shape->Layers( NOT_GRABABLE_MASK ); + shape = mSpace->addShape( ShapeCircle::New( body, 8.0f, cVectZero ) ); + shape->elasticity( 0.0 ); + shape->friction( 0.0 ); + shape->layers( NOT_GRABABLE_MASK ); bodyCount++; } @@ -170,43 +170,43 @@ void Demo2Create() { mWindow->caption( "eepp - Physics - Pyramid Stack" ); - Shape::ResetShapeIdCounter(); + Shape::resetShapeIdCounter(); mSpace = Physics::Space::New(); - mSpace->Gravity( cVectNew( 0, 100 ) ); - mSpace->SleepTimeThreshold( 0.5f ); + mSpace->gravity( cVectNew( 0, 100 ) ); + mSpace->sleepTimeThreshold( 0.5f ); - Body *body, *statiBody = mSpace->StatiBody(); + Body *body, *statiBody = mSpace->staticBody(); Shape * shape; - shape = mSpace->AddShape( ShapeSegment::New( statiBody, cVectNew( 0, mWindow->getHeight() ), cVectNew( mWindow->getWidth(), mWindow->getHeight() ), 0.0f ) ); + shape = mSpace->addShape( ShapeSegment::New( statiBody, cVectNew( 0, mWindow->getHeight() ), cVectNew( mWindow->getWidth(), mWindow->getHeight() ), 0.0f ) ); shape->e( 1.0f ); shape->u( 1.0f ); - shape->Layers( NOT_GRABABLE_MASK ); + shape->layers( NOT_GRABABLE_MASK ); - shape = mSpace->AddShape( ShapeSegment::New( statiBody, cVectNew( mWindow->getWidth(), 0 ), cVectNew( mWindow->getWidth(), mWindow->getHeight() ), 0.0f ) ); + shape = mSpace->addShape( ShapeSegment::New( statiBody, cVectNew( mWindow->getWidth(), 0 ), cVectNew( mWindow->getWidth(), mWindow->getHeight() ), 0.0f ) ); shape->e( 1.0f ); shape->u( 1.0f ); - shape->Layers( NOT_GRABABLE_MASK ); + shape->layers( NOT_GRABABLE_MASK ); - shape = mSpace->AddShape( ShapeSegment::New( statiBody, cVectNew( 0, 0 ), cVectNew( 0, mWindow->getHeight() ), 0.0f ) ); + shape = mSpace->addShape( ShapeSegment::New( statiBody, cVectNew( 0, 0 ), cVectNew( 0, mWindow->getHeight() ), 0.0f ) ); shape->e( 1.0f ); shape->u( 1.0f ); - shape->Layers( NOT_GRABABLE_MASK ); + shape->layers( NOT_GRABABLE_MASK ); - shape = mSpace->AddShape( ShapeSegment::New( statiBody, cVectNew( 0, 0 ), cVectNew( mWindow->getWidth(), 0 ), 0.0f ) ); + shape = mSpace->addShape( ShapeSegment::New( statiBody, cVectNew( 0, 0 ), cVectNew( mWindow->getWidth(), 0 ), 0.0f ) ); shape->e( 1.0f ); shape->u( 1.0f ); - shape->Layers( NOT_GRABABLE_MASK ); + shape->layers( NOT_GRABABLE_MASK ); Float hw = mWindow->getWidth() / 2; for(int i=0; i<14; i++){ for(int j=0; j<=i; j++){ - body = mSpace->AddBody( Body::New( 1.0f, Moment::ForBox( 1.0f, 30.0f, 30.0f ) ) ); - body->Pos( cVectNew( hw + j * 32 - i * 16, 100 + i * 32 ) ); + body = mSpace->addBody( Body::New( 1.0f, Moment::forBox( 1.0f, 30.0f, 30.0f ) ) ); + body->pos( cVectNew( hw + j * 32 - i * 16, 100 + i * 32 ) ); - shape = mSpace->AddShape( ShapePoly::New( body, 30.f, 30.f ) ); + shape = mSpace->addShape( ShapePoly::New( body, 30.f, 30.f ) ); shape->e( 0.0f ); shape->u( 0.8f ); } @@ -214,10 +214,10 @@ void Demo2Create() { cpFloat radius = 15.0f; - body = mSpace->AddBody( Body::New( 10.0f, Moment::ForCircle( 10.0f, 0.0f, radius, cVectZero ) ) ); - body->Pos( cVectNew( hw, mWindow->getHeight() - radius - 5 ) ); + body = mSpace->addBody( Body::New( 10.0f, Moment::forCircle( 10.0f, 0.0f, radius, cVectZero ) ) ); + body->pos( cVectNew( hw, mWindow->getHeight() - radius - 5 ) ); - shape = mSpace->AddShape( ShapeCircle::New( body, radius, cVectZero ) ); + shape = mSpace->addShape( ShapeCircle::New( body, radius, cVectZero ) ); shape->e( 0.0f ); shape->u( 0.9f ); } @@ -244,9 +244,9 @@ Emitter emitterInstance; cpBool blockerBegin( Arbiter *arb, Space *space, void *unused ) { Shape * a, * b; - arb->GetShapes( &a, &b ); + arb->getShapes( &a, &b ); - Emitter *emitter = (Emitter *) a->Data(); + Emitter *emitter = (Emitter *) a->data(); emitter->blocked++; @@ -255,9 +255,9 @@ cpBool blockerBegin( Arbiter *arb, Space *space, void *unused ) { void blockerSeparate( Arbiter *arb, Space * space, void *unused ) { Shape * a, * b; - arb->GetShapes( &a, &b ); + arb->getShapes( &a, &b ); - Emitter *emitter = (Emitter *) a->Data(); + Emitter *emitter = (Emitter *) a->data(); emitter->blocked--; } @@ -265,26 +265,26 @@ void blockerSeparate( Arbiter *arb, Space * space, void *unused ) { void postStepRemove( Space *space, void * tshape, void * unused ) { Shape * shape = reinterpret_cast( tshape ); - if ( NULL != mMouseJoint && ( mMouseJoint->A() == shape->Body() || mMouseJoint->B() == shape->Body() ) ) { - space->RemoveConstraint( mMouseJoint ); + if ( NULL != mMouseJoint && ( mMouseJoint->a() == shape->body() || mMouseJoint->b() == shape->body() ) ) { + space->removeConstraint( mMouseJoint ); eeSAFE_DELETE( mMouseJoint ); } - space->RemoveBody( shape->Body() ); - space->RemoveShape( shape ); + space->removeBody( shape->body() ); + space->removeShape( shape ); Shape::Free( shape, true ); } cpBool catcherBarBegin(Arbiter *arb, Space *space, void *unused) { Shape * a, * b; - arb->GetShapes( &a, &b ); + arb->getShapes( &a, &b ); - Emitter *emitter = (Emitter *) a->Data(); + Emitter *emitter = (Emitter *) a->data(); emitter->queue++; - space->AddPostStepCallback( cb::Make3( &postStepRemove ), b, NULL ); + space->addPostStepCallback( cb::Make3( &postStepRemove ), b, NULL ); return cpFalse; } @@ -296,55 +296,55 @@ void Demo3Create() { mWindow->caption( "eepp - Physics - Sensor" ); - Shape::ResetShapeIdCounter(); + Shape::resetShapeIdCounter(); mSpace = Physics::Space::New(); - mSpace->Iterations( 10 ); - mSpace->Gravity( cVectNew( 0, 100 ) ); + mSpace->iterations( 10 ); + mSpace->gravity( cVectNew( 0, 100 ) ); - Body * statiBody = mSpace->StatiBody(); + Body * statiBody = mSpace->staticBody(); Shape * shape; emitterInstance.queue = 5; emitterInstance.blocked = 0; emitterInstance.position = cVectNew( mWindow->getWidth() / 2 , 150); - shape = mSpace->AddShape( ShapeCircle::New( statiBody, 15.0f, emitterInstance.position ) ); + shape = mSpace->addShape( ShapeCircle::New( statiBody, 15.0f, emitterInstance.position ) ); shape->Sensor( 1 ); - shape->CollisionType( BLOCKING_SENSOR_TYPE ); - shape->Data( &emitterInstance ); + shape->collisionType( BLOCKING_SENSOR_TYPE ); + shape->data( &emitterInstance ); // Create our catch sensor to requeue the balls when they reach the bottom of the screen - shape = mSpace->AddShape( ShapeSegment::New( statiBody, cVectNew(-4000, 600), cVectNew(4000, 600), 15.0f ) ); + shape = mSpace->addShape( ShapeSegment::New( statiBody, cVectNew(-4000, 600), cVectNew(4000, 600), 15.0f ) ); shape->Sensor( 1 ); - shape->CollisionType( CATCH_SENSOR_TYPE ); - shape->Data( &emitterInstance ); + shape->collisionType( CATCH_SENSOR_TYPE ); + shape->data( &emitterInstance ); - Space::cCollisionHandler handler; + Space::CollisionHandler handler; handler.a = BLOCKING_SENSOR_TYPE; handler.b = BALL_TYPE; handler.begin = cb::Make3( &blockerBegin ); handler.separate = cb::Make3( &blockerSeparate ); - mSpace->AddCollisionHandler( handler ); + mSpace->addCollisionHandler( handler ); handler.Reset(); // Reset all the values and the callbacks ( set the callbacks as !IsSet() handler.a = CATCH_SENSOR_TYPE; handler.b = BALL_TYPE; handler.begin = cb::Make3( &catcherBarBegin ); - mSpace->AddCollisionHandler( handler ); + mSpace->addCollisionHandler( handler ); } void Demo3Update() { if( !emitterInstance.blocked && emitterInstance.queue ){ emitterInstance.queue--; - Body * body = mSpace->AddBody( Body::New( 1.0f, Moment::ForCircle(1.0f, 15.0f, 0.0f, cVectZero ) ) ); - body->Pos( emitterInstance.position ); - body->Vel( cVectNew( Math::randf(-1,1), Math::randf(-1,1) ) * (cpFloat)100 ); + Body * body = mSpace->addBody( Body::New( 1.0f, Moment::forCircle(1.0f, 15.0f, 0.0f, cVectZero ) ) ); + body->pos( emitterInstance.position ); + body->vel( cVectNew( Math::randf(-1,1), Math::randf(-1,1) ) * (cpFloat)100 ); - Shape *shape = mSpace->AddShape( ShapeCircle::New( body, 15.0f, cVectZero ) ); - shape->CollisionType( BALL_TYPE ); + Shape *shape = mSpace->addShape( ShapeCircle::New( body, 15.0f, cVectZero ) ); + shape->collisionType( BALL_TYPE ); } } @@ -361,7 +361,7 @@ enum { void PostStepAddJoint(Space *space, void *key, void *data) { Constraint *joint = (Constraint *)key; - space->AddConstraint( joint ); + space->addConstraint( joint ); } cpBool StickyPreSolve( Arbiter *arb, Space *space, void *data ) @@ -374,7 +374,7 @@ cpBool StickyPreSolve( Arbiter *arb, Space *space, void *data ) cpFloat deepest = INFINITY; // Grab the contact set and iterate over them. - cpContactPointSet contacts = arb->ContactPointSet(); + cpContactPointSet contacts = arb->contactPointSet(); for(int i=0; iContactPointSet( &contacts ); + arb->contactPointSet( &contacts ); // If the shapes are overlapping enough, then create a // joint that sticks them together at the first contact point. - if(!arb->UserData() && deepest <= 0.0f){ + if(!arb->userData() && deepest <= 0.0f){ Body *bodyA, *bodyB; - arb->GetBodies( &bodyA, &bodyB ); + arb->getBodies( &bodyA, &bodyB ); // Create a joint at the contact point to hold the body in place. PivotJoint * joint = cpNew( PivotJoint, ( bodyA, bodyB, tovect( contacts.points[0].point ) ) ); // Dont draw the constraint - joint->DrawPointSize( 0 ); + joint->drawPointSize( 0 ); // Give it a finite force for the stickyness. - joint->MaxForce( 3e3 ); + joint->maxForce( 3e3 ); // Schedule a post-step() callback to add the joint. - space->AddPostStepCallback( cb::Make3( &PostStepAddJoint ), joint, NULL ); + space->addPostStepCallback( cb::Make3( &PostStepAddJoint ), joint, NULL ); // Store the joint on the arbiter so we can remove it later. - arb->UserData(joint); + arb->userData(joint); } // Position correction and velocity are handled separately so changing @@ -426,31 +426,31 @@ cpBool StickyPreSolve( Arbiter *arb, Space *space, void *data ) void PostStepRemoveJoint(Space *space, void *key, void *data) { Constraint *joint = (Constraint *)key; - space->RemoveConstraint( joint ); + space->removeConstraint( joint ); Constraint::Free( joint ); } void StickySeparate(Arbiter *arb, Space *space, void *data) { - Constraint *joint = (Constraint *)arb->UserData(); + Constraint *joint = (Constraint *)arb->userData(); if(joint){ // The joint won't be removed until the step is done. // Need to disable it so that it won't apply itself. // Setting the force to 0 will do just that - joint->MaxForce( 0.0f ); + joint->maxForce( 0.0f ); // Perform the removal in a post-step() callback. - space->AddPostStepCallback( cb::Make3( &PostStepRemoveJoint ), joint, NULL ); + space->addPostStepCallback( cb::Make3( &PostStepRemoveJoint ), joint, NULL ); // NULL out the reference to the joint. // Not required, but it's a good practice. - arb->UserData( NULL ); + arb->userData( NULL ); } } void Demo4Create() { - PhysicsManager::DrawSpaceOptions * DSO = PhysicsManager::instance()->GetDrawOptions(); + PhysicsManager::DrawSpaceOptions * DSO = PhysicsManager::instance()->getDrawOptions(); DSO->DrawBBs = false; DSO->DrawShapes = true; DSO->DrawShapesBorders = false; @@ -463,61 +463,61 @@ void Demo4Create() { mWindow->caption( "eepp - Physics - Sticky collisions using the Arbiter data pointer." ); mSpace = Space::New(); - mSpace->Iterations( 10 ); - mSpace->Gravity( cVectNew( 0, 1000 ) ); - mSpace->CollisionSlop( 2.0 ); + mSpace->iterations( 10 ); + mSpace->gravity( cVectNew( 0, 1000 ) ); + mSpace->collisionSlop( 2.0 ); - Body * statiBody = mSpace->StatiBody(); + Body * statiBody = mSpace->staticBody(); Shape * shape; cpFloat x = 500; cpFloat y = 400; - shape = mSpace->AddShape( ShapeSegment::New( statiBody, cVectNew( x + -340, y -260 ), cVectNew( x -340, y + 260 ), 20.0f ) ); - shape->Elasticity( 1.0f ); - shape->Friction( 1.0f ); - shape->CollisionType( COLLIDE_STICK_SENSOR ); - shape->Layers( NOT_GRABABLE_MASK ); + shape = mSpace->addShape( ShapeSegment::New( statiBody, cVectNew( x + -340, y -260 ), cVectNew( x -340, y + 260 ), 20.0f ) ); + shape->elasticity( 1.0f ); + shape->friction( 1.0f ); + shape->collisionType( COLLIDE_STICK_SENSOR ); + shape->layers( NOT_GRABABLE_MASK ); - shape = mSpace->AddShape( ShapeSegment::New( statiBody, cVectNew( x + 340, y -260 ), cVectNew( x + 340, y + 260 ), 20.0f ) ); - shape->Elasticity( 1.0f ); - shape->Friction( 1.0f ); - shape->CollisionType( COLLIDE_STICK_SENSOR ); - shape->Layers( NOT_GRABABLE_MASK ); + shape = mSpace->addShape( ShapeSegment::New( statiBody, cVectNew( x + 340, y -260 ), cVectNew( x + 340, y + 260 ), 20.0f ) ); + shape->elasticity( 1.0f ); + shape->friction( 1.0f ); + shape->collisionType( COLLIDE_STICK_SENSOR ); + shape->layers( NOT_GRABABLE_MASK ); - shape = mSpace->AddShape( ShapeSegment::New( statiBody, cVectNew( x -340, y -260 ), cVectNew( x + 340, y -260 ), 20.0f ) ); - shape->Elasticity( 1.0f ); - shape->Friction( 1.0f ); - shape->CollisionType( COLLIDE_STICK_SENSOR ); - shape->Layers( NOT_GRABABLE_MASK ); + shape = mSpace->addShape( ShapeSegment::New( statiBody, cVectNew( x -340, y -260 ), cVectNew( x + 340, y -260 ), 20.0f ) ); + shape->elasticity( 1.0f ); + shape->friction( 1.0f ); + shape->collisionType( COLLIDE_STICK_SENSOR ); + shape->layers( NOT_GRABABLE_MASK ); - shape = mSpace->AddShape( ShapeSegment::New( statiBody, cVectNew( x -340, y + 260 ), cVectNew( x + 340, y + 260 ), 20.0f ) ); - shape->Elasticity( 1.0f ); - shape->Friction( 1.0f ); - shape->CollisionType( COLLIDE_STICK_SENSOR ); - shape->Layers( NOT_GRABABLE_MASK ); + shape = mSpace->addShape( ShapeSegment::New( statiBody, cVectNew( x -340, y + 260 ), cVectNew( x + 340, y + 260 ), 20.0f ) ); + shape->elasticity( 1.0f ); + shape->friction( 1.0f ); + shape->collisionType( COLLIDE_STICK_SENSOR ); + shape->layers( NOT_GRABABLE_MASK ); for(int i=0; i<200; i++){ cpFloat mass = 0.15f; cpFloat radius = 10.0f; - Body * body = mSpace->AddBody( Body::New( mass, Moment::ForCircle( mass, 0.0f, radius, cVectZero ) ) ); - body->Pos( cVectNew( x + easing::linearInterpolation( Math::randf(), -150.0f, 150.0f, 1 ), + Body * body = mSpace->addBody( Body::New( mass, Moment::forCircle( mass, 0.0f, radius, cVectZero ) ) ); + body->pos( cVectNew( x + easing::linearInterpolation( Math::randf(), -150.0f, 150.0f, 1 ), y + easing::linearInterpolation( Math::randf(), -150.0f, 150.0f, 1 ) ) ); - Shape * shape = mSpace->AddShape( ShapeCircle::New( body, radius + STICK_SENSOR_THICKNESS, cVectZero ) ); - shape->Friction( 0.9f ); - shape->CollisionType( COLLIDE_STICK_SENSOR ); + Shape * shape = mSpace->addShape( ShapeCircle::New( body, radius + STICK_SENSOR_THICKNESS, cVectZero ) ); + shape->friction( 0.9f ); + shape->collisionType( COLLIDE_STICK_SENSOR ); } - Space::cCollisionHandler c; + Space::CollisionHandler c; c.a = COLLIDE_STICK_SENSOR; c.b = COLLIDE_STICK_SENSOR; c.preSolve = cb::Make3( &StickyPreSolve ); c.separate = cb::Make3( &StickySeparate ); - mSpace->AddCollisionHandler( c ); + mSpace->addCollisionHandler( c ); } void Demo4Update() { @@ -574,31 +574,31 @@ void PhysicsUpdate() { // Creates a joint to drag any grabable object on the scene mMousePoint = cVectNew( KM->getMousePosf().x, KM->getMousePosf().y ); cVect newPoint = tovect( cpvlerp( tocpv( mMousePoint_last ), tocpv( mMousePoint ), 0.25 ) ); - mMouseBody->Pos( newPoint ); - mMouseBody->Vel( ( newPoint - mMousePoint_last ) * (cpFloat)mWindow->FPS() ); + mMouseBody->pos( newPoint ); + mMouseBody->vel( ( newPoint - mMousePoint_last ) * (cpFloat)mWindow->FPS() ); mMousePoint_last = newPoint; if ( KM->mouseLeftPressed() ) { if ( NULL == mMouseJoint ) { cVect point = cVectNew( KM->getMousePosf().x, KM->getMousePosf().y ); - Shape * shape = mSpace->PointQueryFirst( point, GRABABLE_MASK_BIT, CP_NO_GROUP ); + Shape * shape = mSpace->pointQueryFirst( point, GRABABLE_MASK_BIT, CP_NO_GROUP ); if( NULL != shape ){ - mMouseJoint = eeNew( PivotJoint, ( mMouseBody, shape->Body(), cVectZero, shape->Body()->World2Local( point ) ) ); + mMouseJoint = eeNew( PivotJoint, ( mMouseBody, shape->body(), cVectZero, shape->body()->world2Local( point ) ) ); - mMouseJoint->MaxForce( 50000.0f ); - mSpace->AddConstraint( mMouseJoint ); + mMouseJoint->maxForce( 50000.0f ); + mSpace->addConstraint( mMouseJoint ); } } } else if ( NULL != mMouseJoint ) { - mSpace->RemoveConstraint( mMouseJoint ); + mSpace->removeConstraint( mMouseJoint ); eeSAFE_DELETE( mMouseJoint ); } mDemo[ mCurDemo ].update(); - mSpace->Update(); - mSpace->Draw(); + mSpace->update(); + mSpace->draw(); } void PhysicsDestroy() { diff --git a/src/test/eetest.cpp b/src/test/eetest.cpp index 7c754d64e..fe130a94c 100644 --- a/src/test/eetest.cpp +++ b/src/test/eetest.cpp @@ -1577,44 +1577,44 @@ void EETest::CreateJointAndBody() { void EETest::Demo1Create() { CreateJointAndBody(); - Shape::ResetShapeIdCounter(); + Shape::resetShapeIdCounter(); mSpace = Physics::Space::New(); - mSpace->Gravity( cVectNew( 0, 100 ) ); - mSpace->SleepTimeThreshold( 0.5f ); + mSpace->gravity( cVectNew( 0, 100 ) ); + mSpace->sleepTimeThreshold( 0.5f ); - Body *body, *statiBody = mSpace->StatiBody(); + Body *body, *statiBody = mSpace->staticBody(); Shape * shape; - shape = mSpace->AddShape( ShapeSegment::New( statiBody, cVectNew( 0, mWindow->getHeight() ), cVectNew( mWindow->getWidth(), mWindow->getHeight() ), 0.0f ) ); + shape = mSpace->addShape( ShapeSegment::New( statiBody, cVectNew( 0, mWindow->getHeight() ), cVectNew( mWindow->getWidth(), mWindow->getHeight() ), 0.0f ) ); shape->e( 1.0f ); shape->u( 1.0f ); - shape->Layers( NOT_GRABABLE_MASK ); + shape->layers( NOT_GRABABLE_MASK ); - shape = mSpace->AddShape( ShapeSegment::New( statiBody, cVectNew( mWindow->getWidth(), 0 ), cVectNew( mWindow->getWidth(), mWindow->getHeight() ), 0.0f ) ); + shape = mSpace->addShape( ShapeSegment::New( statiBody, cVectNew( mWindow->getWidth(), 0 ), cVectNew( mWindow->getWidth(), mWindow->getHeight() ), 0.0f ) ); shape->e( 1.0f ); shape->u( 1.0f ); - shape->Layers( NOT_GRABABLE_MASK ); + shape->layers( NOT_GRABABLE_MASK ); - shape = mSpace->AddShape( ShapeSegment::New( statiBody, cVectNew( 0, 0 ), cVectNew( 0, mWindow->getHeight() ), 0.0f ) ); + shape = mSpace->addShape( ShapeSegment::New( statiBody, cVectNew( 0, 0 ), cVectNew( 0, mWindow->getHeight() ), 0.0f ) ); shape->e( 1.0f ); shape->u( 1.0f ); - shape->Layers( NOT_GRABABLE_MASK ); + shape->layers( NOT_GRABABLE_MASK ); - shape = mSpace->AddShape( ShapeSegment::New( statiBody, cVectNew( 0, 0 ), cVectNew( mWindow->getWidth(), 0 ), 0.0f ) ); + shape = mSpace->addShape( ShapeSegment::New( statiBody, cVectNew( 0, 0 ), cVectNew( mWindow->getWidth(), 0 ), 0.0f ) ); shape->e( 1.0f ); shape->u( 1.0f ); - shape->Layers( NOT_GRABABLE_MASK ); + shape->layers( NOT_GRABABLE_MASK ); Float hw = mWindow->getWidth() / 2; for(int i=0; i<14; i++){ for(int j=0; j<=i; j++){ - body = mSpace->AddBody( Body::New( 1.0f, Moment::ForBox( 1.0f, 30.0f, 30.0f ) ) ); - body->Pos( cVectNew( hw + j * 32 - i * 16, 100 + i * 32 ) ); + body = mSpace->addBody( Body::New( 1.0f, Moment::forBox( 1.0f, 30.0f, 30.0f ) ) ); + body->pos( cVectNew( hw + j * 32 - i * 16, 100 + i * 32 ) ); //shape = mSpace->AddShape( ShapePolySprite::New( body, 30.f, 30.f, mBoxSprite ) ); - shape = mSpace->AddShape( ShapePoly::New( body, 30.f, 30.f ) ); + shape = mSpace->addShape( ShapePoly::New( body, 30.f, 30.f ) ); shape->e( 0.0f ); shape->u( 0.8f ); } @@ -1622,11 +1622,11 @@ void EETest::Demo1Create() { cpFloat radius = 15.0f; - body = mSpace->AddBody( Body::New( 10.0f, Moment::ForCircle( 10.0f, 0.0f, radius, cVectZero ) ) ); - body->Pos( cVectNew( hw, mWindow->getHeight() - radius - 5 ) ); + body = mSpace->addBody( Body::New( 10.0f, Moment::forCircle( 10.0f, 0.0f, radius, cVectZero ) ) ); + body->pos( cVectNew( hw, mWindow->getHeight() - radius - 5 ) ); //shape = mSpace->AddShape( ShapeCircleSprite::New( body, radius, cVectZero, mCircleSprite ) ); - shape = mSpace->AddShape( ShapeCircle::New( body, radius, cVectZero ) ); + shape = mSpace->addShape( ShapeCircle::New( body, radius, cVectZero ) ); shape->e( 0.0f ); shape->u( 0.9f ); } @@ -1653,9 +1653,9 @@ void EETest::Demo1Destroy() { cpBool EETest::blockerBegin( Arbiter *arb, Space *space, void *unused ) { Shape * a, * b; - arb->GetShapes( &a, &b ); + arb->getShapes( &a, &b ); - Emitter *emitter = (Emitter *) a->Data(); + Emitter *emitter = (Emitter *) a->data(); emitter->blocked++; @@ -1664,9 +1664,9 @@ cpBool EETest::blockerBegin( Arbiter *arb, Space *space, void *unused ) { void EETest::blockerSeparate( Arbiter *arb, Space * space, void *unused ) { Shape * a, * b; - arb->GetShapes( &a, &b ); + arb->getShapes( &a, &b ); - Emitter *emitter = (Emitter *) a->Data(); + Emitter *emitter = (Emitter *) a->data(); emitter->blocked--; } @@ -1675,8 +1675,8 @@ void EETest::postStepRemove( Space *space, void * tshape, void * unused ) { Shape * shape = reinterpret_cast( tshape ); #ifndef EE_PLATFORM_TOUCH - if ( NULL != mMouseJoint && ( mMouseJoint->A() == shape->Body() || mMouseJoint->B() == shape->Body() ) ) { - mSpace->RemoveConstraint( mMouseJoint ); + if ( NULL != mMouseJoint && ( mMouseJoint->a() == shape->body() || mMouseJoint->b() == shape->body() ) ) { + mSpace->removeConstraint( mMouseJoint ); eeSAFE_DELETE( mMouseJoint ); } #else @@ -1688,20 +1688,20 @@ void EETest::postStepRemove( Space *space, void * tshape, void * unused ) { } #endif - mSpace->RemoveBody( shape->Body() ); - mSpace->RemoveShape( shape ); + mSpace->removeBody( shape->body() ); + mSpace->removeShape( shape ); Shape::Free( shape, true ); } cpBool EETest::catcherBarBegin(Arbiter *arb, Physics::Space *space, void *unused) { Shape * a, * b; - arb->GetShapes( &a, &b ); + arb->getShapes( &a, &b ); - Emitter *emitter = (Emitter *) a->Data(); + Emitter *emitter = (Emitter *) a->data(); emitter->queue++; - mSpace->AddPostStepCallback( cb::Make3( this, &EETest::postStepRemove ), b, NULL ); + mSpace->addPostStepCallback( cb::Make3( this, &EETest::postStepRemove ), b, NULL ); return cpFalse; } @@ -1709,55 +1709,55 @@ cpBool EETest::catcherBarBegin(Arbiter *arb, Physics::Space *space, void *unused void EETest::Demo2Create() { CreateJointAndBody(); - Shape::ResetShapeIdCounter(); + Shape::resetShapeIdCounter(); mSpace = Physics::Space::New(); - mSpace->Iterations( 10 ); - mSpace->Gravity( cVectNew( 0, 100 ) ); + mSpace->iterations( 10 ); + mSpace->gravity( cVectNew( 0, 100 ) ); - Body * statiBody = mSpace->StatiBody(); + Body * statiBody = mSpace->staticBody(); Shape * shape; emitterInstance.queue = 5; emitterInstance.blocked = 0; emitterInstance.position = cVectNew( mWindow->getWidth() / 2 , 150); - shape = mSpace->AddShape( ShapeCircle::New( statiBody, 15.0f, emitterInstance.position ) ); + shape = mSpace->addShape( ShapeCircle::New( statiBody, 15.0f, emitterInstance.position ) ); shape->Sensor( 1 ); - shape->CollisionType( BLOCKING_SENSOR_TYPE ); - shape->Data( &emitterInstance ); + shape->collisionType( BLOCKING_SENSOR_TYPE ); + shape->data( &emitterInstance ); // Create our catch sensor to requeue the balls when they reach the bottom of the screen - shape = mSpace->AddShape( ShapeSegment::New( statiBody, cVectNew(-4000, 600), cVectNew(4000, 600), 15.0f ) ); + shape = mSpace->addShape( ShapeSegment::New( statiBody, cVectNew(-4000, 600), cVectNew(4000, 600), 15.0f ) ); shape->Sensor( 1 ); - shape->CollisionType( CATCH_SENSOR_TYPE ); - shape->Data( &emitterInstance ); + shape->collisionType( CATCH_SENSOR_TYPE ); + shape->data( &emitterInstance ); - Space::cCollisionHandler handler; + Space::CollisionHandler handler; handler.a = BLOCKING_SENSOR_TYPE; handler.b = BALL_TYPE; handler.begin = cb::Make3( this, &EETest::blockerBegin ); handler.separate = cb::Make3( this, &EETest::blockerSeparate ); - mSpace->AddCollisionHandler( handler ); + mSpace->addCollisionHandler( handler ); handler.Reset(); // Reset all the values and the callbacks ( set the callbacks as !IsSet() handler.a = CATCH_SENSOR_TYPE; handler.b = BALL_TYPE; handler.begin = cb::Make3( this, &EETest::catcherBarBegin ); - mSpace->AddCollisionHandler( handler ); + mSpace->addCollisionHandler( handler ); } void EETest::Demo2Update() { if( !emitterInstance.blocked && emitterInstance.queue ){ emitterInstance.queue--; - Body * body = mSpace->AddBody( Body::New( 1.0f, Moment::ForCircle(1.0f, 15.0f, 0.0f, cVectZero ) ) ); - body->Pos( emitterInstance.position ); - body->Vel( cVectNew( Math::randf(-1,1), Math::randf(-1,1) ) * (cpFloat)100 ); + Body * body = mSpace->addBody( Body::New( 1.0f, Moment::forCircle(1.0f, 15.0f, 0.0f, cVectZero ) ) ); + body->pos( emitterInstance.position ); + body->vel( cVectNew( Math::randf(-1,1), Math::randf(-1,1) ) * (cpFloat)100 ); - Shape *shape = mSpace->AddShape( ShapeCircle::New( body, 15.0f, cVectZero ) ); - shape->CollisionType( BALL_TYPE ); + Shape *shape = mSpace->addShape( ShapeCircle::New( body, 15.0f, cVectZero ) ); + shape->collisionType( BALL_TYPE ); } } @@ -1780,7 +1780,7 @@ void EETest::ChangeDemo( Uint32 num ) { void EETest::PhysicsCreate() { PhysicsManager::createSingleton(); PhysicsManager * PM = PhysicsManager::instance(); - PhysicsManager::DrawSpaceOptions * DSO = PM->GetDrawOptions(); + PhysicsManager::DrawSpaceOptions * DSO = PM->getDrawOptions(); DSO->DrawBBs = false; DSO->DrawShapes = true; @@ -1809,25 +1809,25 @@ void EETest::PhysicsUpdate() { #ifndef EE_PLATFORM_TOUCH mMousePoint = cVectNew( KM->getMousePosf().x, KM->getMousePosf().y ); cVect newPoint = tovect( cpvlerp( tocpv( mMousePoint_last ), tocpv( mMousePoint ), 0.25 ) ); - mMouseBody->Pos( newPoint ); - mMouseBody->Vel( ( newPoint - mMousePoint_last ) * (cpFloat)mWindow->FPS() ); + mMouseBody->pos( newPoint ); + mMouseBody->vel( ( newPoint - mMousePoint_last ) * (cpFloat)mWindow->FPS() ); mMousePoint_last = newPoint; if ( KM->mouseLeftPressed() ) { if ( NULL == mMouseJoint ) { cVect point = cVectNew( KM->getMousePosf().x, KM->getMousePosf().y ); - Shape * shape = mSpace->PointQueryFirst( point, GRABABLE_MASK_BIT, CP_NO_GROUP ); + Shape * shape = mSpace->pointQueryFirst( point, GRABABLE_MASK_BIT, CP_NO_GROUP ); if( NULL != shape ){ - mMouseJoint = eeNew( PivotJoint, ( mMouseBody, shape->Body(), cVectZero, shape->Body()->World2Local( point ) ) ); + mMouseJoint = eeNew( PivotJoint, ( mMouseBody, shape->body(), cVectZero, shape->body()->world2Local( point ) ) ); - mMouseJoint->MaxForce( 50000.0f ); - mSpace->AddConstraint( mMouseJoint ); + mMouseJoint->maxForce( 50000.0f ); + mSpace->addConstraint( mMouseJoint ); } } } else if ( NULL != mMouseJoint ) { - mSpace->RemoveConstraint( mMouseJoint ); + mSpace->removeConstraint( mMouseJoint ); eeSAFE_DELETE( mMouseJoint ); } #else @@ -1860,8 +1860,8 @@ void EETest::PhysicsUpdate() { #endif mDemo[ mCurDemo ].update(); - mSpace->Update(); - mSpace->Draw(); + mSpace->update(); + mSpace->draw(); } void EETest::PhysicsDestroy() {