コード例 #1
0
//---------------Interfaz de CGuiElement----------------------
void CProgressBar::Render  ()
{
    if( GetVisible())
    {
        if (m_pBackgroundTexture)
        {
            //TODO RAUL
            GraphicsInstance->DrawQuad2D(CGuiElement::m_Position, CGuiElement::m_uWidth, CGuiElement::m_uHeight,
                                         CGraphicsManager::UPPER_LEFT, m_pBackgroundTexture);
        }
        else
        {
           /* GraphicsInstance->DrawQuad2D(CGuiElement::m_Position, CGuiElement::m_uWidth, CGuiElement::m_uHeight,
                                         CGraphicsManager::UPPER_LEFT, m_BackGroundColor);*/
        }


        Math::Vect2i posProgress(  (uint32)(CGuiElement::m_Position.x - (uint32)CGuiElement::m_uWidth  * 0.05f),
                                   (uint32)(CGuiElement::m_Position.y - (uint32)CGuiElement::m_uHeight * 0.2f));

        uint32 w = (uint32)(CGuiElement::m_uWidth);
        uint32 h = (uint32)(CGuiElement::m_uHeight * (m_fProgress * 0.01f));
        if (m_pProgressTexture)
        {
            //TODO RAUL
			GraphicsInstance->DrawQuad2D(CGuiElement::m_Position, w, h, CGraphicsManager::LOWER_RIGHT, m_pProgressTexture);
        }
        else
        {
            GraphicsInstance->DrawQuad2D(posProgress, w, h, CGraphicsManager::UPPER_LEFT, m_ProgressColor);
        }
       /* Math::Vect2i pos;
        pos.x = (uint32)(CGuiElement::m_Position.x + 0.4f * m_uWidth);
        pos.y = (uint32)(CGuiElement::m_Position.y + 0.2f * m_uHeight);
        FontInstance->DrawText(pos.x, pos.y, m_TextColor, m_uFontID, m_sText.c_str());*/

        //Finalmente renderizamos el texto:
        CGuiElement::RenderText();
    }
}
コード例 #2
0
//---------------Interfaz de CGuiElement----------------------
void CProgressBar::Render	(CRenderManager *renderManager, CFontManager* fm)
{
	if( CGuiElement::m_bIsVisible)
	{
		if (m_pBackgroundTexture)
		{
			renderManager->DrawTexturedQuad2D(CGuiElement::m_Position,CGuiElement::m_uWidth,CGuiElement::m_uHeight, UPPER_LEFT, m_pBackgroundTexture);
		}
		else
		{
			renderManager->DrawQuad2D(CGuiElement::m_Position,CGuiElement::m_uWidth,CGuiElement::m_uHeight, UPPER_LEFT, m_BackGroundColor);
		}
		
		
		Vect2i posProgress(	(uint32)(CGuiElement::m_Position.x + (uint32)CGuiElement::m_uWidth*0.05f),
												(uint32)(CGuiElement::m_Position.y + (uint32)CGuiElement::m_uHeight*0.2f));
		
		uint32 h = (uint32)(CGuiElement::m_uHeight*0.6f);
		uint32 w = (uint32)(CGuiElement::m_uWidth*0.9f*(m_fProgress*0.01f));
		if (m_pProgressTexture)
		{
			renderManager->DrawTexturedQuad2D(posProgress,w,h, UPPER_LEFT, m_pProgressTexture);
		}
		else
		{
			renderManager->DrawQuad2D(posProgress,w,h, UPPER_LEFT, m_ProgressColor);
		}
		Vect2i pos;
		pos.x = (uint32)(CGuiElement::m_Position.x+0.4f*m_uWidth);
		pos.y = (uint32)(CGuiElement::m_Position.y+ 0.2f*m_uHeight);
		fm->DrawText(pos.x, pos.y, m_TextColor, m_uFontID, m_sText.c_str());

		//Finalmente renderizamos el texto:
		CGuiElement::RenderText(renderManager, fm);	
	}
}