cocos2d-x  3.0alpha1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PhysicsShape Class Referenceabstract

A shape for body. More...

#include <CCPhysicsShape.h>

Inheritance diagram for PhysicsShape:
Object PhysicsShapeBox PhysicsShapeCircle PhysicsShapeEdgeBox PhysicsShapeEdgeChain PhysicsShapeEdgePolygon PhysicsShapeEdgeSegment PhysicsShapePolygon

Public Types

enum  Type {
  UNKNOWN, CIRCLE, BOX, POLYGEN,
  EDGESEGMENT, EDGEBOX, EDGEPOLYGEN, EDGECHAIN
}
 

Public Member Functions

PhysicsBodygetBody () const
Type getType () const
float getArea () const
float getMoment () const
void setMoment (float moment)
local setMoment ( local moment)
void setTag (int tag)
int getTag () const
float getMass () const
void setMass (float mass)
float getDensity () const
void setDensity (float density)
void setRestitution (float restitution)
local setRestitution ( local restitution)
void setFriction (float friction)
void setMaterial (const PhysicsMaterial &material)
virtual float calculateDefaultMoment ()
virtual float calculateDefaultArea ()
var calculateDefaultArea ()
local calculateDefaultArea ()
virtual Point getOffset ()
virtual Point getCenter ()
local getCenter ()
bool containsPoint (const Point &point) const
void setCategoryBitmask (int bitmask)
var setCategoryBitmask ( var bitmask)
local setCategoryBitmask ( local bitmask)
int getCategoryBitmask () const
void setContactTestBitmask (int bitmask)
int getContactTestBitmask () const
void setCollisionBitmask (int bitmask)
int getCollisionBitmask () const
void setGroup (int group)
int getGroup ()
- Public Member Functions inherited from Object
 Object ()
 Constructor. More...
 
virtual ~Object ()
void release ()
 Release the ownership immediately. More...
 
void retain ()
 Retains the ownership. More...
 
Objectautorelease ()
 Release the ownership sometime soon automatically. More...
 
bool isSingleReference () const
 Returns a boolean value that indicates whether there is only one reference to the object. More...
 
unsigned int retainCount () const
 Returns the object's current reference count. More...
 
virtual bool isEqual (const Object *object)
 Returns a boolean value that indicates whether this object and a given object are equal. More...
 
virtual void acceptVisitor (DataVisitor &visitor)
virtual void update (float dt)

Static Public Member Functions

static PointrecenterPoints (Point *points, int count, const Point &center=Point::ZERO)
local recenterPoints ( local points, local count, local ZERO)
static Point getPolyonCenter (const Point *points, int count)
var getPolyonCenter ( var points, var count)
local getPolyonCenter ( local points, local count)

Protected Member Functions

bool init (Type type)
local init ( local type)
PhysicsBodyInfobodyInfo () const
 PhysicsShape is PhysicsBody's friend class, but all the subclasses isn't. More...
 
var bodyInfo ()
 PhysicsShape is PhysicsBody's friend class, but all the subclasses isn't. More...
 
void setBody (PhysicsBody *body)
 PhysicsShape ()
virtual ~PhysicsShape ()=0

Protected Attributes

PhysicsBody_body
PhysicsShapeInfo_info
local _info
Type _type
float _area
var _area
local _area
float _mass
var _mass
local _mass
float _moment
var _moment
local _moment
PhysicsMaterial _material
var _material
local _material
int _tag
int _categoryBitmask
var _categoryBitmask
local _categoryBitmask
int _collisionBitmask
var _collisionBitmask
local _collisionBitmask
int _contactTestBitmask
var _contactTestBitmask
local _contactTestBitmask
int _group
- Protected Attributes inherited from Object
unsigned int _reference
 count of references More...
 
unsigned int _autoReleaseCount
 count of autorelease More...
 

Friends

class PhysicsWorld
class PhysicsBody
class PhysicsJoint
class PhysicsDebugDraw

Additional Inherited Members

- Public Attributes inherited from Object
unsigned int _ID
 object id, ScriptSupport need public _ID More...
 
int _luaID
 Lua reference id. More...
 

Detailed Description

A shape for body.

You do not create PhysicsWorld objects directly, instead, you can view PhysicsBody to see how to create it.

Member Enumeration Documentation

enum Type
strong
Enumerator
UNKNOWN 
CIRCLE 
BOX 
POLYGEN 
EDGESEGMENT 
EDGEBOX 
EDGEPOLYGEN 
EDGECHAIN 
var Type
strong
Enumerator
UNKNOWN 
CIRCLE 
BOX 
POLYGEN 
EDGESEGMENT 
EDGEBOX 
EDGEPOLYGEN 
EDGECHAIN 
local Type
strong
Enumerator
UNKNOWN 
CIRCLE 
BOX 
POLYGEN 
EDGESEGMENT 
EDGEBOX 
EDGEPOLYGEN 
EDGECHAIN 

Constructor & Destructor Documentation

PhysicsShape ( )
protected
var PhysicsShape ( )
protected
local PhysicsShape ( )
protected
virtual ~PhysicsShape ( )
protectedpure virtual
var ~PhysicsShape ( )
protectedpure virtual
local ~PhysicsShape ( )
protectedpure virtual

Member Function Documentation

PhysicsBodyInfo* bodyInfo ( ) const
protected

PhysicsShape is PhysicsBody's friend class, but all the subclasses isn't.

so this method is use for subclasses to catch the bodyInfo from PhysicsBody.

var bodyInfo ( )
protected

PhysicsShape is PhysicsBody's friend class, but all the subclasses isn't.

so this method is use for subclasses to catch the bodyInfo from PhysicsBody.

local bodyInfo ( )
protected

PhysicsShape is PhysicsBody's friend class, but all the subclasses isn't.

so this method is use for subclasses to catch the bodyInfo from PhysicsBody.

virtual float calculateDefaultArea ( )
inlinevirtual
var calculateDefaultArea ( )
inlinevirtual
local calculateDefaultArea ( )
inlinevirtual
virtual float
calculateDefaultMoment
( )
inlinevirtual
var calculateDefaultMoment ( )
inlinevirtual
local calculateDefaultMoment ( )
inlinevirtual
bool containsPoint ( const Point point) const
var containsPoint ( var  point)
local containsPoint ( local  point)
float getArea ( ) const
inline
var getArea ( )
inline
local getArea ( )
inline
PhysicsBody* getBody ( ) const
inline
var getBody ( )
inline
local getBody ( )
inline
int getCategoryBitmask ( ) const
inline
var getCategoryBitmask ( )
inline
local getCategoryBitmask ( )
inline
virtual Point getCenter ( )
inlinevirtual
var getCenter ( )
inlinevirtual
local getCenter ( )
inlinevirtual
int getCollisionBitmask ( ) const
inline
var getCollisionBitmask ( )
inline
local getCollisionBitmask ( )
inline
int getContactTestBitmask ( ) const
inline
var getContactTestBitmask ( )
inline
local getContactTestBitmask ( )
inline
float getDensity ( ) const
inline
var getDensity ( )
inline
local getDensity ( )
inline
int getGroup ( )
inline
var getGroup ( )
inline
local getGroup ( )
inline
float getMass ( ) const
inline
var getMass ( )
inline
local getMass ( )
inline
float getMoment ( ) const
inline
var getMoment ( )
inline
local getMoment ( )
inline
virtual Point getOffset ( )
inlinevirtual
var getOffset ( )
inlinevirtual
local getOffset ( )
inlinevirtual
static Point getPolyonCenter ( const Point points,
int  count 
)
static
var getPolyonCenter ( var  points,
var  count 
)
static
local getPolyonCenter ( local  points,
local  count 
)
static
int getTag ( ) const
inline
var getTag ( )
inline
local getTag ( )
inline
Type getType ( ) const
inline
var getType ( )
inline
local getType ( )
inline
bool init ( Type  type)
protected
var init ( var  type)
protected
local init ( local  type)
protected
static Point* recenterPoints ( Point points,
int  count,
const Point center = Point::ZERO 
)
static
var recenterPoints ( var  points,
var  count,
var  center = Point::ZERO 
)
static
local recenterPoints ( local  points,
local  count,
local  center = Point::ZERO 
)
static
void setBody ( PhysicsBody body)
protected
var setBody ( var  body)
protected
local setBody ( local  body)
protected
void setCategoryBitmask ( int  bitmask)
inline
var setCategoryBitmask ( var  bitmask)
inline
local setCategoryBitmask ( local  bitmask)
inline
void setCollisionBitmask ( int  bitmask)
inline
var setCollisionBitmask ( var  bitmask)
inline
local setCollisionBitmask ( local  bitmask)
inline
void setContactTestBitmask ( int  bitmask)
inline
var setContactTestBitmask ( var  bitmask)
inline
local setContactTestBitmask ( local  bitmask)
inline
void setDensity ( float  density)
var setDensity ( var  density)
local setDensity ( local  density)
void setFriction ( float  friction)
var setFriction ( var  friction)
local setFriction ( local  friction)
void setGroup ( int  group)
var setGroup ( var  group)
local setGroup ( local  group)
void setMass ( float  mass)
var setMass ( var  mass)
local setMass ( local  mass)
void setMaterial ( const PhysicsMaterial material)
var setMaterial ( var  material)
local setMaterial ( local  material)
void setMoment ( float  moment)
var setMoment ( var  moment)
local setMoment ( local  moment)
void setRestitution ( float  restitution)
var setRestitution ( var  restitution)
local setRestitution ( local  restitution)
void setTag ( int  tag)
inline
var setTag ( var  tag)
inline
local setTag ( local  tag)
inline

Friends And Related Function Documentation

friend class PhysicsBody
friend
var PhysicsBody
friend
local PhysicsBody
friend
friend class PhysicsDebugDraw
friend
var PhysicsDebugDraw
friend
local PhysicsDebugDraw
friend
friend class PhysicsJoint
friend
var PhysicsJoint
friend
local PhysicsJoint
friend
friend class PhysicsWorld
friend
var PhysicsWorld
friend
local PhysicsWorld
friend

Member Data Documentation

float _area
protected
var _area
protected
local _area
protected
PhysicsBody* _body
protected
var _body
protected
local _body
protected
int _categoryBitmask
protected
var _categoryBitmask
protected
local _categoryBitmask
protected
int _collisionBitmask
protected
var _collisionBitmask
protected
local _collisionBitmask
protected
int _contactTestBitmask
protected
var _contactTestBitmask
protected
local _contactTestBitmask
protected
int _group
protected
var _group
protected
local _group
protected
PhysicsShapeInfo* _info
protected
var _info
protected
local _info
protected
float _mass
protected
var _mass
protected
local _mass
protected
PhysicsMaterial _material
protected
var _material
protected
local _material
protected
float _moment
protected
var _moment
protected
local _moment
protected
int _tag
protected
var _tag
protected
local _tag
protected
Type _type
protected
var _type
protected
local _type
protected

The documentation for this class was generated from the following file: