Пример #1
0
//----------------------------------------------------------------------------
UIMenuItem *UIMenu::AddMainItem(const std::string &name,
								const std::string &title,
								const std::string &scriptFun)
{
	UIMenuItem *item = new0 UIMenuItem(name, title, scriptFun);
	item->SetBeMainItem(true);
	//UIPicBox *itemPicBox = item->CreateAddBackgroundPicBox();
	//itemPicBox->SetTexture("Data/engine/white.png");
	//itemPicBox->LocalTransform.SetTranslateY(-0.5f);
	item->LocalTransform.SetTranslateY(-1.0f);

	item->SetSize(mMainItemSize);
	item->SetAnchorHor(Float2(0.0f, 0.0f));
	item->SetAnchorVer(Float2(0.5f, 0.5f));
	item->SetPivot(0.5f, 0.5f);
	item->SetAnchorParamHor(Float2(mMainItemSize.Width/2.0f + mMainItemSize.Width*GetNunMainItems(), 0.0f));

	item->GetText()->SetFontWidthHeight(mItemFontSize, mItemFontSize);
	item->GetText()->SetFontScale(0.5f);
	item->GetText()->LocalTransform.SetTranslateY(-1.0f);

	mMainItemsMap[name] = item;
	mMainItemsVec.push_back(item);
	AttachChild(item);

	return item;
}
Пример #2
0
//----------------------------------------------------------------------------
UIMenuItem *UIMenu::AddMainItem(const std::string &name,
								const std::string &title,
								const std::string &scriptFun)
{
	UIMenuItem *item = new0 UIMenuItem(name, title, scriptFun);
	item->SetBeMainItem(true);
	item->LocalTransform.SetTranslateY(-1.0f);
	item->GetText()->GetText()->SetFontWidthHeight(mItemFontSize, mItemFontSize);
	item->GetText()->GetText()->SetFontScale(0.5f);
	item->GetText()->LocalTransform.SetTranslateY(-1.0f);

	mMainItemsMap[name] = item;
	mMainItemsVec.push_back(item);
	AttachChild(item);

	return item;
}