axmol/tests/cpp-tests/Classes/Box2DTest/Box2dTest.h

41 lines
840 B
C
Raw Normal View History

#ifndef _BOX2D_TEST_H_
#define _BOX2D_TEST_H_
#include "cocos2d.h"
#include "Box2D/Box2D.h"
#include "../testBasic.h"
class Box2DTestLayer : public Layer
{
Texture2D* _spriteTexture; // weak ref
b2World* world;
// GLESDebugDraw* _debugDraw;
public:
Box2DTestLayer();
~Box2DTestLayer();
void initPhysics();
void createResetButton();
2014-04-08 22:07:35 +08:00
virtual void draw(Renderer *renderer, const Matrix &transform, bool transformUpdated) override;
void addNewSpriteAtPosition(Vector2 p);
2012-06-08 13:55:28 +08:00
void update(float dt);
void onTouchesEnded(const std::vector<Touch*>& touches, Event* event);
2013-12-25 10:54:31 +08:00
#if CC_ENABLE_BOX2D_INTEGRATION
protected:
2014-04-10 10:16:16 +08:00
Matrix _modelViewMV;
2013-12-25 10:54:31 +08:00
void onDraw();
CustomCommand _customCommand;
2013-12-25 10:54:31 +08:00
#endif
} ;
class Box2DTestScene : public TestScene
{
public:
virtual void runThisTest();
};
#endif