Esempio n. 1
0
void MainLayer::onEnter()
{
	CCLog("MainLayer::onEnter()");
	CCLayer::onEnter();

	doFloatAction();
	doBlinkAction();

	CCSize s = CCDirector::sharedDirector()->getVisibleSize();
	float scalef = s.height/DESIGN_HEIGHT;

	UILabelBMFont *titleLabel = dynamic_cast<UILabelBMFont *>(m_uiLayer->getWidgetByName("titleLabel"));
	if (titleLabel) {
		titleLabel->setPositionY(titleLabel->getPositionY() * scalef);
	}

	UILabelBMFont *cherryLabel = dynamic_cast<UILabelBMFont *>(m_uiLayer->getWidgetByName("cherryLabel"));
	if (cherryLabel) {
		cherryLabel->setPositionY(cherryLabel->getPositionY() * scalef);
	}

	UIImageView *cherryIcon = dynamic_cast<UIImageView *>(m_uiLayer->getWidgetByName("cherryIcon"));
	if (cherryIcon) {
		cherryIcon->setPositionY(cherryIcon->getPositionY() * scalef);
	}
}
Esempio n. 2
0
bool LayerGameChan_KetQua::init(){
	if (!CCLayer::init())
	{
		return false;
	}

	this->setAnchorPoint(ccp(0,0));
	this->setPosition(ccp(0,0));

	resuiltKQ = UILayer::create();
	resuiltKQ->setAnchorPoint(ccp(0,0));
	resuiltKQ->setPosition(ccp(0,0));
	this->addChild(resuiltKQ);

	img = UIImageView::create();
	img->loadTexture("frame_thongbao.png");
	img->setPosition(ccp(WIDTH_DESIGN / 2, HEIGHT_DESIGN / 2));
	resuiltKQ->addWidget(img);

	btnClose = UIButton::create();
	btnClose->loadTextures("btnChanClose.png","btnChanClose_press.png","");
	btnClose->setPosition(ccp(WIDTH_DESIGN / 2, img->getPositionY() - img->getContentSize().height / 2));

	UILabelBMFont *title = UILabelBMFont::create();
	title->setFntFile("tttt.fnt");
	title->setText("Đóng");
	title->setColor(ccWHITE);
	title->setScale(0.7);
	title->setPositionY(5.0);
	btnClose->addChild(title);

	btnClose->setEnabled(true);
	btnClose->addTouchEventListener(this, toucheventselector(LayerGameChan_KetQua::btnClose_LayerResuilt));
	resuiltKQ->addWidget(btnClose);

	return true;
}