コード例 #1
0
ファイル: TuiManager.cpp プロジェクト: Kudoo/Tui-x
CLabel* TuiManager::createLabel(float tag, const char* text, const char* font, int alignment, float fontSize, int r, int g, int b, float x, float y, float w, float h,
							int r2,int g2,int b2,float strokeSize,int shadowDistance,float shadowBlur,float rotation)
{
	CLabel *pLabel = CLabel::createWithTTF(text,font,fontSize);

	if(shadowDistance != 0){
		pLabel->setTextColor(Color4B(r,g,b,255));
		pLabel->enableShadow(Color4B(r2,g2,b2,255),Size(shadowDistance,shadowDistance),shadowBlur);
	}
	if(strokeSize != 0){
		pLabel->setTextColor(Color4B(r,g,b,255));
		pLabel->enableOutline(Color4B(r2,g2,b2,255),strokeSize);
	}
	if(shadowDistance == 0 && strokeSize == 0){
		pLabel->setColor(Color3B(r,g,b));
	}
	pLabel->setAlignment((TextHAlignment)alignment);
	pLabel->setDimensions(w,h);
	pLabel->setRotation(rotation);
	pLabel->setPosition(Point(x+w/2,-(y + h/2)));
	pLabel->setTag(tag);
	return pLabel;
}