2010-08-06 17:50:20 +08:00
|
|
|
#include "tests.h"
|
|
|
|
#include "controller.h"
|
2010-08-13 17:21:33 +08:00
|
|
|
#include "CCMenu.h"
|
2010-08-17 15:01:09 +08:00
|
|
|
#include "CCLabel.h"
|
2010-08-06 17:50:20 +08:00
|
|
|
#include "touch_dispatcher/CCTouchDispatcher.h"
|
|
|
|
|
|
|
|
TestController::TestController()
|
|
|
|
{
|
|
|
|
/**
|
2010-08-09 18:07:50 +08:00
|
|
|
@todo add menu items for all tests
|
2010-08-06 17:50:20 +08:00
|
|
|
*/
|
2010-08-17 15:01:09 +08:00
|
|
|
CCLabel* label = CCLabel::labelWithString("ActionsTest", "Arial", 22);
|
2010-08-13 17:21:33 +08:00
|
|
|
CCMenuItemLabel* pMenuItem = CCMenuItemLabel::itemWithLabel(label, this, menu_selector(TestController::menuCallback));
|
2010-08-06 17:50:20 +08:00
|
|
|
|
2010-08-13 17:21:33 +08:00
|
|
|
CCMenu* pMenu =CCMenu::menuWithItems(pMenuItem, NULL);
|
|
|
|
CGSize s = CCDirector::getSharedDirector()->getWinSize();
|
|
|
|
pMenu->setPosition( CGPointZero );
|
|
|
|
pMenuItem->setPosition( CGPointMake( s.width / 2, s.height / 2) );
|
2010-08-06 17:50:20 +08:00
|
|
|
|
2010-08-13 17:21:33 +08:00
|
|
|
addChild(pMenu, 1);
|
2010-08-06 17:50:20 +08:00
|
|
|
}
|
|
|
|
|
2010-08-13 17:21:33 +08:00
|
|
|
void TestController::menuCallback(NSObject * pSender)
|
2010-08-06 17:50:20 +08:00
|
|
|
{
|
|
|
|
TestScene* pScene = new ActionsTestScene();
|
|
|
|
|
|
|
|
pScene->runThisTest();
|
|
|
|
}
|