2012-04-19 14:35:52 +08:00
|
|
|
#ifndef _BOX2D_TEST_H_
|
|
|
|
#define _BOX2D_TEST_H_
|
|
|
|
|
|
|
|
#include "cocos2d.h"
|
|
|
|
#include "Box2D/Box2D.h"
|
|
|
|
#include "../testBasic.h"
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class Box2DTestLayer : public Layer
|
2010-09-14 14:47:12 +08:00
|
|
|
{
|
2013-06-20 14:17:10 +08:00
|
|
|
Texture2D* _spriteTexture; // weak ref
|
2012-04-19 14:35:52 +08:00
|
|
|
b2World* world;
|
2013-06-15 14:03:30 +08:00
|
|
|
// GLESDebugDraw* _debugDraw;
|
2010-09-14 14:47:12 +08:00
|
|
|
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
Box2DTestLayer();
|
|
|
|
~Box2DTestLayer();
|
2010-09-14 14:47:12 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
void initPhysics();
|
|
|
|
void createResetButton();
|
|
|
|
virtual void draw();
|
2010-09-14 14:47:12 +08:00
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
void addNewSpriteAtPosition(Point p);
|
2012-06-08 13:55:28 +08:00
|
|
|
void update(float dt);
|
2013-06-20 14:17:10 +08:00
|
|
|
virtual void ccTouchesEnded(Set* touches, Event* event);
|
2010-09-14 14:47:12 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
//CREATE_NODE(Box2DTestLayer);
|
2010-09-14 14:47:12 +08:00
|
|
|
} ;
|
|
|
|
|
|
|
|
class Box2DTestScene : public TestScene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void runThisTest();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|