Exemplo n.º 1
0
void MenuSlider::Draw(MyMatrix* pMatProj, MyMatrix* pMatView)
{
    float centerx = m_PosX;
    float top = m_PosY;
    // TODO: take more justifications and vertical/horizontal into account for top and left.
    //       should ideally be done once instead of every frame.
    //if( m_Justification & Justify_Left )
    //{
    //    centerx += m_BarThickness/2;
    //}

    float emptypos = (m_PosY - m_VisualRange);

    MyAssert( m_pSprite );
    //m_pSprite = g_pGame->m_pResources->m_pSprites[SL_WhiteSquareResizable];

    if( m_pSprite )
    {
        BufferManager* pBufferManager = m_pGameCore->GetManagers()->GetBufferManager();
        m_pSprite->Create( pBufferManager, "MenuSlider", m_BarThickness, m_VisualRange, 0, 1, 0, 1, Justify_CenterX|Justify_Top );
        MyMatrix world;
        world.SetIdentity();
        world.SetTranslation( centerx, top, 0 );
        //FIX m_pSprite->SetTint( m_Colors[MSCT_BarColor] );
        m_pSprite->Draw( pMatProj, pMatView, &world ); //&g_pGame->m_OrthoMatrix );

        m_pSprite->Create( pBufferManager, "MenuSlider", m_HandleWidth, m_HandleHeight, 0, 1, 0, 1, Justify_CenterX|Justify_Top );
        world.SetTranslation( centerx, emptypos + m_ValuePerc*m_VisualRange, 0 );
        //FIX m_pSprite->SetTint( m_Colors[MSCT_HandleColor] );
        m_pSprite->Draw( pMatProj, pMatView, &world ); //&g_pGame->m_OrthoMatrix );
    }
}