axmol/samples/Cpp/TestCpp/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.h

203 lines
4.3 KiB
C
Raw Normal View History

2013-09-20 22:23:13 +08:00
#ifndef __SCENEEDITORTESTSCENE_H__
#define __SCENEEDITORTESTSCENE_H__
#include "cocos2d.h"
#include "extensions/cocos-ext.h"
2013-09-20 22:23:13 +08:00
class SceneEditorTestScene : public TestScene
{
public:
SceneEditorTestScene(bool bPortrait = false);
virtual void runThisTest();
// The CallBack for back to the main menu scene
virtual void MainMenuCallback(cocos2d::Object* pSender);
};
enum {
TEST_LOADSCENEEDITORFILE = 0,
TEST_SPIRTECOMPONENT,
TEST_ARMATURECOMPONENT,
TEST_UICOMPONENT,
TEST_TMXMAPCOMPONENT,
TEST_PARTICLECOMPONENT,
TEST_EFEECTCOMPONENT,
TEST_BACKGROUNDCOMPONENT,
TEST_ATTRIBUTECOMPONENT,
TEST_TRIGGER,
TEST_SCENEEDITOR_COUNT
};
2013-09-20 22:23:13 +08:00
2013-12-26 01:17:04 +08:00
class SceneEditorTestLayer : public cocos2d::Layer
2013-09-20 22:23:13 +08:00
{
public:
2013-12-26 01:17:04 +08:00
virtual void onEnter();
virtual void onExit();
virtual std::string title();
virtual std::string subtitle();
virtual void restartCallback(cocos2d::Object* pSender);
virtual void nextCallback(cocos2d::Object* pSender);
virtual void backCallback(cocos2d::Object* pSender);
virtual void draw();
protected:
MenuItemImage *restartItem;
MenuItemImage *nextItem;
MenuItemImage *backItem;
};
class loadSceneEdtiorFileTest : public SceneEditorTestLayer
{
public:
loadSceneEdtiorFileTest();
~loadSceneEdtiorFileTest();
virtual std::string title();
virtual void onEnter();
virtual void onExit();
cocos2d::Node* createGameScene();
};
class SpriteComponentTest : public SceneEditorTestLayer
{
public:
SpriteComponentTest();
~SpriteComponentTest();
virtual std::string title();
virtual void onEnter();
virtual void onExit();
cocos2d::Node* createGameScene();
};
class ArmatureComponentTest : public SceneEditorTestLayer
{
public:
ArmatureComponentTest();
~ArmatureComponentTest();
virtual std::string title();
virtual void onEnter();
virtual void onExit();
cocos2d::Node* createGameScene();
};
class UIComponentTest : public SceneEditorTestLayer
{
public:
UIComponentTest();
~UIComponentTest();
virtual std::string title();
virtual void onEnter();
virtual void onExit();
cocos2d::Node* createGameScene();
void touchEvent(cocos2d::Object *pSender, cocos2d::gui::TouchEventType type);
private:
cocos2d::Node* _node;
};
class TmxMapComponentTest : public SceneEditorTestLayer
{
public:
TmxMapComponentTest();
~TmxMapComponentTest();
virtual std::string title();
virtual void onEnter();
virtual void onExit();
cocos2d::Node* createGameScene();
};
class ParticleComponentTest : public SceneEditorTestLayer
{
public:
ParticleComponentTest();
~ParticleComponentTest();
virtual std::string title();
virtual void onEnter();
virtual void onExit();
cocos2d::Node* createGameScene();
};
class EffectComponentTest : public SceneEditorTestLayer
{
public:
EffectComponentTest();
~EffectComponentTest();
virtual std::string title();
virtual void onEnter();
virtual void onExit();
cocos2d::Node* createGameScene();
void animationEvent(cocostudio::Armature *armature, cocostudio::MovementEventType movementType, const std::string& movementID);
private:
cocos2d::Node* _node;
};
class BackgroundComponentTest : public SceneEditorTestLayer
{
public:
BackgroundComponentTest();
~BackgroundComponentTest();
virtual std::string title();
virtual void onEnter();
virtual void onExit();
cocos2d::Node* createGameScene();
};
class AttributeComponentTest : public SceneEditorTestLayer
{
public:
AttributeComponentTest();
~AttributeComponentTest();
virtual std::string title();
virtual void onEnter();
virtual void onExit();
bool initData();
cocos2d::Node* createGameScene();
private:
cocos2d::Node* _node;
};
class TriggerTest : public SceneEditorTestLayer
{
public:
TriggerTest();
~TriggerTest();
virtual std::string title();
virtual bool init();
virtual void onEnter();
virtual void onExit();
2013-12-26 01:17:04 +08:00
// default implements are used to call script callback if exist
virtual bool onTouchBegan(Touch *touch, Event *unused_event);
virtual void onTouchMoved(Touch *touch, Event *unused_event);
virtual void onTouchEnded(Touch *touch, Event *unused_event);
virtual void onTouchCancelled(Touch *touch, Event *unused_event);
// update of game
void gameLogic(float dt);
2013-09-20 22:23:13 +08:00
// create scene
2013-09-20 22:23:13 +08:00
cocos2d::Node* createGameScene();
2013-09-20 22:23:13 +08:00
private:
cocos2d::Node *_node;
2013-12-26 01:17:04 +08:00
cocos2d::EventListener* _touchListener;
2013-09-20 22:23:13 +08:00
};
#endif // __HELLOWORLD_SCENE_H__