示例#1
0
void UIStaticText::Draw(const UIGeometricData &geometricData)
{
	textBlock->SetRectSize(size);
	textBlock->SetPosition(geometricData.position);
	textBlock->SetPivotPoint(geometricData.pivotPoint);
	PrepareSprite();
	textBlock->PreDraw();

    UIControl::Draw(geometricData);

    if(!FLOAT_EQUAL(shadowBg->GetDrawColor().a, 0.0f) && (!FLOAT_EQUAL(shadowOffset.dx, 0.0f) || !FLOAT_EQUAL(shadowOffset.dy, 0.0f)))
    {
		textBlock->Draw(GetShadowColor(), &shadowOffset);
        UIGeometricData shadowGeomData;
        shadowGeomData.position = shadowOffset;
        shadowGeomData.size = GetSize();
        shadowGeomData.AddToGeometricData(geometricData);

        shadowBg->SetAlign(textBg->GetAlign());
        shadowBg->SetPerPixelAccuracyType(background->GetPerPixelAccuracyType());
        shadowBg->Draw(shadowGeomData);
    }

    textBlock->Draw(GetTextColor());
    textBg->SetPerPixelAccuracyType(background->GetPerPixelAccuracyType());
    textBg->Draw(geometricData);
}
示例#2
0
void UIScreen::FillScreenBorders(const UIGeometricData &geometricData)
{
	RenderManager::Instance()->SetColor(0, 0, 0, 1.0f);
	UIGeometricData drawData;
	drawData.position = relativePosition;
	drawData.size = size;
	drawData.pivotPoint = pivotPoint;
	drawData.scale = scale;
	drawData.angle = angle;
	drawData.AddToGeometricData(geometricData);

	Rect drawRect = drawData.GetUnrotatedRect();
	if (Core::Instance()->GetVirtualScreenXMin() < 0)
	{
		RenderHelper::Instance()->FillRect(Rect(
													Core::Instance()->GetVirtualScreenXMin()
												 ,	0
												 ,	-Core::Instance()->GetVirtualScreenXMin()
												 ,	Core::Instance()->GetVirtualScreenHeight()));
		RenderHelper::Instance()->FillRect(Rect(
												 Core::Instance()->GetVirtualScreenWidth()
												 ,	0
												 ,	Core::Instance()->GetVirtualScreenXMax() - Core::Instance()->GetVirtualScreenWidth()
												 ,	Core::Instance()->GetVirtualScreenHeight()));
	}
	else 
	{
		RenderHelper::Instance()->FillRect(Rect(
													0
												 ,	Core::Instance()->GetVirtualScreenYMin()
												 ,	Core::Instance()->GetVirtualScreenWidth()+1
												 ,	-Core::Instance()->GetVirtualScreenYMin()));
		RenderHelper::Instance()->FillRect(Rect(
												 0
												 ,	Core::Instance()->GetVirtualScreenHeight()
												 ,	Core::Instance()->GetVirtualScreenWidth()+1
												 ,	Core::Instance()->GetVirtualScreenYMax() - Core::Instance()->GetVirtualScreenHeight()));
	}

	RenderManager::Instance()->ResetColor();
}
示例#3
0
void UIScrollView::SystemDraw(const UIGeometricData & geometricData)
{
	float32 invScale = 1.0f;// / zoomScale;
	Vector2 drawPos;
	drawPos.x = (scrollOrigin.x + drawScrollPos.x) * invScale;
	drawPos.y = (scrollOrigin.y + drawScrollPos.y) * invScale;
	
	//Logger::Debug("dp %f %f", drawPos.x, drawPos.y);
	
	//Rect2f currRect = r + _parentRect.GetPosition() + drawPos;

	UIGeometricData drawData;
	drawData.position = relativePosition;
	drawData.size = size;
	drawData.pivotPoint = pivotPoint;
	drawData.scale = scale;
	drawData.angle = angle;
	drawData.AddToGeometricData(geometricData);
	
	if(clipContents)
	{//WARNING: for now clip contents don't work for rotating controls if you have any ideas you are welcome
		RenderManager::Instance()->ClipPush();
		RenderManager::Instance()->ClipRect(drawData.GetUnrotatedRect());
	}
	
	
	if (debugDrawEnabled)
	{//TODO: Add debug draw for rotated controls
		RenderManager::Instance()->SetColor(1.0f, 0.0f, 0.0f, 1.0f);
		RenderHelper::Instance()->DrawRect(drawData.GetUnrotatedRect());
		RenderManager::Instance()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
	}
	
	
//	drawData.position = drawPos + relativePosition * invScale;
	drawData.position = drawPos + relativePosition;
	drawData.size = size;
	drawData.pivotPoint = pivotPoint;
//	drawData.scale = scale;
	drawData.scale = Vector2(zoomScale, zoomScale);
	drawData.angle = angle;
	drawData.AddToGeometricData(geometricData);

	
	if(visible)
	{
		Draw(drawData);
	}

	//isIteratorCorrupted = false;
	List<UIControl*>::iterator it = childs.begin();
	for(; it != childs.end(); it++)
	{
		(*it)->SystemDraw(drawData);
		//DVASSERT(!isIteratorCorrupted);
	}
	
	if(visible)
	{
		DrawAfterChilds(drawData);
	}
	if(clipContents)
	{
		RenderManager::Instance()->ClipPop();
	}
	
/*	if(clipContents)
	{
		RenderManager::ClipPush();
		RenderManager::ClipRect(relativeRect + _parentRect.GetPosition()); 
	}

	float32 invScale = 1.0f / zoomScale;
	Point2f drawPos;
	drawPos.x = (scrollOrigin.x + drawScrollPos.x) * invScale;
	drawPos.y = (scrollOrigin.y + drawScrollPos.y) * invScale;
	//Rect2f parentRect = _parentRect + drawPos;
	
	Rect2f r = relativeRect;
	r.x *= invScale;
	r.y *= invScale;
	Rect2f currRect = r + _parentRect.GetPosition() + drawPos;
	
	if(visible)
	{
		Draw(currRect);
	}
	
	List<UIControl*>::iterator it = childs.begin();
	for(; it != childs.end(); it++)
	{
		UIControl * c = *it;
		c->SystemDraw(currRect); 
	}
	if(visible)
	{
		DrawAfterChilds(currRect);
	}
	
	if(clipContents)
	{
		RenderManager::ClipPop();
	}
	*/
}