cocos2d-x  3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PhysicsShapePolygon Class Reference

A polygon shape. More...

#include <CCPhysicsShape.h>

Inheritance diagram for PhysicsShapePolygon:
PhysicsShape Ref PhysicsShapeBox

Public Member Functions

float calculateDefaultMoment () override
 Calculate the default moment value. More...
 
Vec2 getPoint (int i) const
local getPoint ( local i)
void getPoints (Vec2 *outPoints) const
local getPoints ( local outPoints)
int getPointsCount () const
local getPointsCount ()
virtual Vec2 getCenter () override
 Get center of this shape. More...
 
local getCenter ()
 Get center of this shape. More...
 
- Public Member Functions inherited from PhysicsShape
PhysicsBodygetBody () const
 Get the body that this shape attaches. More...
 
Type getType () const
 Return the type of this shape. More...
 
var getType ()
 Return the type of this shape. More...
 
local getType ()
 Return the type of this shape. More...
 
float getArea () const
 return the area of this shape More...
 
local getArea ()
 return the area of this shape More...
 
float getMoment () const
 get moment More...
 
local getMoment ()
 get moment More...
 
void setMoment (float moment)
 Set moment, it will change the body's moment this shape attaches. More...
 
var setMoment ( var moment)
 Set moment, it will change the body's moment this shape attaches. More...
 
local setMoment ( local moment)
 Set moment, it will change the body's moment this shape attaches. More...
 
void setTag (int tag)
int getTag () const
local getTag ()
float getMass () const
 get mass More...
 
var getMass ()
 get mass More...
 
local getMass ()
 get mass More...
 
void setMass (float mass)
 Set mass, it will change the body's mass this shape attaches. More...
 
var setMass ( var mass)
 Set mass, it will change the body's mass this shape attaches. More...
 
local setMass ( local mass)
 Set mass, it will change the body's mass this shape attaches. More...
 
float getDensity () const
local getDensity ()
void setDensity (float density)
local setDensity ( local density)
float getRestitution () const
local getRestitution ()
void setRestitution (float restitution)
local setRestitution ( local restitution)
float getFriction () const
var getFriction ()
local getFriction ()
void setFriction (float friction)
local setFriction ( local friction)
const PhysicsMaterialgetMaterial () const
void setMaterial (const PhysicsMaterial &material)
var setMaterial ( var material)
local setMaterial ( local material)
virtual Vec2 getOffset ()
 Get offset. More...
 
local getOffset ()
 Get offset. More...
 
bool containsPoint (const Vec2 &point) const
 Test point is in shape or not. More...
 
var containsPoint ( var point)
 Test point is in shape or not. More...
 
local containsPoint ( local point)
 Test point is in shape or not. More...
 
void setCategoryBitmask (int bitmask)
 A mask that defines which categories this physics body belongs to. More...
 
int getCategoryBitmask () const
void setContactTestBitmask (int bitmask)
 A mask that defines which categories of bodies cause intersection notifications with this physics body. More...
 
int getContactTestBitmask () const
var getContactTestBitmask ()
local getContactTestBitmask ()
void setCollisionBitmask (int bitmask)
 A mask that defines which categories of physics bodies can collide with this physics body. More...
 
int getCollisionBitmask () const
local getCollisionBitmask ()
void setGroup (int group)
 set the group of body Collision groups let you specify an integral group index. More...
 
var setGroup ( var group)
 set the group of body Collision groups let you specify an integral group index. More...
 
local setGroup ( local group)
 set the group of body Collision groups let you specify an integral group index. More...
 
int getGroup ()
var getGroup ()
local getGroup ()
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()

Static Public Member Functions

static PhysicsShapePolygoncreate (const Vec2 *points, int count, const PhysicsMaterial &material=PHYSICSSHAPE_MATERIAL_DEFAULT, const Vec2 &offset=Vec2::ZERO)
local create ( local points, local count, local PHYSICSSHAPE_MATERIAL_DEFAULT, local ZERO)
static float calculateArea (const Vec2 *points, int count)
static float calculateMoment (float mass, const Vec2 *points, int count, const Vec2 &offset=Vec2::ZERO)
- Static Public Member Functions inherited from PhysicsShape
static void recenterPoints (Vec2 *points, int count, const Vec2 &center=Vec2::ZERO)
 move the points to the center More...
 
static Vec2 getPolyonCenter (const Vec2 *points, int count)
 get center of the polyon points More...
 
var getPolyonCenter ( var points, var count)
 get center of the polyon points More...
 
local getPolyonCenter ( local points, local count)
 get center of the polyon points More...
 

Protected Member Functions

bool init (const Vec2 *points, int count, const PhysicsMaterial &material=PHYSICSSHAPE_MATERIAL_DEFAULT, const Vec2 &offset=Vec2::ZERO)
local init ( local points, local count, local PHYSICSSHAPE_MATERIAL_DEFAULT, local ZERO)
float calculateArea () override
 calculate the area of this shape More...
 
local calculateArea ()
 calculate the area of this shape More...
 
virtual void update (float delta) override
local update ( local delta)
 PhysicsShapePolygon ()
 PhysicsShapePolygon ()
virtual ~PhysicsShapePolygon ()
local ~PhysicsShapePolygon ()
- Protected Member Functions inherited from PhysicsShape
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...
 
local bodyInfo ()
 PhysicsShape is PhysicsBody's friend class, but all the subclasses isn't. More...
 
void setBody (PhysicsBody *body)
virtual void setScale (float scale)
local setScale ( local scale)
virtual void setScale (float scaleX, float scaleY)
var setScale ( var scaleX, var scaleY)
local setScale ( local scaleX, local scaleY)
virtual void setScaleX (float scaleX)
local setScaleX ( local scaleX)
virtual void setScaleY (float scaleY)
var setScaleY ( var scaleY)
local setScaleY ( local scaleY)
 PhysicsShape ()
 PhysicsShape ()
virtual ~PhysicsShape ()=0
local ~PhysicsShape ()
- Protected Member Functions inherited from Ref
 Ref ()
 Constructor. More...
 

Additional Inherited Members

- Public Types inherited from PhysicsShape
enum  Type {
  UNKNOWN, CIRCLE, BOX, POLYGEN,
  EDGESEGMENT, EDGEBOX, EDGEPOLYGEN, EDGECHAIN
}
 
- Protected Attributes inherited from PhysicsShape
PhysicsBody_body
PhysicsShapeInfo_info
var _info
local _info
Type _type
var _type
local _type
float _area
var _area
local _area
float _mass
var _mass
local _mass
float _moment
var _moment
local _moment
float _scaleX
var _scaleX
local _scaleX
float _scaleY
var _scaleY
local _scaleY
float _newScaleX
var _newScaleX
local _newScaleX
float _newScaleY
var _newScaleY
local _newScaleY
bool _dirty
var _dirty
local _dirty
PhysicsMaterial _material
var _material
local _material
int _tag
var _tag
local _tag
int _categoryBitmask
var _categoryBitmask
local _categoryBitmask
int _collisionBitmask
local _collisionBitmask
int _contactTestBitmask
local _contactTestBitmask
int _group
local _group
- Protected Attributes inherited from Ref
unsigned int _referenceCount
 count of references More...
 

Detailed Description

A polygon shape.

Constructor & Destructor Documentation

PhysicsShapePolygon ( )
protected
local PhysicsShapePolygon ( )
protected
virtual ~PhysicsShapePolygon ( )
protectedvirtual
local ~PhysicsShapePolygon ( )
protectedvirtual

Member Function Documentation

static float calculateArea ( const Vec2 points,
int  count 
)
static
local calculateArea ( local  points,
local  count 
)
static
float calculateArea ( )
overrideprotectedvirtual

calculate the area of this shape

Reimplemented from PhysicsShape.

local calculateArea ( )
overrideprotectedvirtual

calculate the area of this shape

Reimplemented from PhysicsShape.

float calculateDefaultMoment ( )
overridevirtual

Calculate the default moment value.

Reimplemented from PhysicsShape.

local calculateDefaultMoment ( )
overridevirtual

Calculate the default moment value.

Reimplemented from PhysicsShape.

static float calculateMoment ( float  mass,
const Vec2 points,
int  count,
const Vec2 offset = Vec2::ZERO 
)
static
local calculateMoment ( local  mass,
local  points,
local  count,
local  offset = Vec2::ZERO 
)
static
static PhysicsShapePolygon* create ( const Vec2 points,
int  count,
const PhysicsMaterial material = PHYSICSSHAPE_MATERIAL_DEFAULT,
const Vec2 offset = Vec2::ZERO 
)
static
local create ( local  points,
local  count,
local  material = PHYSICSSHAPE_MATERIAL_DEFAULT,
local  offset = Vec2::ZERO 
)
static
virtual Vec2 getCenter ( )
overridevirtual

Get center of this shape.

Reimplemented from PhysicsShape.

local getCenter ( )
overridevirtual

Get center of this shape.

Reimplemented from PhysicsShape.

Vec2 getPoint ( int  i) const
local getPoint ( local  i)
void getPoints ( Vec2 outPoints) const
local getPoints ( local  outPoints)
int getPointsCount ( ) const
local getPointsCount ( )
bool init ( const Vec2 points,
int  count,
const PhysicsMaterial material = PHYSICSSHAPE_MATERIAL_DEFAULT,
const Vec2 offset = Vec2::ZERO 
)
protected
local init ( local  points,
local  count,
local  material = PHYSICSSHAPE_MATERIAL_DEFAULT,
local  offset = Vec2::ZERO 
)
protected
virtual void update ( float  delta)
overrideprotectedvirtual

Reimplemented from PhysicsShape.

local update ( local  delta)
overrideprotectedvirtual

Reimplemented from PhysicsShape.


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