cocos2d-x  3.0-alpha0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PhysicsWorld Class Reference

An PhysicsWorld object simulates collisions and other physical properties. More...

#include <CCPhysicsWorld.h>

Public Member Functions

void addJoint (PhysicsJoint *joint)
 Adds a joint to the physics world. More...
 
local addJoint ( local joint)
 Adds a joint to the physics world. More...
 
void removeJoint (PhysicsJoint *joint)
 Removes a joint from the physics world. More...
 
void removeAllJoints ()
 Remove all joints from the physics world. More...
 
ArraygetBodysAlongRay (Point start, Point end) const
local getBodysAlongRay ( local start, local end)
ArraygetBodysAtPoint (Point point) const
ArraygetBodysInRect (Rect rect) const
local getBodysInRect ( local rect)
ArraygetAllBody () const
void registerContactListener (PhysicsContactListener *delegate)
 Register a listener to receive contact callbacks. More...
 
var registerContactListener ( var delegate)
 Register a listener to receive contact callbacks. More...
 
local registerContactListener ( local delegate)
 Register a listener to receive contact callbacks. More...
 
void unregisterContactListener ()
 Unregister a listener. More...
 
Point getGravity ()
 get the gravity value More...
 
void setGravity (Point gravity)
 set the gravity value More...
 
bool isDebugDraw ()
 test the debug draw is enabled More...
 
void setDebugDraw (bool debugDraw)
 set the debug draw More...
 

Protected Member Functions

bool init ()
void setScene (Scene *scene)
local setScene ( local scene)
virtual void addChild (PhysicsBody *body)
local addChild ( local body)
virtual void addShape (PhysicsShape *shape)
local addShape ( local shape)
virtual void update (float delta)
virtual void debugDraw ()
var debugDraw ()
local debugDraw ()
virtual void drawWithShape (DrawNode *node, PhysicsShape *shape)
virtual int collisionBeginCallback (const PhysicsContact &contact)
local collisionBeginCallback ( local contact)
virtual int collisionPreSolveCallback (const PhysicsContact &contact, const PhysicsContactPreSolve &solve)
local collisionPreSolveCallback ( local contact, local solve)
virtual void collisionPostSolveCallback (const PhysicsContact &contact, const PhysicsContactPostSolve &solve)
local collisionPostSolveCallback ( local contact, local solve)
virtual void collisionSeparateCallback (const PhysicsContact &contact)
 PhysicsWorld ()
virtual ~PhysicsWorld ()

Static Protected Member Functions

static PhysicsWorldcreate ()
static int collisionBeginCallbackFunc (cpArbiter *arb, struct cpSpace *space, void *data)
var collisionBeginCallbackFunc ( var arb, var space, var data)
local collisionBeginCallbackFunc ( local arb, local space, local data)
static int collisionPreSolveCallbackFunc (cpArbiter *arb, cpSpace *space, void *data)
static void collisionPostSolveCallbackFunc (cpArbiter *arb, cpSpace *space, void *data)
var collisionPostSolveCallbackFunc ( var arb, var space, var data)
local collisionPostSolveCallbackFunc ( local arb, local space, local data)
static void collisionSeparateCallbackFunc (cpArbiter *arb, cpSpace *space, void *data)

Protected Attributes

Point _gravity
float _speed
var _speed
local _speed
PhysicsWorldInfo_info
var _info
local _info
PhysicsContactListener_listener
var _listener
local _listener
Array_bodys
Scene_scene
bool _debugDraw
DrawNode_drawNode
var _drawNode
local _drawNode

Friends

class Sprite
class Scene
class PhysicsBody

Detailed Description

An PhysicsWorld object simulates collisions and other physical properties.

You do not create PhysicsWorld objects directly; instead, you can get it from an Scene object.

Constructor & Destructor Documentation

PhysicsWorld ( )
protected
var PhysicsWorld ( )
protected
local PhysicsWorld ( )
protected
virtual ~PhysicsWorld ( )
protectedvirtual
var ~PhysicsWorld ( )
protectedvirtual
local ~PhysicsWorld ( )
protectedvirtual

Member Function Documentation

virtual void addChild ( PhysicsBody body)
protectedvirtual
var addChild ( var  body)
protectedvirtual
local addChild ( local  body)
protectedvirtual
void addJoint ( PhysicsJoint joint)

Adds a joint to the physics world.

var addJoint ( var  joint)

Adds a joint to the physics world.

local addJoint ( local  joint)

Adds a joint to the physics world.

virtual void addShape ( PhysicsShape shape)
protectedvirtual
var addShape ( var  shape)
protectedvirtual
local addShape ( local  shape)
protectedvirtual
virtual int collisionBeginCallback ( const PhysicsContact contact)
protectedvirtual
var collisionBeginCallback ( var  contact)
protectedvirtual
local collisionBeginCallback ( local  contact)
protectedvirtual
static int
collisionBeginCallbackFunc
( cpArbiter arb,
struct cpSpace space,
void *  data 
)
staticprotected
var collisionBeginCallbackFunc ( var  arb,
var  space,
var  data 
)
staticprotected
local collisionBeginCallbackFunc ( local  arb,
local  space,
local  data 
)
staticprotected
virtual void
collisionPostSolveCallback
( const PhysicsContact contact,
const PhysicsContactPostSolve solve 
)
protectedvirtual
var collisionPostSolveCallback ( var  contact,
var  solve 
)
protectedvirtual
local collisionPostSolveCallback ( local  contact,
local  solve 
)
protectedvirtual
static void
collisionPostSolveCallbackFunc
( cpArbiter arb,
cpSpace space,
void *  data 
)
staticprotected
var collisionPostSolveCallbackFunc ( var  arb,
var  space,
var  data 
)
staticprotected
local
collisionPostSolveCallbackFunc
( local  arb,
local  space,
local  data 
)
staticprotected
virtual int
collisionPreSolveCallback
( const PhysicsContact contact,
const PhysicsContactPreSolve solve 
)
protectedvirtual
var collisionPreSolveCallback ( var  contact,
var  solve 
)
protectedvirtual
local collisionPreSolveCallback ( local  contact,
local  solve 
)
protectedvirtual
static int
collisionPreSolveCallbackFunc
( cpArbiter arb,
cpSpace space,
void *  data 
)
staticprotected
var collisionPreSolveCallbackFunc ( var  arb,
var  space,
var  data 
)
staticprotected
local collisionPreSolveCallbackFunc ( local  arb,
local  space,
local  data 
)
staticprotected
virtual void
collisionSeparateCallback
( const PhysicsContact contact)
protectedvirtual
var collisionSeparateCallback ( var  contact)
protectedvirtual
local collisionSeparateCallback ( local  contact)
protectedvirtual
static void
collisionSeparateCallbackFunc
( cpArbiter arb,
cpSpace space,
void *  data 
)
staticprotected
var collisionSeparateCallbackFunc ( var  arb,
var  space,
var  data 
)
staticprotected
local collisionSeparateCallbackFunc ( local  arb,
local  space,
local  data 
)
staticprotected
static PhysicsWorld* create ( )
staticprotected
var create ( )
staticprotected
local create ( )
staticprotected
virtual void debugDraw ( )
protectedvirtual
var debugDraw ( )
protectedvirtual
local debugDraw ( )
protectedvirtual
virtual void drawWithShape ( DrawNode node,
PhysicsShape shape 
)
protectedvirtual
var drawWithShape ( var  node,
var  shape 
)
protectedvirtual
local drawWithShape ( local  node,
local  shape 
)
protectedvirtual
Array* getAllBody ( ) const
var getAllBody ( )
local getAllBody ( )
Array* getBodysAlongRay ( Point  start,
Point  end 
) const
var getBodysAlongRay ( var  start,
var  end 
)
local getBodysAlongRay ( local  start,
local  end 
)
Array* getBodysAtPoint ( Point  point) const
var getBodysAtPoint ( var  point)
local getBodysAtPoint ( local  point)
Array* getBodysInRect ( Rect  rect) const
var getBodysInRect ( var  rect)
local getBodysInRect ( local  rect)
Point getGravity ( )
inline

get the gravity value

var getGravity ( )
inline

get the gravity value

local getGravity ( )
inline

get the gravity value

bool init ( )
protected
var init ( )
protected
local init ( )
protected
bool isDebugDraw ( )
inline

test the debug draw is enabled

var isDebugDraw ( )
inline

test the debug draw is enabled

local isDebugDraw ( )
inline

test the debug draw is enabled

void registerContactListener ( PhysicsContactListener delegate)
inline

Register a listener to receive contact callbacks.

var registerContactListener ( var  delegate)
inline

Register a listener to receive contact callbacks.

local registerContactListener ( local  delegate)
inline

Register a listener to receive contact callbacks.

void removeAllJoints ( )

Remove all joints from the physics world.

var removeAllJoints ( )

Remove all joints from the physics world.

local removeAllJoints ( )

Remove all joints from the physics world.

void removeJoint ( PhysicsJoint joint)

Removes a joint from the physics world.

var removeJoint ( var  joint)

Removes a joint from the physics world.

local removeJoint ( local  joint)

Removes a joint from the physics world.

void setDebugDraw ( bool  debugDraw)
inline

set the debug draw

var setDebugDraw ( var  debugDraw)
inline

set the debug draw

local setDebugDraw ( local  debugDraw)
inline

set the debug draw

void setGravity ( Point  gravity)

set the gravity value

var setGravity ( var  gravity)

set the gravity value

local setGravity ( local  gravity)

set the gravity value

void setScene ( Scene scene)
protected
var setScene ( var  scene)
protected
local setScene ( local  scene)
protected
void unregisterContactListener ( )
inline

Unregister a listener.

var unregisterContactListener ( )
inline

Unregister a listener.

local unregisterContactListener ( )
inline

Unregister a listener.

virtual void update ( float  delta)
protectedvirtual
var update ( var  delta)
protectedvirtual
local update ( local  delta)
protectedvirtual

Friends And Related Function Documentation

friend class PhysicsBody
friend
var PhysicsBody
friend
local PhysicsBody
friend
friend class Scene
friend
var Scene
friend
local Scene
friend
friend class Sprite
friend
var Sprite
friend
local Sprite
friend

Member Data Documentation

Array* _bodys
protected
var _bodys
protected
local _bodys
protected
bool _debugDraw
protected
var _debugDraw
protected
local _debugDraw
protected
DrawNode* _drawNode
protected
var _drawNode
protected
local _drawNode
protected
Point _gravity
protected
var _gravity
protected
local _gravity
protected
PhysicsWorldInfo* _info
protected
var _info
protected
local _info
protected
PhysicsContactListener* _listener
protected
var _listener
protected
local _listener
protected
Scene* _scene
protected
var _scene
protected
local _scene
protected
float _speed
protected
var _speed
protected
local _speed
protected

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