diff --git a/include/eepp/physics/arbiter.hpp b/include/eepp/physics/arbiter.hpp index 68f44684d..ba574b79b 100644 --- a/include/eepp/physics/arbiter.hpp +++ b/include/eepp/physics/arbiter.hpp @@ -31,27 +31,27 @@ class CP_API Arbiter { cpFloat getDepth( int i ); - cpContactPointSet contactPointSet(); + cpContactPointSet getContactPointSet(); - void contactPointSet( cpContactPointSet * contact ); + void setContactPointSet( cpContactPointSet * contact ); cpArbiter * getArbiter() const; - cpFloat elasticity(); + cpFloat getElasticity(); - void elasticity( cpFloat value ); + void setElasticity( cpFloat value ); - cpFloat friction(); + cpFloat getFriction(); - void friction( cpFloat value ); + void setFriction( cpFloat value ); - cVect surfaceVelocity(); + cVect getSurfaceVelocity(); - void surfaceVelocity( cVect value ); + void setSurfaceVelocity( cVect value ); - void userData( cpDataPointer value ); + void setUserData( cpDataPointer value ); - cpDataPointer userData() const; + cpDataPointer getUserData() const; protected: cpArbiter * mArbiter; }; diff --git a/include/eepp/physics/body.hpp b/include/eepp/physics/body.hpp index 2707aaa73..ef7c5767d 100644 --- a/include/eepp/physics/body.hpp +++ b/include/eepp/physics/body.hpp @@ -88,51 +88,51 @@ class CP_API Body { cpBody * getBody() const; - cpFloat mass() const; + cpFloat getMass() const; - void mass( const cpFloat& mass ); + void setMass( const cpFloat& mass ); - cpFloat moment() const; + cpFloat getMoment() const; - void moment( const cpFloat& i ); + void setMoment( const cpFloat& i ); - cVect pos() const; + cVect getPos() const; - void pos( const cVect& pos ); + void setPos( const cVect& pos ); - cVect vel() const; + cVect getVel() const; - void vel( const cVect& vel ); + void setVel( const cVect& vel ); - cVect force() const; + cVect getForce() const; - void force( const cVect& force ); + void setForce( const cVect& force ); - cpFloat angle() const; + cpFloat getAngle() const; - void angle( const cpFloat& rads ); + void setAngle( const cpFloat& rads ); - cpFloat angleDeg(); + cpFloat getAngleDeg(); - void angleDeg( const cpFloat& angle ); + void setAngleDeg( const cpFloat& angle ); - cpFloat angVel() const; + cpFloat getAngVel() const; - void angVel( const cpFloat& angVel ); + void setAngVel( const cpFloat& angVel ); - cpFloat torque() const; + cpFloat getTorque() const; - void torque( const cpFloat& torque ); + void setTorque( const cpFloat& torque ); - cVect rot() const; + cVect getRot() const; - cpFloat velLimit() const; + cpFloat getVelLimit() const; - void velLimit( const cpFloat& speed ); + void setVelLimit( const cpFloat& speed ); - cpFloat angVelLimit() const; + cpFloat getAngVelLimit() const; - void angVelLimit( const cpFloat& speed ); + void setAngVelLimit( const cpFloat& speed ); void updateVelocity( cVect gravity, cpFloat damping, cpFloat dt ); @@ -150,9 +150,9 @@ class CP_API Body { cpFloat kineticEnergy(); - void * data() const; + void * getData() const; - void data( void * data ); + void setData( void * data ); void eachShape( ShapeIteratorFunc Func, void * data ); diff --git a/include/eepp/physics/constraints/constraint.hpp b/include/eepp/physics/constraints/constraint.hpp index d7abf1972..99f6a360a 100644 --- a/include/eepp/physics/constraints/constraint.hpp +++ b/include/eepp/physics/constraints/constraint.hpp @@ -16,29 +16,29 @@ class CP_API Constraint { cpConstraint * getConstraint() const; - Body * a(); + Body * getA(); - Body * b(); + Body * getB(); - cpFloat maxForce(); + cpFloat getMaxForce(); - void maxForce( const cpFloat& maxforce ); + void setMaxForce( const cpFloat& maxforce ); - cpFloat maxBias(); + cpFloat getMaxBias(); - void maxBias( const cpFloat& maxbias ); + void setMaxBias( const cpFloat& maxbias ); virtual void draw(); - cpFloat errorBias(); + cpFloat getErrorBias(); - void errorBias( cpFloat value ); + void setErrorBias( cpFloat value ); - void data( void * data ); + void setData( void * data ); - void * data() const; + void * getData() const; - cpFloat impulse(); + cpFloat getImpulse(); protected: cpConstraint * mConstraint; diff --git a/include/eepp/physics/constraints/dampedrotaryspring.hpp b/include/eepp/physics/constraints/dampedrotaryspring.hpp index bd3b0e308..08312f04b 100644 --- a/include/eepp/physics/constraints/dampedrotaryspring.hpp +++ b/include/eepp/physics/constraints/dampedrotaryspring.hpp @@ -9,17 +9,17 @@ class CP_API DampedRotarySpring : public Constraint { public: DampedRotarySpring( Body * a, Body * b, cpFloat restAngle, cpFloat stiffness, cpFloat damping ); - cpFloat restAngle(); + cpFloat getRestAngle(); - void restAngle( const cpFloat& restangle ); + void setRestAngle( const cpFloat& restangle ); - cpFloat stiffness(); + cpFloat getStiffness(); - void stiffness( const cpFloat& stiffness ); + void setStiffness( const cpFloat& stiffness ); - cpFloat damping(); + cpFloat getDamping(); - void damping( const cpFloat& damping ); + void setDamping( const cpFloat& damping ); virtual void draw(); }; diff --git a/include/eepp/physics/constraints/dampedspring.hpp b/include/eepp/physics/constraints/dampedspring.hpp index 1216e5367..8ab507ace 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 getAnchr1(); - void anchr1( const cVect& anchr1 ); + void setAnchr1( const cVect& anchr1 ); - cVect anchr2(); + cVect getAnchr2(); - void anchr2( const cVect& anchr2 ); + void setAnchr2( const cVect& anchr2 ); - cpFloat restLength(); + cpFloat getRestLength(); - void restLength( const cpFloat& restlength ); + void setRestLength( const cpFloat& restlength ); - cpFloat stiffness(); + cpFloat getStiffness(); - void stiffness( const cpFloat& stiffness ); + void setStiffness( const cpFloat& stiffness ); - cpFloat damping(); + cpFloat getDamping(); - void damping( const cpFloat& damping ); + void setDamping( const cpFloat& damping ); virtual void draw(); #ifdef PHYSICS_RENDERER_ENABLED - cpFloat drawPointSize(); + cpFloat getDrawPointSize(); - virtual void drawPointSize( const cpFloat& size ); + virtual void setDrawPointSize( const cpFloat& size ); protected: cpFloat mDrawPointSize; #endif diff --git a/include/eepp/physics/constraints/gearjoint.hpp b/include/eepp/physics/constraints/gearjoint.hpp index fff6afbe9..217ec33d2 100644 --- a/include/eepp/physics/constraints/gearjoint.hpp +++ b/include/eepp/physics/constraints/gearjoint.hpp @@ -9,13 +9,13 @@ class CP_API GearJoint : public Constraint { public: GearJoint( Body * a, Body * b, cpFloat phase, cpFloat ratio ); - cpFloat phase(); + cpFloat getPhase(); - void phase( const cpFloat& phase ); + void setPhase( const cpFloat& phase ); - cpFloat ratio(); + cpFloat getRatio(); - void ratio( const cpFloat& ratio ); + void setRatio( const cpFloat& ratio ); virtual void draw(); }; diff --git a/include/eepp/physics/constraints/groovejoint.hpp b/include/eepp/physics/constraints/groovejoint.hpp index 82eee8f88..068ad1144 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 getAnchr2(); - void anchr2( const cVect& anchr2 ); + void setAnchr2( const cVect& anchr2 ); - cVect grooveA(); + cVect getGrooveA(); - void grooveA( const cVect& groove_a ); + void setGrooveA( const cVect& groove_a ); - cVect grooveB(); + cVect getGrooveB(); - void grooveB( const cVect& groove_b ); + void setGrooveB( const cVect& groove_b ); virtual void draw(); #ifdef PHYSICS_RENDERER_ENABLED - cpFloat drawPointSize(); + cpFloat getDrawPointSize(); - virtual void drawPointSize( const cpFloat& size ); + virtual void setDrawPointSize( const cpFloat& size ); protected: cpFloat mDrawPointSize; #endif diff --git a/include/eepp/physics/constraints/pinjoint.hpp b/include/eepp/physics/constraints/pinjoint.hpp index e25bbe2fd..e34b1b017 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 getAnchr1(); - void anchr1( const cVect& anchr1 ); + void setAnchr1( const cVect& anchr1 ); - cVect anchr2(); + cVect getAnchr2(); - void anchr2( const cVect& anchr2 ); + void setAnchr2( const cVect& anchr2 ); - cpFloat dist(); + cpFloat getDist(); - void dist( const cpFloat& dist ); + void setDist( const cpFloat& dist ); virtual void draw(); #ifdef PHYSICS_RENDERER_ENABLED - cpFloat drawPointSize(); + cpFloat getDrawPointSize(); - virtual void drawPointSize( const cpFloat& size ); + virtual void setDrawPointSize( const cpFloat& size ); protected: cpFloat mDrawPointSize; #endif diff --git a/include/eepp/physics/constraints/pivotjoint.hpp b/include/eepp/physics/constraints/pivotjoint.hpp index 7cbc06420..6b9d02b1e 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 getAnchr1(); - void anchr1( const cVect& anchr1 ); + void setAnchr1( const cVect& anchr1 ); - cVect anchr2(); + cVect getAnchr2(); - void anchr2( const cVect& anchr2 ); + void setAnchr2( const cVect& anchr2 ); virtual void draw(); #ifdef PHYSICS_RENDERER_ENABLED - cpFloat drawPointSize(); + cpFloat getDrawPointSize(); - virtual void drawPointSize( const cpFloat& size ); + virtual void setDrawPointSize( const cpFloat& size ); protected: cpFloat mDrawPointSize; #endif diff --git a/include/eepp/physics/constraints/ratchetjoint.hpp b/include/eepp/physics/constraints/ratchetjoint.hpp index 6ab9d4f56..6f7959f86 100644 --- a/include/eepp/physics/constraints/ratchetjoint.hpp +++ b/include/eepp/physics/constraints/ratchetjoint.hpp @@ -9,17 +9,17 @@ class CP_API RatchetJoint : public Constraint { public: RatchetJoint( Body * a, Body * b, cpFloat phase, cpFloat ratchet ); - cpFloat angle(); + cpFloat getAngle(); - void angle( const cpFloat& angle ); + void setAngle( const cpFloat& angle ); - cpFloat phase(); + cpFloat getPhase(); - void phase( const cpFloat& phase ); + void setPhase( const cpFloat& phase ); - cpFloat ratchet(); + cpFloat getRatchet(); - void ratchet( const cpFloat& ratchet ); + void setRatchet( const cpFloat& ratchet ); virtual void draw(); }; diff --git a/include/eepp/physics/constraints/rotarylimitjoint.hpp b/include/eepp/physics/constraints/rotarylimitjoint.hpp index ea6a26553..12581c979 100644 --- a/include/eepp/physics/constraints/rotarylimitjoint.hpp +++ b/include/eepp/physics/constraints/rotarylimitjoint.hpp @@ -9,13 +9,13 @@ class CP_API RotaryLimitJoint : public Constraint { public: RotaryLimitJoint( Body * a, Body * b, cpFloat min, cpFloat max ); - cpFloat min(); + cpFloat getMin(); - void min( const cpFloat& min ); + void setMin( const cpFloat& min ); - cpFloat max(); + cpFloat getMax(); - void max( const cpFloat& max ); + void setMax( const cpFloat& max ); virtual void draw(); }; diff --git a/include/eepp/physics/constraints/simplemotor.hpp b/include/eepp/physics/constraints/simplemotor.hpp index b8730fb37..e85e18fa6 100644 --- a/include/eepp/physics/constraints/simplemotor.hpp +++ b/include/eepp/physics/constraints/simplemotor.hpp @@ -9,9 +9,9 @@ class CP_API SimpleMotor : public Constraint { public: SimpleMotor( Body * a, Body * b, cpFloat rate ); - cpFloat rate(); + cpFloat getRate(); - void rate( const cpFloat& rate ); + void setRate( const cpFloat& rate ); virtual void draw(); }; diff --git a/include/eepp/physics/constraints/slidejoint.hpp b/include/eepp/physics/constraints/slidejoint.hpp index f5b592ddd..86cb64b89 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 getAnchr1(); - void anchr1( const cVect& anchr1 ); + void setAnchr1( const cVect& anchr1 ); - cVect anchr2(); + cVect getAnchr2(); - void anchr2( const cVect& anchr2 ); + void setAnchr2( const cVect& anchr2 ); - cpFloat min(); + cpFloat getMin(); - void min( const cpFloat& min ); + void setMin( const cpFloat& min ); - cpFloat max(); + cpFloat getMax(); - void max( const cpFloat& max ); + void setMax( const cpFloat& max ); virtual void draw(); #ifdef PHYSICS_RENDERER_ENABLED - cpFloat drawPointSize(); + cpFloat getDrawPointSize(); - virtual void drawPointSize( const cpFloat& size ); + virtual void setDrawPointSize( const cpFloat& size ); protected: cpFloat mDrawPointSize; #endif diff --git a/include/eepp/physics/physicsmanager.hpp b/include/eepp/physics/physicsmanager.hpp index 41e8fc0b8..6e5e39890 100644 --- a/include/eepp/physics/physicsmanager.hpp +++ b/include/eepp/physics/physicsmanager.hpp @@ -43,9 +43,9 @@ 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 setMemoryManager( bool memoryManager ); - const bool& memoryManager() const; + const bool& isMemoryManagerEnabled() const; PhysicsManager::DrawSpaceOptions * getDrawOptions(); protected: diff --git a/include/eepp/physics/shape.hpp b/include/eepp/physics/shape.hpp index 3ac2a5fab..b9dc7b34e 100644 --- a/include/eepp/physics/shape.hpp +++ b/include/eepp/physics/shape.hpp @@ -21,49 +21,49 @@ class CP_API Shape { virtual ~Shape(); - Physics::Body * body() const; + Physics::Body * getBody() const; - void body( Physics::Body * body ); + void setBody( Physics::Body * body ); - cBB bb() const; + cBB getBB() const; - void bb( const cBB& bb ); + void setBB( const cBB& bb ); - bool Sensor(); + bool isSensor(); - void Sensor( const bool& sensor ); + void setSensor( const bool& sensor ); - cpFloat e() const; + cpFloat getE() const; - void e( const cpFloat& e ); + void setE( const cpFloat& e ); - cpFloat elasticity() const; + cpFloat getElasticity() const; - void elasticity( const cpFloat& e ); + void setElasticity( const cpFloat& e ); - cpFloat u() const; + cpFloat getU() const; - void u( const cpFloat& u ); + void setU( const cpFloat& u ); - cpFloat friction() const; + cpFloat getFriction() const; - void friction( const cpFloat& u ); + void setFriction( const cpFloat& u ); - cVect surfaceVel() const; + cVect getSurfaceVel() const; - void surfaceVel( const cVect& vel ); + void getSurfaceVel( const cVect& vel ); - cpCollisionType collisionType() const; + cpCollisionType getCollisionType() const; - void collisionType( const cpCollisionType& type ); + void setCollisionType( const cpCollisionType& type ); - cpGroup group() const; + cpGroup getGroup() const; - void group( const cpGroup& group ); + void setGroup( const cpGroup& group ); - cpLayers layers() const; + cpLayers getLayers() const; - void layers( const cpLayers& layers ); + void setLayers( const cpLayers& layers ); cBB cacheBB(); @@ -71,7 +71,7 @@ class CP_API Shape { bool pointQuery( cVect p ); - cpShapeType type() const; + cpShapeType getType() const; ShapePoly * getAsPoly(); @@ -85,9 +85,9 @@ class CP_API Shape { virtual void drawBB(); - void * data() const; + void * getData() const; - void data( void * data ); + void setData( void * data ); protected: Shape(); diff --git a/include/eepp/physics/shapecircle.hpp b/include/eepp/physics/shapecircle.hpp index dcf62caf8..6981a7ce7 100644 --- a/include/eepp/physics/shapecircle.hpp +++ b/include/eepp/physics/shapecircle.hpp @@ -11,13 +11,13 @@ class CP_API ShapeCircle : public Shape { ShapeCircle( Physics::Body * body, cpFloat radius, cVect offset ); - cVect offset(); + cVect getOffset(); - virtual void offset( const cVect& offset ); + virtual void setOffset( const cVect& offset ); - cpFloat radius(); + cpFloat getRadius(); - virtual void radius( const cpFloat& radius ); + virtual void setRadius( const cpFloat& radius ); virtual void draw( Space * space ); }; diff --git a/include/eepp/physics/shapecirclesprite.hpp b/include/eepp/physics/shapecirclesprite.hpp index cccc8f7c4..d53128847 100644 --- a/include/eepp/physics/shapecirclesprite.hpp +++ b/include/eepp/physics/shapecirclesprite.hpp @@ -22,9 +22,9 @@ class CP_API ShapeCircleSprite : public ShapeCircle { virtual void draw( Space * space ); - virtual void radius( const cpFloat& radius ); + virtual void setRadius( const cpFloat& radius ); - virtual void offset( const cVect &offset ); + virtual void setOffset( const cVect &offset ); Sprite * getSprite() const; protected: diff --git a/include/eepp/physics/shapepoint.hpp b/include/eepp/physics/shapepoint.hpp index 592bf17d7..fe35109e9 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 getOffset(); - virtual void offset( const cVect& offset ); + virtual void setOffset( const cVect& offset ); - cpFloat radius(); + cpFloat getRadius(); - virtual void radius( const cpFloat& radius ); + virtual void setRadius( const cpFloat& radius ); virtual void draw( Space * space ); #ifdef PHYSICS_RENDERER_ENABLED - cpFloat drawRadius(); + cpFloat getDrawRadius(); - virtual void drawRadius( const cpFloat& radius ); + virtual void setDrawRadius( const cpFloat& radius ); protected: cpFloat mDrawRadius; #endif diff --git a/include/eepp/physics/shapesegment.hpp b/include/eepp/physics/shapesegment.hpp index 96a0eeba1..8c814b6bc 100644 --- a/include/eepp/physics/shapesegment.hpp +++ b/include/eepp/physics/shapesegment.hpp @@ -11,17 +11,17 @@ class CP_API ShapeSegment : public Shape { ShapeSegment( Physics::Body * body, cVect a, cVect b, cpFloat radius ); - cVect a(); + cVect getA(); - cVect b(); + cVect getB(); - cVect normal(); + cVect getNormal(); - cpFloat radius(); + cpFloat getRadius(); - void radius( const cpFloat& radius ); + void setRadius( const cpFloat& radius ); - void endpoints( const cVect& a, const cVect& b ); + void setEndpoints( const cVect& a, const cVect& b ); bool query( cVect a, cVect b, cpSegmentQueryInfo * info ); diff --git a/include/eepp/physics/space.hpp b/include/eepp/physics/space.hpp index 65a376744..26e02ef55 100644 --- a/include/eepp/physics/space.hpp +++ b/include/eepp/physics/space.hpp @@ -130,43 +130,43 @@ class CP_API Space { void update(); - Body * staticBody() const; + Body * getStaticBody() const; - const int& iterations() const; + const int& getIterations() const; - void iterations( const int& iterations ); + void setIterations( const int& iterations ); - cVect gravity() const; + cVect getGravity() const; - void gravity( const cVect& gravity ); + void setGravity( const cVect& gravity ); - const cpFloat& damping() const; + const cpFloat& getDamping() const; - void damping( const cpFloat& damping ); + void setDamping( const cpFloat& damping ); - const cpFloat& idleSpeedThreshold() const; + const cpFloat& getIdleSpeedThreshold() const; - void idleSpeedThreshold( const cpFloat& idleSpeedThreshold ); + void setIdleSpeedThreshold( const cpFloat& idleSpeedThreshold ); - const cpFloat& sleepTimeThreshold() const; + const cpFloat& getSleepTimeThreshold() const; - void sleepTimeThreshold( const cpFloat& sleepTimeThreshold ); + void setSleepTimeThreshold( const cpFloat& sleepTimeThreshold ); - void collisionSlop( cpFloat slop ); + void setCollisionSlop( cpFloat slop ); - cpFloat collisionSlop() const; + cpFloat getCollisionSlop() const; - void collisionBias( cpFloat bias ); + void setCollisionBias( cpFloat bias ); - cpFloat collisionBias() const; + cpFloat getCollisionBias() const; - cpTimestamp collisionPersistence(); + cpTimestamp getCollisionPersistence(); - void collisionPersistence( cpTimestamp value ); + void setCollisionPersistence( cpTimestamp value ); - bool enableContactGraph(); + bool getEnableContactGraph(); - void enableContactGraph( bool value ); + void setEnableContactGraph( bool value ); bool contains( Shape * shape ); @@ -230,9 +230,9 @@ class CP_API Space { void pointQuery( cVect point, cpLayers layers, cpGroup group, PointQueryFunc func, void * data ); - void data( void * data ); + void setData( void * data ); - void * data() const; + void * getData() const; void reindexShape( Shape * shape ); @@ -262,7 +262,7 @@ class CP_API Space { std::list mConstraints; std::map< cpHashValue, CollisionHandler > mCollisions; CollisionHandler mCollisionsDefault; - std::list< PostStepCallbackCont* > mPostStepCallbacks; + std::list< PostStepCallbackCont* > mPostStepCallbacks; }; CP_NAMESPACE_END diff --git a/projects/linux/ee.creator.user b/projects/linux/ee.creator.user index f1803cda5..45cbb3475 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 7e7d01ad9..5fa96e759 100644 --- a/src/eepp/physics/arbiter.cpp +++ b/src/eepp/physics/arbiter.cpp @@ -72,11 +72,11 @@ cpFloat Arbiter::getDepth( int i ) { return cpArbiterGetDepth( mArbiter, i ); } -cpContactPointSet Arbiter::contactPointSet() { +cpContactPointSet Arbiter::getContactPointSet() { return cpArbiterGetContactPointSet( mArbiter ); } -void Arbiter::contactPointSet( cpContactPointSet * contact ) { +void Arbiter::setContactPointSet( cpContactPointSet * contact ) { cpArbiterSetContactPointSet( mArbiter, contact ); } @@ -84,35 +84,35 @@ cpArbiter * Arbiter::getArbiter() const { return mArbiter; } -cpFloat Arbiter::elasticity() { +cpFloat Arbiter::getElasticity() { return cpArbiterGetElasticity( mArbiter); } -void Arbiter::elasticity( cpFloat value ) { +void Arbiter::setElasticity( cpFloat value ) { cpArbiterSetElasticity( mArbiter, value ); } -cpFloat Arbiter::friction() { +cpFloat Arbiter::getFriction() { return cpArbiterGetFriction( mArbiter ); } -void Arbiter::friction( cpFloat value ) { +void Arbiter::setFriction( cpFloat value ) { cpArbiterSetFriction( mArbiter, value ); } -cVect Arbiter::surfaceVelocity() { +cVect Arbiter::getSurfaceVelocity() { return tovect( cpArbiterGetSurfaceVelocity( mArbiter ) ); } -void Arbiter::surfaceVelocity( cVect value ) { +void Arbiter::setSurfaceVelocity( cVect value ) { cpArbiterSetSurfaceVelocity( mArbiter, tocpv( value ) ); } -void Arbiter::userData( cpDataPointer value ) { +void Arbiter::setUserData( cpDataPointer value ) { cpArbiterSetUserData( mArbiter, value ); } -cpDataPointer Arbiter::userData() const { +cpDataPointer Arbiter::getUserData() const { return cpArbiterGetUserData( mArbiter ); } diff --git a/src/eepp/physics/body.cpp b/src/eepp/physics/body.cpp index dff25c762..92019d472 100644 --- a/src/eepp/physics/body.cpp +++ b/src/eepp/physics/body.cpp @@ -88,95 +88,95 @@ cpBody * Body::getBody() const { return mBody; } -cpFloat Body::mass() const { +cpFloat Body::getMass() const { return cpBodyGetMass( mBody ); } -void Body::mass( const cpFloat& mass ) { +void Body::setMass( const cpFloat& mass ) { cpBodySetMass( mBody, mass ); } -cpFloat Body::moment() const { +cpFloat Body::getMoment() const { return cpBodyGetMoment( mBody ); } -void Body::moment( const cpFloat& i ) { +void Body::setMoment( const cpFloat& i ) { cpBodySetMoment( mBody, i ); } -cVect Body::pos() const { +cVect Body::getPos() const { return tovect( cpBodyGetPos( mBody ) ); } -void Body::pos( const cVect& pos ) { +void Body::setPos( const cVect& pos ) { cpBodySetPos( mBody, tocpv( pos ) ); } -cVect Body::vel() const { +cVect Body::getVel() const { return tovect( cpBodyGetVel( mBody ) ); } -void Body::vel( const cVect& vel ) { +void Body::setVel( const cVect& vel ) { cpBodySetVel( mBody, tocpv( vel ) ); } -cVect Body::force() const { +cVect Body::getForce() const { return tovect( cpBodyGetForce( mBody ) ); } -void Body::force( const cVect& force ) { +void Body::setForce( const cVect& force ) { cpBodySetForce( mBody, tocpv( force ) ); } -cpFloat Body::angle() const { +cpFloat Body::getAngle() const { return cpBodyGetAngle( mBody ); } -void Body::angle( const cpFloat& rads ) { +void Body::setAngle( const cpFloat& rads ) { cpBodySetAngle( mBody, rads ); } -cpFloat Body::angleDeg() { +cpFloat Body::getAngleDeg() { return cpDegrees( mBody->a ); } -void Body::angleDeg( const cpFloat& angle ) { - this->angle( cpRadians( angle ) ); +void Body::setAngleDeg( const cpFloat& angle ) { + this->setAngle( cpRadians( angle ) ); } -cpFloat Body::angVel() const { +cpFloat Body::getAngVel() const { return cpBodyGetAngVel( mBody ); } -void Body::angVel( const cpFloat& rotVel ) { +void Body::setAngVel( const cpFloat& rotVel ) { cpBodySetAngVel( mBody, rotVel ); } -cpFloat Body::torque() const { +cpFloat Body::getTorque() const { return cpBodyGetTorque( mBody ); } -void Body::torque( const cpFloat& torque ) { +void Body::setTorque( const cpFloat& torque ) { cpBodySetTorque( mBody, torque ); } -cVect Body::rot() const { +cVect Body::getRot() const { return tovect( cpBodyGetRot( mBody ) ); } -cpFloat Body::velLimit() const { +cpFloat Body::getVelLimit() const { return cpBodyGetVelLimit( mBody ); } -void Body::velLimit( const cpFloat& speed ) { +void Body::setVelLimit( const cpFloat& speed ) { cpBodySetVelLimit( mBody, speed ); } -cpFloat Body::angVelLimit() const { +cpFloat Body::getAngVelLimit() const { return cpBodyGetAngVelLimit( mBody ); } -void Body::angVelLimit( const cpFloat& speed ) { +void Body::setAngVelLimit( const cpFloat& speed ) { cpBodySetAngVelLimit( mBody, speed ); } @@ -240,11 +240,11 @@ cpFloat Body::kineticEnergy() { return cpBodyKineticEnergy( mBody ); } -void * Body::data() const { +void * Body::getData() const { return mData; } -void Body::data( void * data ) { +void Body::setData( void * data ) { mData = data; } diff --git a/src/eepp/physics/constraints/constraint.cpp b/src/eepp/physics/constraints/constraint.cpp index 91ff31e93..b73f28fe4 100644 --- a/src/eepp/physics/constraints/constraint.cpp +++ b/src/eepp/physics/constraints/constraint.cpp @@ -35,47 +35,47 @@ cpConstraint * Constraint::getConstraint() const { return mConstraint; } -Body * Constraint::a() { +Body * Constraint::getA() { return reinterpret_cast( mConstraint->a->data ); } -Body * Constraint::b() { +Body * Constraint::getB() { return reinterpret_cast( mConstraint->b->data ); } -cpFloat Constraint::maxForce() { +cpFloat Constraint::getMaxForce() { return mConstraint->maxForce; } -void Constraint::maxForce( const cpFloat& maxforce ) { +void Constraint::setMaxForce( const cpFloat& maxforce ) { mConstraint->maxForce = maxforce; } -cpFloat Constraint::maxBias() { +cpFloat Constraint::getMaxBias() { return mConstraint->maxBias; } -void Constraint::maxBias( const cpFloat& maxbias ) { +void Constraint::setMaxBias( const cpFloat& maxbias ) { mConstraint->maxBias = maxbias; } -cpFloat Constraint::errorBias() { +cpFloat Constraint::getErrorBias() { return cpConstraintGetErrorBias( mConstraint ); } -void Constraint::errorBias( cpFloat value ) { +void Constraint::setErrorBias( cpFloat value ) { cpConstraintSetErrorBias( mConstraint, value ); } -void Constraint::data( void * data ) { +void Constraint::setData( void * data ) { mData = data; } -void * Constraint::data() const { +void * Constraint::getData() const { return mData; } -cpFloat Constraint::impulse() { +cpFloat Constraint::getImpulse() { return cpConstraintGetImpulse( mConstraint ); } diff --git a/src/eepp/physics/constraints/dampedrotaryspring.cpp b/src/eepp/physics/constraints/dampedrotaryspring.cpp index b101ab6c2..673988bf4 100644 --- a/src/eepp/physics/constraints/dampedrotaryspring.cpp +++ b/src/eepp/physics/constraints/dampedrotaryspring.cpp @@ -7,27 +7,27 @@ DampedRotarySpring::DampedRotarySpring( Body * a, Body * b, cpFloat restAngle, c setData(); } -cpFloat DampedRotarySpring::restAngle() { +cpFloat DampedRotarySpring::getRestAngle() { return cpDampedRotarySpringGetRestAngle( mConstraint ); } -void DampedRotarySpring::restAngle( const cpFloat& restangle ) { +void DampedRotarySpring::setRestAngle( const cpFloat& restangle ) { cpDampedRotarySpringSetRestAngle( mConstraint, restangle ); } -cpFloat DampedRotarySpring::stiffness() { +cpFloat DampedRotarySpring::getStiffness() { return cpDampedRotarySpringGetStiffness( mConstraint ); } -void DampedRotarySpring::stiffness( const cpFloat& stiffness ) { +void DampedRotarySpring::setStiffness( const cpFloat& stiffness ) { cpDampedRotarySpringSetStiffness( mConstraint, stiffness ); } -cpFloat DampedRotarySpring::damping() { +cpFloat DampedRotarySpring::getDamping() { return cpDampedRotarySpringGetDamping( mConstraint ); } -void DampedRotarySpring::damping( const cpFloat& damping ) { +void DampedRotarySpring::setDamping( const cpFloat& damping ) { cpDampedRotarySpringSetDamping( mConstraint, damping ); } diff --git a/src/eepp/physics/constraints/dampedspring.cpp b/src/eepp/physics/constraints/dampedspring.cpp index 027f0a4ac..a9485ea86 100644 --- a/src/eepp/physics/constraints/dampedspring.cpp +++ b/src/eepp/physics/constraints/dampedspring.cpp @@ -19,43 +19,43 @@ DampedSpring::DampedSpring( Body * a, Body * b, cVect anchr1, cVect anchr2, cpFl setData(); } -cVect DampedSpring::anchr1() { +cVect DampedSpring::getAnchr1() { return tovect( cpDampedSpringGetAnchr1( mConstraint ) ); } -void DampedSpring::anchr1( const cVect& anchr1 ) { +void DampedSpring::setAnchr1( const cVect& anchr1 ) { cpDampedSpringSetAnchr1( mConstraint, tocpv( anchr1 ) ); } -cVect DampedSpring::anchr2() { +cVect DampedSpring::getAnchr2() { return tovect( cpDampedSpringGetAnchr2( mConstraint ) ); } -void DampedSpring::anchr2( const cVect& anchr2 ) { +void DampedSpring::setAnchr2( const cVect& anchr2 ) { cpDampedSpringSetAnchr2( mConstraint, tocpv( anchr2 ) ); } -cpFloat DampedSpring::restLength() { +cpFloat DampedSpring::getRestLength() { return cpDampedSpringGetRestLength( mConstraint ); } -void DampedSpring::restLength( const cpFloat& restlength ) { +void DampedSpring::setRestLength( const cpFloat& restlength ) { cpDampedSpringSetRestLength( mConstraint, restlength ); } -cpFloat DampedSpring::stiffness() { +cpFloat DampedSpring::getStiffness() { return cpDampedSpringGetStiffness( mConstraint ); } -void DampedSpring::stiffness( const cpFloat& stiffness ) { +void DampedSpring::setStiffness( const cpFloat& stiffness ) { cpDampedSpringSetStiffness( mConstraint, stiffness ); } -cpFloat DampedSpring::damping() { +cpFloat DampedSpring::getDamping() { return cpDampedSpringGetDamping( mConstraint ); } -void DampedSpring::damping( const cpFloat& damping ) { +void DampedSpring::setDamping( const cpFloat& damping ) { cpDampedSpringSetDamping( mConstraint, damping ); } @@ -135,11 +135,11 @@ void DampedSpring::draw() { #ifdef PHYSICS_RENDERER_ENABLED -cpFloat DampedSpring::drawPointSize() { +cpFloat DampedSpring::getDrawPointSize() { return mDrawPointSize; } -void DampedSpring::drawPointSize( const cpFloat& size ) { +void DampedSpring::setDrawPointSize( const cpFloat& size ) { mDrawPointSize = size; } #endif diff --git a/src/eepp/physics/constraints/gearjoint.cpp b/src/eepp/physics/constraints/gearjoint.cpp index 1afc76255..9fd7ca46a 100644 --- a/src/eepp/physics/constraints/gearjoint.cpp +++ b/src/eepp/physics/constraints/gearjoint.cpp @@ -7,19 +7,19 @@ GearJoint::GearJoint( Body * a, Body * b, cpFloat phase, cpFloat ratio ) { setData(); } -cpFloat GearJoint::phase() { +cpFloat GearJoint::getPhase() { return cpGearJointGetPhase( mConstraint ); } -void GearJoint::phase( const cpFloat& phase ) { +void GearJoint::setPhase( const cpFloat& phase ) { cpGearJointSetPhase( mConstraint, phase ); } -cpFloat GearJoint::ratio() { +cpFloat GearJoint::getRatio() { return cpGearJointGetRatio( mConstraint ); } -void GearJoint::ratio( const cpFloat& ratio ) { +void GearJoint::setRatio( const cpFloat& ratio ) { cpGearJointSetRatio( mConstraint, ratio ); } diff --git a/src/eepp/physics/constraints/groovejoint.cpp b/src/eepp/physics/constraints/groovejoint.cpp index ad01422c3..95d5d590f 100644 --- a/src/eepp/physics/constraints/groovejoint.cpp +++ b/src/eepp/physics/constraints/groovejoint.cpp @@ -16,27 +16,27 @@ GrooveJoint::GrooveJoint( Body * a, Body * b, cVect groove_a, cVect groove_b, cV setData(); } -cVect GrooveJoint::anchr2() { +cVect GrooveJoint::getAnchr2() { return tovect( cpGrooveJointGetAnchr2( mConstraint ) ); } -void GrooveJoint::anchr2( const cVect& anchr2 ) { +void GrooveJoint::setAnchr2( const cVect& anchr2 ) { cpGrooveJointSetAnchr2( mConstraint, tocpv( anchr2 ) ); } -cVect GrooveJoint::grooveA() { +cVect GrooveJoint::getGrooveA() { return tovect( cpGrooveJointGetGrooveA( mConstraint ) ); } -void GrooveJoint::grooveA( const cVect& groove_a ) { +void GrooveJoint::setGrooveA( const cVect& groove_a ) { cpGrooveJointSetGrooveA( mConstraint, tocpv( groove_a ) ); } -cVect GrooveJoint::grooveB() { +cVect GrooveJoint::getGrooveB() { return tovect( cpGrooveJointGetGrooveB( mConstraint ) ); } -void GrooveJoint::grooveB( const cVect& groove_b ) { +void GrooveJoint::setGrooveB( const cVect& groove_b ) { cpGrooveJointSetGrooveB( mConstraint, tocpv( groove_b ) ); } @@ -69,11 +69,11 @@ void GrooveJoint::draw() { } #ifdef PHYSICS_RENDERER_ENABLED -cpFloat GrooveJoint::drawPointSize() { +cpFloat GrooveJoint::getDrawPointSize() { return mDrawPointSize; } -void GrooveJoint::drawPointSize( const cpFloat& size ) { +void GrooveJoint::setDrawPointSize( const cpFloat& size ) { mDrawPointSize = size; } #endif diff --git a/src/eepp/physics/constraints/pinjoint.cpp b/src/eepp/physics/constraints/pinjoint.cpp index 8ec0edde9..4cb66ec41 100644 --- a/src/eepp/physics/constraints/pinjoint.cpp +++ b/src/eepp/physics/constraints/pinjoint.cpp @@ -16,27 +16,27 @@ PinJoint::PinJoint( Body * a, Body * b, cVect anchr1, cVect anchr2 ) setData(); } -cVect PinJoint::anchr1() { +cVect PinJoint::getAnchr1() { return tovect( cpPinJointGetAnchr1( mConstraint ) ); } -void PinJoint::anchr1( const cVect& anchr1 ) { +void PinJoint::setAnchr1( const cVect& anchr1 ) { cpPinJointSetAnchr1( mConstraint, tocpv( anchr1 ) ); } -cVect PinJoint::anchr2() { +cVect PinJoint::getAnchr2() { return tovect( cpPinJointGetAnchr2( mConstraint ) ); } -void PinJoint::anchr2( const cVect& anchr2 ) { +void PinJoint::setAnchr2( const cVect& anchr2 ) { cpPinJointSetAnchr2( mConstraint, tocpv( anchr2 ) ); } -cpFloat PinJoint::dist() { +cpFloat PinJoint::getDist() { return cpPinJointGetDist( mConstraint ); } -void PinJoint::dist( const cpFloat& dist ) { +void PinJoint::setDist( const cpFloat& dist ) { cpPinJointSetDist( mConstraint, dist ); } @@ -71,11 +71,11 @@ void PinJoint::draw() { } #ifdef PHYSICS_RENDERER_ENABLED -cpFloat PinJoint::drawPointSize() { +cpFloat PinJoint::getDrawPointSize() { return mDrawPointSize; } -void PinJoint::drawPointSize( const cpFloat& size ) { +void PinJoint::setDrawPointSize( const cpFloat& size ) { mDrawPointSize = size; } #endif diff --git a/src/eepp/physics/constraints/pivotjoint.cpp b/src/eepp/physics/constraints/pivotjoint.cpp index 8f7de67d8..cf0a4bfbe 100644 --- a/src/eepp/physics/constraints/pivotjoint.cpp +++ b/src/eepp/physics/constraints/pivotjoint.cpp @@ -25,19 +25,19 @@ PivotJoint::PivotJoint( Body * a, Body * b, cVect anchr1, cVect anchr2 ) setData(); } -cVect PivotJoint::anchr1() { +cVect PivotJoint::getAnchr1() { return tovect( cpPivotJointGetAnchr1( mConstraint ) ); } -void PivotJoint::anchr1( const cVect& anchr1 ) { +void PivotJoint::setAnchr1( const cVect& anchr1 ) { cpPivotJointSetAnchr1( mConstraint, tocpv( anchr1 ) ); } -cVect PivotJoint::anchr2() { +cVect PivotJoint::getAnchr2() { return tovect( cpPivotJointGetAnchr2( mConstraint ) ); } -void PivotJoint::anchr2( const cVect& anchr2 ) { +void PivotJoint::setAnchr2( const cVect& anchr2 ) { cpPivotJointSetAnchr2( mConstraint, tocpv( anchr2 ) ); } @@ -66,11 +66,11 @@ void PivotJoint::draw() { } #ifdef PHYSICS_RENDERER_ENABLED -cpFloat PivotJoint::drawPointSize() { +cpFloat PivotJoint::getDrawPointSize() { return mDrawPointSize; } -void PivotJoint::drawPointSize( const cpFloat& size ) { +void PivotJoint::setDrawPointSize( const cpFloat& size ) { mDrawPointSize = size; } #endif diff --git a/src/eepp/physics/constraints/ratchetjoint.cpp b/src/eepp/physics/constraints/ratchetjoint.cpp index 1c83f6538..a500d10e6 100644 --- a/src/eepp/physics/constraints/ratchetjoint.cpp +++ b/src/eepp/physics/constraints/ratchetjoint.cpp @@ -7,27 +7,27 @@ RatchetJoint::RatchetJoint( Body * a, Body * b, cpFloat phase, cpFloat ratchet ) setData(); } -cpFloat RatchetJoint::angle() { +cpFloat RatchetJoint::getAngle() { return cpRatchetJointGetAngle( mConstraint ); } -void RatchetJoint::angle( const cpFloat& angle ) { +void RatchetJoint::setAngle( const cpFloat& angle ) { cpRatchetJointSetAngle( mConstraint, angle ); } -cpFloat RatchetJoint::phase() { +cpFloat RatchetJoint::getPhase() { return cpRatchetJointGetPhase( mConstraint ); } -void RatchetJoint::phase( const cpFloat& phase ) { +void RatchetJoint::setPhase( const cpFloat& phase ) { cpRatchetJointSetPhase( mConstraint, phase ); } -cpFloat RatchetJoint::ratchet() { +cpFloat RatchetJoint::getRatchet() { return cpRatchetJointGetRatchet( mConstraint ); } -void RatchetJoint::ratchet( const cpFloat& ratchet ) { +void RatchetJoint::setRatchet( const cpFloat& ratchet ) { cpRatchetJointSetRatchet( mConstraint, ratchet ); } diff --git a/src/eepp/physics/constraints/rotarylimitjoint.cpp b/src/eepp/physics/constraints/rotarylimitjoint.cpp index 1f92f08c0..6a4ab0ab4 100644 --- a/src/eepp/physics/constraints/rotarylimitjoint.cpp +++ b/src/eepp/physics/constraints/rotarylimitjoint.cpp @@ -7,19 +7,19 @@ RotaryLimitJoint::RotaryLimitJoint( Body * a, Body * b, cpFloat min, cpFloat max setData(); } -cpFloat RotaryLimitJoint::min() { +cpFloat RotaryLimitJoint::getMin() { return cpRotaryLimitJointGetMin( mConstraint ); } -void RotaryLimitJoint::min( const cpFloat& min ) { +void RotaryLimitJoint::setMin( const cpFloat& min ) { cpRotaryLimitJointSetMin( mConstraint, min ); } -cpFloat RotaryLimitJoint::max() { +cpFloat RotaryLimitJoint::getMax() { return cpRotaryLimitJointGetMax( mConstraint ); } -void RotaryLimitJoint::max( const cpFloat& max ) { +void RotaryLimitJoint::setMax( const cpFloat& max ) { cpRotaryLimitJointSetMax( mConstraint, max ); } diff --git a/src/eepp/physics/constraints/simplemotor.cpp b/src/eepp/physics/constraints/simplemotor.cpp index 2fa606818..f0fa28727 100644 --- a/src/eepp/physics/constraints/simplemotor.cpp +++ b/src/eepp/physics/constraints/simplemotor.cpp @@ -7,11 +7,11 @@ SimpleMotor::SimpleMotor( Body * a, Body * b, cpFloat rate ) { setData(); } -cpFloat SimpleMotor::rate() { +cpFloat SimpleMotor::getRate() { return cpSimpleMotorGetRate( mConstraint ); } -void SimpleMotor::rate( const cpFloat& rate ) { +void SimpleMotor::setRate( const cpFloat& rate ) { cpSimpleMotorSetRate( mConstraint, rate ); } diff --git a/src/eepp/physics/constraints/slidejoint.cpp b/src/eepp/physics/constraints/slidejoint.cpp index 2f50b2b0d..e55cae784 100644 --- a/src/eepp/physics/constraints/slidejoint.cpp +++ b/src/eepp/physics/constraints/slidejoint.cpp @@ -16,35 +16,35 @@ SlideJoint::SlideJoint( Body * a, Body *b, cVect anchr1, cVect anchr2, cpFloat m setData(); } -cVect SlideJoint::anchr1() { +cVect SlideJoint::getAnchr1() { return tovect( cpSlideJointGetAnchr1( mConstraint ) ); } -void SlideJoint::anchr1( const cVect& anchr1 ) { +void SlideJoint::setAnchr1( const cVect& anchr1 ) { cpSlideJointSetAnchr1( mConstraint, tocpv( anchr1 ) ); } -cVect SlideJoint::anchr2() { +cVect SlideJoint::getAnchr2() { return tovect( cpSlideJointGetAnchr2( mConstraint ) ); } -void SlideJoint::anchr2( const cVect& anchr2 ) { +void SlideJoint::setAnchr2( const cVect& anchr2 ) { cpSlideJointSetAnchr2( mConstraint, tocpv( anchr2 ) ); } -cpFloat SlideJoint::min() { +cpFloat SlideJoint::getMin() { return cpSlideJointGetMin( mConstraint ); } -void SlideJoint::min( const cpFloat& min ) { +void SlideJoint::setMin( const cpFloat& min ) { cpSlideJointSetMin( mConstraint, min ); } -cpFloat SlideJoint::max() { +cpFloat SlideJoint::getMax() { return cpSlideJointGetMax( mConstraint ); } -void SlideJoint::max( const cpFloat& max ) { +void SlideJoint::setMax( const cpFloat& max ) { cpSlideJointSetMax( mConstraint, max ); } @@ -77,11 +77,11 @@ void SlideJoint::draw() { } #ifdef PHYSICS_RENDERER_ENABLED -cpFloat SlideJoint::drawPointSize() { +cpFloat SlideJoint::getDrawPointSize() { return mDrawPointSize; } -void SlideJoint::drawPointSize( const cpFloat& size ) { +void SlideJoint::setDrawPointSize( const cpFloat& size ) { mDrawPointSize = size; } #endif diff --git a/src/eepp/physics/physicsmanager.cpp b/src/eepp/physics/physicsmanager.cpp index 166dbd005..25e98cb1d 100644 --- a/src/eepp/physics/physicsmanager.cpp +++ b/src/eepp/physics/physicsmanager.cpp @@ -40,11 +40,11 @@ PhysicsManager::DrawSpaceOptions * PhysicsManager::getDrawOptions() { return &mOptions; } -void PhysicsManager::memoryManager( bool MemoryManager ) { +void PhysicsManager::setMemoryManager( bool MemoryManager ) { mMemoryManager = MemoryManager; } -const bool& PhysicsManager::memoryManager() const { +const bool& PhysicsManager::isMemoryManagerEnabled() const { return mMemoryManager; } diff --git a/src/eepp/physics/shape.cpp b/src/eepp/physics/shape.cpp index d18a7c0c7..e19f97930 100644 --- a/src/eepp/physics/shape.cpp +++ b/src/eepp/physics/shape.cpp @@ -17,7 +17,7 @@ void Shape::resetShapeIdCounter() { void Shape::Free( Shape * shape, bool DeleteBody ) { if ( DeleteBody ) { - Physics::Body * b = shape->body(); + Physics::Body * b = shape->getBody(); cpSAFE_DELETE( b ); } @@ -56,112 +56,112 @@ bool Shape::pointQuery( cVect p ) { return 0 != cpShapePointQuery( mShape, tocpv( p ) ); } -Physics::Body * Shape::body() const { +Physics::Body * Shape::getBody() const { return reinterpret_cast( mShape->body->data ); } -void Shape::body( Physics::Body * body ) { +void Shape::setBody( Physics::Body * body ) { mShape->body = body->getBody(); } -cBB Shape::bb() const { +cBB Shape::getBB() const { return tocbb( mShape->bb ); } -void Shape::bb( const cBB& bb ) { +void Shape::setBB( const cBB& bb ) { mShape->bb = tocpbb( bb ); } -bool Shape::Sensor() { +bool Shape::isSensor() { return 0 != mShape->sensor; } -void Shape::Sensor( const bool& sensor ) { +void Shape::setSensor( const bool& sensor ) { mShape->sensor = sensor ? 1 : 0; } -cpFloat Shape::e() const { +cpFloat Shape::getE() const { return mShape->e; } -void Shape::e( const cpFloat& e ) { +void Shape::setE( const cpFloat& e ) { mShape->e = e; } -cpFloat Shape::elasticity() const { - return e(); +cpFloat Shape::getElasticity() const { + return getE(); } -void Shape::elasticity( const cpFloat& e ) { - this->e( e ); +void Shape::setElasticity( const cpFloat& e ) { + this->setE( e ); } -cpFloat Shape::u() const { +cpFloat Shape::getU() const { return mShape->u; } -void Shape::u( const cpFloat& u ) { +void Shape::setU( const cpFloat& u ) { mShape->u = u; } -cpFloat Shape::friction() const { - return u(); +cpFloat Shape::getFriction() const { + return getU(); } -void Shape::friction( const cpFloat& u ) { - this->u( u ); +void Shape::setFriction( const cpFloat& u ) { + this->setU( u ); } -cVect Shape::surfaceVel() const { +cVect Shape::getSurfaceVel() const { return tovect( mShape->surface_v ); } -void Shape::surfaceVel( const cVect& vel ) { +void Shape::getSurfaceVel( const cVect& vel ) { mShape->surface_v = tocpv( vel ); } -cpCollisionType Shape::collisionType() const { +cpCollisionType Shape::getCollisionType() const { return mShape->collision_type; } -void Shape::collisionType( const cpCollisionType& type ) { +void Shape::setCollisionType( const cpCollisionType& type ) { mShape->collision_type = type; } -cpGroup Shape::group() const { +cpGroup Shape::getGroup() const { return mShape->group; } -void Shape::group( const cpGroup& group ) { +void Shape::setGroup( const cpGroup& group ) { mShape->group = group; } -cpLayers Shape::layers() const { +cpLayers Shape::getLayers() const { return mShape->layers; } -void Shape::layers( const cpLayers& layers ) { +void Shape::setLayers( const cpLayers& layers ) { mShape->layers = layers; } -cpShapeType Shape::type() const { +cpShapeType Shape::getType() const { return mShape->CP_PRIVATE(klass)->type; } ShapePoly * Shape::getAsPoly() { - eeASSERT( type() == CP_POLY_SHAPE ); + eeASSERT( getType() == CP_POLY_SHAPE ); return reinterpret_cast( this ); } ShapeCircle * Shape::getAsCircle() { - eeASSERT( type() == CP_CIRCLE_SHAPE ); + eeASSERT( getType() == CP_CIRCLE_SHAPE ); return reinterpret_cast( this ); } ShapeSegment * Shape::getAsSegment() { - eeASSERT( type() == CP_SEGMENT_SHAPE ); + eeASSERT( getType() == CP_SEGMENT_SHAPE ); return reinterpret_cast( this ); } @@ -178,11 +178,11 @@ void Shape::drawBB() { #endif } -void * Shape::data() const { +void * Shape::getData() const { return mData; } -void Shape::data( void * data ) { +void Shape::setData( void * data ) { mData = data; } diff --git a/src/eepp/physics/shapecircle.cpp b/src/eepp/physics/shapecircle.cpp index 17840e632..de1809ce9 100644 --- a/src/eepp/physics/shapecircle.cpp +++ b/src/eepp/physics/shapecircle.cpp @@ -19,19 +19,19 @@ ShapeCircle::ShapeCircle( Physics::Body * body, cpFloat radius, cVect offset ) { setData(); } -cVect ShapeCircle::offset() { +cVect ShapeCircle::getOffset() { return tovect( cpCircleShapeGetOffset( mShape ) ); } -void ShapeCircle::offset( const cVect &offset ) { +void ShapeCircle::setOffset( const cVect &offset ) { cpCircleShapeSetOffset( mShape, tocpv( offset ) ); } -cpFloat ShapeCircle::radius() { +cpFloat ShapeCircle::getRadius() { return cpCircleShapeGetRadius( mShape ); } -void ShapeCircle::radius( const cpFloat& radius ) { +void ShapeCircle::setRadius( const cpFloat& radius ) { cpCircleShapeSetRadius( mShape, radius ); } diff --git a/src/eepp/physics/shapecirclesprite.cpp b/src/eepp/physics/shapecirclesprite.cpp index 5b6d72f20..c351ec62b 100644 --- a/src/eepp/physics/shapecirclesprite.cpp +++ b/src/eepp/physics/shapecirclesprite.cpp @@ -24,29 +24,29 @@ ShapeCircleSprite::~ShapeCircleSprite() { } void ShapeCircleSprite::draw( Space * space ) { - cVect Pos = body()->pos(); + cVect Pos = getBody()->getPos(); mSprite->setPosition( Pos.x, Pos.y ); - mSprite->setRotation( body()->angleDeg() ); + mSprite->setRotation( getBody()->getAngleDeg() ); mSprite->draw(); } void ShapeCircleSprite::offsetSet() { - mSprite->setSize( Sizef( ShapeCircle::radius() * 2, ShapeCircle::radius() * 2 ) ); - mSprite->setOffset( Vector2i( -ShapeCircle::radius() + ShapeCircle::offset().x, -ShapeCircle::radius() + ShapeCircle::offset().y ) ); + mSprite->setSize( Sizef( ShapeCircle::getRadius() * 2, ShapeCircle::getRadius() * 2 ) ); + mSprite->setOffset( Vector2i( -ShapeCircle::getRadius() + ShapeCircle::getOffset().x, -ShapeCircle::getRadius() + ShapeCircle::getOffset().y ) ); } Sprite * ShapeCircleSprite::getSprite() const { return mSprite; } -void ShapeCircleSprite::radius( const cpFloat& radius ) { - ShapeCircle::radius( radius ); +void ShapeCircleSprite::setRadius( const cpFloat& radius ) { + ShapeCircle::setRadius( radius ); offsetSet(); } -void ShapeCircleSprite::offset( const cVect &offset ) { - ShapeCircle::offset( offset ); +void ShapeCircleSprite::setOffset( const cVect &offset ) { + ShapeCircle::setOffset( offset ); offsetSet(); } diff --git a/src/eepp/physics/shapepoint.cpp b/src/eepp/physics/shapepoint.cpp index 61f34fe7f..38d094d41 100644 --- a/src/eepp/physics/shapepoint.cpp +++ b/src/eepp/physics/shapepoint.cpp @@ -23,19 +23,19 @@ ShapePoint::ShapePoint( Physics::Body * body, cpFloat radius, cVect offset ) setData(); } -cVect ShapePoint::offset() { +cVect ShapePoint::getOffset() { return tovect( cpCircleShapeGetOffset( mShape ) ); } -void ShapePoint::offset( const cVect &offset ) { +void ShapePoint::setOffset( const cVect &offset ) { cpCircleShapeSetOffset( mShape, tocpv( offset ) ); } -cpFloat ShapePoint::radius() { +cpFloat ShapePoint::getRadius() { return cpCircleShapeGetRadius( mShape ); } -void ShapePoint::radius( const cpFloat& radius ) { +void ShapePoint::setRadius( const cpFloat& radius ) { cpCircleShapeSetRadius( mShape, radius ); } @@ -58,11 +58,11 @@ void ShapePoint::draw( Space * space ) { } #ifdef PHYSICS_RENDERER_ENABLED -cpFloat ShapePoint::drawRadius() { +cpFloat ShapePoint::getDrawRadius() { return mDrawRadius; } -void ShapePoint::drawRadius( const cpFloat& radius ) { +void ShapePoint::setDrawRadius( const cpFloat& radius ) { mDrawRadius = radius; } #endif diff --git a/src/eepp/physics/shapepolysprite.cpp b/src/eepp/physics/shapepolysprite.cpp index e432e08f5..18c534d75 100644 --- a/src/eepp/physics/shapepolysprite.cpp +++ b/src/eepp/physics/shapepolysprite.cpp @@ -37,11 +37,11 @@ ShapePolySprite::~ShapePolySprite() { } void ShapePolySprite::draw( Space * space ) { - cVect Pos = body()->pos(); + cVect Pos = getBody()->getPos(); mSprite->setOffset( mOffset ); mSprite->setPosition( Pos.x, Pos.y ); - mSprite->setRotation( body()->angleDeg() ); + mSprite->setRotation( getBody()->getAngleDeg() ); mSprite->draw(); } diff --git a/src/eepp/physics/shapesegment.cpp b/src/eepp/physics/shapesegment.cpp index 1302f3e4f..0a2abbaf3 100644 --- a/src/eepp/physics/shapesegment.cpp +++ b/src/eepp/physics/shapesegment.cpp @@ -20,27 +20,27 @@ ShapeSegment::ShapeSegment( Physics::Body * body, cVect a, cVect b, cpFloat radi setData(); } -cVect ShapeSegment::a() { +cVect ShapeSegment::getA() { return tovect( cpSegmentShapeGetA( mShape ) ); } -cVect ShapeSegment::b() { +cVect ShapeSegment::getB() { return tovect( cpSegmentShapeGetB( mShape ) ); } -cVect ShapeSegment::normal() { +cVect ShapeSegment::getNormal() { return tovect( cpSegmentShapeGetNormal( mShape ) ); } -cpFloat ShapeSegment::radius() { +cpFloat ShapeSegment::getRadius() { return cpSegmentShapeGetRadius( mShape ); } -void ShapeSegment::radius( const cpFloat& radius ) { +void ShapeSegment::setRadius( const cpFloat& radius ) { cpSegmentShapeSetRadius( mShape, radius ); } -void ShapeSegment::endpoints( const cVect& a, const cVect& b ) { +void ShapeSegment::setEndpoints( const cVect& a, const cVect& b ) { cpSegmentShapeSetEndpoints( mShape, tocpv( a ), tocpv( b ) ); } diff --git a/src/eepp/physics/space.cpp b/src/eepp/physics/space.cpp index 6ff16e159..fc8b4388c 100644 --- a/src/eepp/physics/space.cpp +++ b/src/eepp/physics/space.cpp @@ -50,11 +50,11 @@ Space::~Space() { PhysicsManager::instance()->removeSpace( this ); } -void Space::data( void * data ) { +void Space::setData( void * data ) { mData = data; } -void * Space::data() const { +void * Space::getData() const { return mData; } @@ -70,79 +70,79 @@ void Space::update() { #endif } -const int& Space::iterations() const { +const int& Space::getIterations() const { return mSpace->iterations; } -void Space::iterations( const int& iterations ) { +void Space::setIterations( const int& iterations ) { mSpace->iterations = iterations; } -cVect Space::gravity() const { +cVect Space::getGravity() const { return tovect( mSpace->gravity ); } -void Space::gravity( const cVect& gravity ) { +void Space::setGravity( const cVect& gravity ) { mSpace->gravity = tocpv( gravity ); } -const cpFloat& Space::damping() const { +const cpFloat& Space::getDamping() const { return mSpace->damping; } -void Space::damping( const cpFloat& damping ) { +void Space::setDamping( const cpFloat& damping ) { mSpace->damping = damping; } -const cpFloat& Space::idleSpeedThreshold() const { +const cpFloat& Space::getIdleSpeedThreshold() const { return mSpace->idleSpeedThreshold; } -void Space::idleSpeedThreshold( const cpFloat& idleSpeedThreshold ) { +void Space::setIdleSpeedThreshold( const cpFloat& idleSpeedThreshold ) { mSpace->idleSpeedThreshold = idleSpeedThreshold; } -const cpFloat& Space::sleepTimeThreshold() const { +const cpFloat& Space::getSleepTimeThreshold() const { return mSpace->sleepTimeThreshold; } -void Space::sleepTimeThreshold( const cpFloat& sleepTimeThreshold ) { +void Space::setSleepTimeThreshold( const cpFloat& sleepTimeThreshold ) { mSpace->sleepTimeThreshold = sleepTimeThreshold; } -void Space::collisionSlop( cpFloat slop ) { +void Space::setCollisionSlop( cpFloat slop ) { mSpace->collisionSlop = slop; } -cpFloat Space::collisionSlop() const { +cpFloat Space::getCollisionSlop() const { return mSpace->collisionSlop; } -void Space::collisionBias( cpFloat bias ) { +void Space::setCollisionBias( cpFloat bias ) { mSpace->collisionBias = bias; } -cpFloat Space::collisionBias() const { +cpFloat Space::getCollisionBias() const { return mSpace->collisionBias; } -cpTimestamp Space::collisionPersistence() { +cpTimestamp Space::getCollisionPersistence() { return cpSpaceGetCollisionPersistence( mSpace ); } -void Space::collisionPersistence( cpTimestamp value ) { +void Space::setCollisionPersistence( cpTimestamp value ) { cpSpaceSetCollisionPersistence( mSpace, value ); } -bool Space::enableContactGraph() { +bool Space::getEnableContactGraph() { return cpTrue == cpSpaceGetEnableContactGraph( mSpace ); } -void Space::enableContactGraph( bool value ) { +void Space::setEnableContactGraph( bool value ) { cpSpaceSetEnableContactGraph( mSpace, value ); } -Body * Space::staticBody() const { +Body * Space::getStaticBody() const { return mStatiBody; } diff --git a/src/examples/physics/physics.cpp b/src/examples/physics/physics.cpp index 3aceb32b5..0506eb730 100644 --- a/src/examples/physics/physics.cpp +++ b/src/examples/physics/physics.cpp @@ -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->setPos( cVectNew( x, y ) ); ShapePoint * shape = ShapePoint::New( body, 0.95, cVectZero ); - shape->drawRadius( 4 ); - shape->elasticity( 0.0 ); - shape->friction( 0.0 ); + shape->setDrawRadius( 4 ); + shape->setElasticity( 0.0 ); + shape->setFriction( 0.0 ); return shape; } @@ -116,7 +116,7 @@ void demo1Create() { mWindow->setCaption( "eepp - Physics - Logo Smash" ); mSpace = Physics::Space::New(); - mSpace->iterations( 1 ); + mSpace->setIterations( 1 ); // The space will contain a very large number of similary sized objects. // This is the perfect candidate for using the spatial hash. @@ -137,7 +137,7 @@ void demo1Create() { shape = make_ball( pX + x * 4, pY + y * 4 ); - mSpace->addBody( shape->body() ); + mSpace->addBody( shape->getBody() ); mSpace->addShape( shape ); bodyCount++; @@ -145,13 +145,13 @@ void demo1Create() { } body = mSpace->addBody( Body::New( INFINITY, INFINITY ) ); - body->pos( cVectNew( 0, mWindow->getHeight() / 2 + 16 ) ); - body->vel( cVectNew( 400, 0 ) ); + body->setPos( cVectNew( 0, mWindow->getHeight() / 2 + 16 ) ); + body->setVel( 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->setElasticity( 0.0 ); + shape->setFriction( 0.0 ); + shape->setLayers( NOT_GRABABLE_MASK ); bodyCount++; } @@ -173,53 +173,53 @@ void demo2Create() { Shape::resetShapeIdCounter(); mSpace = Physics::Space::New(); - mSpace->gravity( cVectNew( 0, 100 ) ); - mSpace->sleepTimeThreshold( 0.5f ); + mSpace->setGravity( cVectNew( 0, 100 ) ); + mSpace->setSleepTimeThreshold( 0.5f ); - Body *body, *statiBody = mSpace->staticBody(); + Body *body, *statiBody = mSpace->getStaticBody(); Shape * shape; 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->setE( 1.0f ); + shape->setU( 1.0f ); + shape->setLayers( NOT_GRABABLE_MASK ); 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->setE( 1.0f ); + shape->setU( 1.0f ); + shape->setLayers( NOT_GRABABLE_MASK ); 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->setE( 1.0f ); + shape->setU( 1.0f ); + shape->setLayers( NOT_GRABABLE_MASK ); 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->setE( 1.0f ); + shape->setU( 1.0f ); + shape->setLayers( 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->setPos( cVectNew( hw + j * 32 - i * 16, 100 + i * 32 ) ); shape = mSpace->addShape( ShapePoly::New( body, 30.f, 30.f ) ); - shape->e( 0.0f ); - shape->u( 0.8f ); + shape->setE( 0.0f ); + shape->setU( 0.8f ); } } 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->setPos( cVectNew( hw, mWindow->getHeight() - radius - 5 ) ); shape = mSpace->addShape( ShapeCircle::New( body, radius, cVectZero ) ); - shape->e( 0.0f ); - shape->u( 0.9f ); + shape->setE( 0.0f ); + shape->setU( 0.9f ); } void demo2Update() { @@ -246,7 +246,7 @@ cpBool blockerBegin( Arbiter *arb, Space *space, void *unused ) { Shape * a, * b; arb->getShapes( &a, &b ); - Emitter *emitter = (Emitter *) a->data(); + Emitter *emitter = (Emitter *) a->getData(); emitter->blocked++; @@ -257,7 +257,7 @@ void blockerSeparate( Arbiter *arb, Space * space, void *unused ) { Shape * a, * b; arb->getShapes( &a, &b ); - Emitter *emitter = (Emitter *) a->data(); + Emitter *emitter = (Emitter *) a->getData(); emitter->blocked--; } @@ -265,12 +265,12 @@ 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() ) ) { + if ( NULL != mMouseJoint && ( mMouseJoint->getA() == shape->getBody() || mMouseJoint->getB() == shape->getBody() ) ) { space->removeConstraint( mMouseJoint ); eeSAFE_DELETE( mMouseJoint ); } - space->removeBody( shape->body() ); + space->removeBody( shape->getBody() ); space->removeShape( shape ); Shape::Free( shape, true ); @@ -280,7 +280,7 @@ cpBool catcherBarBegin(Arbiter *arb, Space *space, void *unused) { Shape * a, * b; arb->getShapes( &a, &b ); - Emitter *emitter = (Emitter *) a->data(); + Emitter *emitter = (Emitter *) a->getData(); emitter->queue++; @@ -299,10 +299,10 @@ void demo3Create() { Shape::resetShapeIdCounter(); mSpace = Physics::Space::New(); - mSpace->iterations( 10 ); - mSpace->gravity( cVectNew( 0, 100 ) ); + mSpace->setIterations( 10 ); + mSpace->setGravity( cVectNew( 0, 100 ) ); - Body * statiBody = mSpace->staticBody(); + Body * statiBody = mSpace->getStaticBody(); Shape * shape; emitterInstance.queue = 5; @@ -310,15 +310,15 @@ void demo3Create() { emitterInstance.position = cVectNew( mWindow->getWidth() / 2 , 150); shape = mSpace->addShape( ShapeCircle::New( statiBody, 15.0f, emitterInstance.position ) ); - shape->Sensor( 1 ); - shape->collisionType( BLOCKING_SENSOR_TYPE ); - shape->data( &emitterInstance ); + shape->setSensor( 1 ); + shape->setCollisionType( BLOCKING_SENSOR_TYPE ); + shape->setData( &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->Sensor( 1 ); - shape->collisionType( CATCH_SENSOR_TYPE ); - shape->data( &emitterInstance ); + shape->setSensor( 1 ); + shape->setCollisionType( CATCH_SENSOR_TYPE ); + shape->setData( &emitterInstance ); Space::CollisionHandler handler; handler.a = BLOCKING_SENSOR_TYPE; @@ -340,11 +340,11 @@ void demo3Update() { 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->setPos( emitterInstance.position ); + body->setVel( 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->setCollisionType( BALL_TYPE ); } } @@ -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->getContactPointSet(); for(int i=0; icontactPointSet( &contacts ); + arb->setContactPointSet( &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->getUserData() && deepest <= 0.0f){ Body *bodyA, *bodyB; arb->getBodies( &bodyA, &bodyB ); @@ -399,16 +399,16 @@ cpBool stickyPreSolve( Arbiter *arb, Space *space, void *data ) PivotJoint * joint = cpNew( PivotJoint, ( bodyA, bodyB, tovect( contacts.points[0].point ) ) ); // Dont draw the constraint - joint->drawPointSize( 0 ); + joint->setDrawPointSize( 0 ); // Give it a finite force for the stickyness. - joint->maxForce( 3e3 ); + joint->setMaxForce( 3e3 ); // Schedule a post-step() callback to add the joint. space->addPostStepCallback( cb::Make3( &postStepAddJoint ), joint, NULL ); // Store the joint on the arbiter so we can remove it later. - arb->userData(joint); + arb->setUserData(joint); } // Position correction and velocity are handled separately so changing @@ -432,20 +432,20 @@ void postStepRemoveJoint(Space *space, void *key, void *data) void stickySeparate(Arbiter *arb, Space *space, void *data) { - Constraint *joint = (Constraint *)arb->userData(); + Constraint *joint = (Constraint *)arb->getUserData(); 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->setMaxForce( 0.0f ); // Perform the removal in a post-step() callback. 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->setUserData( NULL ); } } @@ -463,52 +463,52 @@ void demo4Create() { mWindow->setCaption( "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->setIterations( 10 ); + mSpace->setGravity( cVectNew( 0, 1000 ) ); + mSpace->setCollisionSlop( 2.0 ); - Body * statiBody = mSpace->staticBody(); + Body * statiBody = mSpace->getStaticBody(); 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->setElasticity( 1.0f ); + shape->setFriction( 1.0f ); + shape->setCollisionType( COLLIDE_STICK_SENSOR ); + shape->setLayers( 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->setElasticity( 1.0f ); + shape->setFriction( 1.0f ); + shape->setCollisionType( COLLIDE_STICK_SENSOR ); + shape->setLayers( 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->setElasticity( 1.0f ); + shape->setFriction( 1.0f ); + shape->setCollisionType( COLLIDE_STICK_SENSOR ); + shape->setLayers( 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->setElasticity( 1.0f ); + shape->setFriction( 1.0f ); + shape->setCollisionType( COLLIDE_STICK_SENSOR ); + shape->setLayers( 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->setPos( 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->setFriction( 0.9f ); + shape->setCollisionType( COLLIDE_STICK_SENSOR ); } Space::CollisionHandler c; @@ -574,8 +574,8 @@ 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->getFPS() ); + mMouseBody->setPos( newPoint ); + mMouseBody->setVel( ( newPoint - mMousePoint_last ) * (cpFloat)mWindow->getFPS() ); mMousePoint_last = newPoint; if ( KM->isMouseLeftPressed() ) { @@ -585,9 +585,9 @@ void physicsUpdate() { 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->getBody(), cVectZero, shape->getBody()->world2Local( point ) ) ); - mMouseJoint->maxForce( 50000.0f ); + mMouseJoint->setMaxForce( 50000.0f ); mSpace->addConstraint( mMouseJoint ); } } diff --git a/src/test/eetest.cpp b/src/test/eetest.cpp index 806d7e8cb..e4aa76bea 100644 --- a/src/test/eetest.cpp +++ b/src/test/eetest.cpp @@ -1580,55 +1580,55 @@ void EETest::demo1Create() { Shape::resetShapeIdCounter(); mSpace = Physics::Space::New(); - mSpace->gravity( cVectNew( 0, 100 ) ); - mSpace->sleepTimeThreshold( 0.5f ); + mSpace->setGravity( cVectNew( 0, 100 ) ); + mSpace->setSleepTimeThreshold( 0.5f ); - Body *body, *statiBody = mSpace->staticBody(); + Body *body, *statiBody = mSpace->getStaticBody(); Shape * shape; 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->setE( 1.0f ); + shape->setU( 1.0f ); + shape->setLayers( NOT_GRABABLE_MASK ); 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->setE( 1.0f ); + shape->setU( 1.0f ); + shape->setLayers( NOT_GRABABLE_MASK ); 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->setE( 1.0f ); + shape->setU( 1.0f ); + shape->setLayers( NOT_GRABABLE_MASK ); 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->setE( 1.0f ); + shape->setU( 1.0f ); + shape->setLayers( 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->setPos( 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->e( 0.0f ); - shape->u( 0.8f ); + shape->setE( 0.0f ); + shape->setU( 0.8f ); } } 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->setPos( cVectNew( hw, mWindow->getHeight() - radius - 5 ) ); //shape = mSpace->AddShape( ShapeCircleSprite::New( body, radius, cVectZero, mCircleSprite ) ); shape = mSpace->addShape( ShapeCircle::New( body, radius, cVectZero ) ); - shape->e( 0.0f ); - shape->u( 0.9f ); + shape->setE( 0.0f ); + shape->setU( 0.9f ); } void EETest::demo1Update() { @@ -1655,7 +1655,7 @@ cpBool EETest::blockerBegin( Arbiter *arb, Space *space, void *unused ) { Shape * a, * b; arb->getShapes( &a, &b ); - Emitter *emitter = (Emitter *) a->data(); + Emitter *emitter = (Emitter *) a->getData(); emitter->blocked++; @@ -1666,7 +1666,7 @@ void EETest::blockerSeparate( Arbiter *arb, Space * space, void *unused ) { Shape * a, * b; arb->getShapes( &a, &b ); - Emitter *emitter = (Emitter *) a->data(); + Emitter *emitter = (Emitter *) a->getData(); emitter->blocked--; } @@ -1675,7 +1675,7 @@ 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() ) ) { + if ( NULL != mMouseJoint && ( mMouseJoint->getA() == shape->getBody() || mMouseJoint->getB() == shape->getBody() ) ) { mSpace->removeConstraint( mMouseJoint ); eeSAFE_DELETE( mMouseJoint ); } @@ -1688,7 +1688,7 @@ void EETest::postStepRemove( Space *space, void * tshape, void * unused ) { } #endif - mSpace->removeBody( shape->body() ); + mSpace->removeBody( shape->getBody() ); mSpace->removeShape( shape ); Shape::Free( shape, true ); } @@ -1697,7 +1697,7 @@ cpBool EETest::catcherBarBegin(Arbiter *arb, Physics::Space *space, void *unused Shape * a, * b; arb->getShapes( &a, &b ); - Emitter *emitter = (Emitter *) a->data(); + Emitter *emitter = (Emitter *) a->getData(); emitter->queue++; @@ -1712,10 +1712,10 @@ void EETest::demo2Create() { Shape::resetShapeIdCounter(); mSpace = Physics::Space::New(); - mSpace->iterations( 10 ); - mSpace->gravity( cVectNew( 0, 100 ) ); + mSpace->setIterations( 10 ); + mSpace->setGravity( cVectNew( 0, 100 ) ); - Body * statiBody = mSpace->staticBody(); + Body * statiBody = mSpace->getStaticBody(); Shape * shape; emitterInstance.queue = 5; @@ -1723,15 +1723,15 @@ void EETest::demo2Create() { emitterInstance.position = cVectNew( mWindow->getWidth() / 2 , 150); shape = mSpace->addShape( ShapeCircle::New( statiBody, 15.0f, emitterInstance.position ) ); - shape->Sensor( 1 ); - shape->collisionType( BLOCKING_SENSOR_TYPE ); - shape->data( &emitterInstance ); + shape->setSensor( 1 ); + shape->setCollisionType( BLOCKING_SENSOR_TYPE ); + shape->setData( &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->Sensor( 1 ); - shape->collisionType( CATCH_SENSOR_TYPE ); - shape->data( &emitterInstance ); + shape->setSensor( 1 ); + shape->setCollisionType( CATCH_SENSOR_TYPE ); + shape->setData( &emitterInstance ); Space::CollisionHandler handler; handler.a = BLOCKING_SENSOR_TYPE; @@ -1753,11 +1753,11 @@ void EETest::demo2Update() { 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->setPos( emitterInstance.position ); + body->setVel( 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->setCollisionType( BALL_TYPE ); } } @@ -1809,8 +1809,8 @@ 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->getFPS() ); + mMouseBody->setPos( newPoint ); + mMouseBody->setVel( ( newPoint - mMousePoint_last ) * (cpFloat)mWindow->getFPS() ); mMousePoint_last = newPoint; if ( KM->isMouseLeftPressed() ) { @@ -1820,9 +1820,9 @@ void EETest::physicsUpdate() { 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->getBody(), cVectZero, shape->getBody()->world2Local( point ) ) ); - mMouseJoint->maxForce( 50000.0f ); + mMouseJoint->setMaxForce( 50000.0f ); mSpace->addConstraint( mMouseJoint ); } }