2012-04-19 14:35:52 +08:00
|
|
|
#ifndef _MENU_TEST_H_
|
|
|
|
#define _MENU_TEST_H_
|
|
|
|
|
|
|
|
////----#include "cocos2d.h"
|
|
|
|
#include "../testBasic.h"
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class MenuLayerMainMenu : public Layer
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
protected:
|
2013-06-20 14:17:10 +08:00
|
|
|
MenuItem* _disabledItem;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
MenuLayerMainMenu(void);
|
|
|
|
~MenuLayerMainMenu();
|
|
|
|
|
|
|
|
public:
|
2013-09-03 18:22:03 +08:00
|
|
|
virtual bool onTouchBegan(Touch *touch, Event * event);
|
|
|
|
virtual void onTouchEnded(Touch *touch, Event * event);
|
|
|
|
virtual void onTouchCancelled(Touch *touch, Event * event);
|
|
|
|
virtual void onTouchMoved(Touch *touch, Event * event);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-06-08 13:55:28 +08:00
|
|
|
void allowTouches(float dt);
|
2013-07-26 06:53:24 +08:00
|
|
|
void menuCallback(Object* sender);
|
|
|
|
void menuCallbackConfig(Object* sender);
|
|
|
|
void menuCallbackDisabled(Object* sender);
|
|
|
|
void menuCallback2(Object* sender);
|
|
|
|
void menuCallbackPriorityTest(Object* sender);
|
2013-06-20 14:17:10 +08:00
|
|
|
void menuCallbackBugsTest(Object *pSender);
|
2013-07-26 06:53:24 +08:00
|
|
|
void onQuit(Object* sender);
|
2013-06-20 14:17:10 +08:00
|
|
|
void menuMovingCallback(Object *pSender);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
//CREATE_NODE(MenuLayer1);
|
|
|
|
};
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class MenuLayer2 : public Layer
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
protected:
|
2013-06-20 14:17:10 +08:00
|
|
|
Point _centeredMenu;
|
2013-06-15 14:03:30 +08:00
|
|
|
bool _alignedH;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
void alignMenusH();
|
|
|
|
void alignMenusV();
|
|
|
|
|
|
|
|
public:
|
|
|
|
MenuLayer2(void);
|
|
|
|
~MenuLayer2();
|
|
|
|
|
|
|
|
public:
|
2013-07-26 06:53:24 +08:00
|
|
|
void menuCallback(Object* sender);
|
|
|
|
void menuCallbackOpacity(Object* sender);
|
|
|
|
void menuCallbackAlign(Object* sender);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
//CREATE_NODE(MenuLayer2);
|
|
|
|
};
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class MenuLayer3 : public Layer
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
protected:
|
2013-06-20 14:17:10 +08:00
|
|
|
MenuItem* _disabledItem;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
MenuLayer3(void);
|
|
|
|
~MenuLayer3();
|
|
|
|
|
|
|
|
//CREATE_NODE(MenuLayer3);
|
|
|
|
};
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class MenuLayer4 : public Layer
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
MenuLayer4(void);
|
|
|
|
~MenuLayer4();
|
|
|
|
|
|
|
|
public:
|
2013-07-26 06:53:24 +08:00
|
|
|
void menuCallback(Object* sender);
|
|
|
|
void backCallback(Object* sender);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
//CREATE_NODE(MenuLayer4);
|
|
|
|
};
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class MenuLayerPriorityTest : public Layer
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
MenuLayerPriorityTest();
|
|
|
|
~MenuLayerPriorityTest();
|
|
|
|
|
2013-07-26 06:53:24 +08:00
|
|
|
void menuCallback(Object* sender);
|
2012-04-19 14:35:52 +08:00
|
|
|
private:
|
2013-06-20 14:17:10 +08:00
|
|
|
Menu* _menu1;
|
|
|
|
Menu* _menu2;
|
2013-06-15 14:03:30 +08:00
|
|
|
bool _priority;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class BugsTest : public Layer
|
2012-11-19 13:57:54 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
BugsTest();
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
void issue1410MenuCallback(Object *pSender);
|
|
|
|
void issue1410v2MenuCallback(Object *pSender);
|
|
|
|
void backMenuCallback(Object *pSender);
|
2012-11-19 13:57:54 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class RemoveMenuItemWhenMove : public Layer
|
2013-01-17 15:04:48 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
RemoveMenuItemWhenMove();
|
|
|
|
~RemoveMenuItemWhenMove();
|
|
|
|
|
2013-09-03 18:22:03 +08:00
|
|
|
virtual void onRegisterTouchListener() override;
|
|
|
|
// virtual void registerWithTouchDispatcher(void);
|
|
|
|
virtual bool onTouchBegan(Touch *touch, Event *event);
|
|
|
|
virtual void onTouchMoved(Touch *touch, Event *event);
|
2013-01-17 15:04:48 +08:00
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
void goBack(Object *pSender);
|
2013-01-17 15:04:48 +08:00
|
|
|
|
|
|
|
private:
|
2013-06-20 14:17:10 +08:00
|
|
|
MenuItemFont *item;
|
2013-01-17 15:04:48 +08:00
|
|
|
};
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
class MenuTestScene : public TestScene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void runThisTest();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|