2011-07-08 11:22:35 +08:00
|
|
|
//
|
|
|
|
// Bug-458 test case by nedrafehi
|
|
|
|
// http://code.google.com/p/cocos2d-iphone/issues/detail?id=458
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "Bug-458.h"
|
|
|
|
#include "QuestionContainerSprite.h"
|
|
|
|
|
|
|
|
bool Bug458Layer::init()
|
|
|
|
{
|
|
|
|
if(BugsTestBaseLayer::init())
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
// ask director the the window size
|
2013-08-16 16:05:27 +08:00
|
|
|
auto size = Director::getInstance()->getWinSize();
|
2011-07-08 11:22:35 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto question = new QuestionContainerSprite();
|
|
|
|
auto question2 = new QuestionContainerSprite();
|
2011-07-08 11:22:35 +08:00
|
|
|
question->init();
|
|
|
|
question2->init();
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
// [question setContentSize:CGSizeMake(50,50)];
|
|
|
|
// [question2 setContentSize:CGSizeMake(50,50)];
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto sprite = MenuItemSprite::create(question2, question, CC_CALLBACK_1(Bug458Layer::selectAnswer, this) );
|
|
|
|
auto layer = LayerColor::create(Color4B(0,0,255,255), 100, 100);
|
2012-04-19 14:35:52 +08:00
|
|
|
question->release();
|
|
|
|
question2->release();
|
2011-07-08 11:22:35 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto layer2 = LayerColor::create(Color4B(255,0,0,255), 100, 100);
|
|
|
|
auto sprite2 = MenuItemSprite::create(layer, layer2, CC_CALLBACK_1(Bug458Layer::selectAnswer, this) );
|
|
|
|
auto menu = Menu::create(sprite, sprite2, NULL);
|
2011-07-08 11:22:35 +08:00
|
|
|
menu->alignItemsVerticallyWithPadding(100);
|
2013-07-12 14:11:55 +08:00
|
|
|
menu->setPosition(Point(size.width / 2, size.height / 2));
|
2011-07-08 11:22:35 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
// add the label as a child to this Layer
|
|
|
|
addChild(menu);
|
2011-07-08 11:22:35 +08:00
|
|
|
|
|
|
|
return true;
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
return false;
|
2011-07-08 11:22:35 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
void Bug458Layer::selectAnswer(Object* sender)
|
2011-07-08 11:22:35 +08:00
|
|
|
{
|
2013-07-24 06:20:22 +08:00
|
|
|
log("Selected");
|
2011-07-08 11:22:35 +08:00
|
|
|
}
|