axmol/samples/Cpp/TestCpp/Classes/PhysicsTest/PhysicsTest.h

82 lines
1.6 KiB
C
Raw Normal View History

#ifndef _PHYSICS_TEST_H_
#define _PHYSICS_TEST_H_
#include "cocos2d.h"
#include "../testBasic.h"
2013-09-29 15:09:53 +08:00
#include "../BaseTest.h"
2013-09-29 15:09:53 +08:00
class PhysicsTestScene : public TestScene
{
public:
virtual bool initTest() override;
virtual void runThisTest();
2013-10-09 17:53:12 +08:00
void toggleDebug();
private:
static bool _debugDraw;
};
2013-09-29 15:09:53 +08:00
class PhysicsDemo : public BaseTest
{
2013-09-29 15:09:53 +08:00
protected:
2013-10-09 17:53:12 +08:00
PhysicsTestScene* _scene;
public:
2013-09-29 15:09:53 +08:00
PhysicsDemo();
virtual ~PhysicsDemo();
virtual void onEnter() override;
virtual std::string title() override;
virtual std::string subtitle() override;
2013-09-29 15:09:53 +08:00
void restartCallback(Object* sender);
void nextCallback(Object* sender);
void backCallback(Object* sender);
void toggleDebugCallback(Object* sender);
2013-10-09 17:53:12 +08:00
void addGrossiniAtPosition(Point p, float scale = 1.0);
private:
Texture2D* _spriteTexture; // weak ref
2013-09-29 15:09:53 +08:00
};
class PhysicsDemoClickAdd : public PhysicsDemo
{
public:
void onEnter() override;
std::string subtitle() override;
2013-09-29 15:09:53 +08:00
void onTouchesEnded(const std::vector<Touch*>& touches, Event* event) override;
void onAcceleration(Acceleration* acc, Event* event) override;
2013-09-29 15:09:53 +08:00
};
class PhysicsDemoLogoSmash : public PhysicsDemo
{
public:
void onEnter() override;
std::string title() override;
Node* makeBall(float x, float y);
private:
SpriteBatchNode* _ball;
2013-10-09 17:53:12 +08:00
};
class PhysicsDemoPyramidStack : public PhysicsDemo
{
public:
void onEnter() override;
std::string title() override;
};
class PhysicsDemoPlink : public PhysicsDemo
{
public:
void onEnter() override;
std::string title() override;
};
#endif