2013-09-20 22:23:13 +08:00
|
|
|
#ifndef __SCENEEDITORTESTSCENE_H__
|
|
|
|
#define __SCENEEDITORTESTSCENE_H__
|
|
|
|
|
|
|
|
#include "cocos2d.h"
|
2013-10-16 16:48:39 +08:00
|
|
|
#include "extensions/cocos-ext.h"
|
2013-09-20 22:23:13 +08:00
|
|
|
|
|
|
|
void runSceneEditorTestLayer();
|
|
|
|
|
2013-12-26 01:17:04 +08:00
|
|
|
class SceneEditorTestLayer : public cocos2d::Layer
|
2013-09-20 22:23:13 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
SceneEditorTestLayer();
|
|
|
|
~SceneEditorTestLayer();
|
|
|
|
|
|
|
|
// Here's a difference. Method 'init' in cocos2d-x returns bool,
|
|
|
|
// instead of returning 'id' in cocos2d-iphone
|
|
|
|
virtual bool init();
|
2013-12-26 01:17:04 +08:00
|
|
|
|
|
|
|
// callback of Scene Enter
|
|
|
|
virtual void onEnter();
|
|
|
|
|
|
|
|
// callback of Scene Exit
|
|
|
|
virtual void onExit();
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
// there's no 'id' in cpp, so we recommand to return the exactly class pointer
|
|
|
|
static cocos2d::Scene* scene();
|
|
|
|
|
|
|
|
// implement the "static node()" method manually
|
|
|
|
CREATE_FUNC(SceneEditorTestLayer);
|
|
|
|
|
|
|
|
// init scene
|
|
|
|
cocos2d::Node* createGameScene();
|
|
|
|
|
|
|
|
//back to Extensions Main Layer
|
|
|
|
void toExtensionsMainLayer(cocos2d::Object *sender);
|
|
|
|
|
|
|
|
private:
|
|
|
|
cocos2d::Node *_curNode;
|
2013-12-26 01:17:04 +08:00
|
|
|
cocos2d::EventListener* _touchListener;
|
2013-09-20 22:23:13 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __HELLOWORLD_SCENE_H__
|