Example #1
0
//---------------------------------------------------------------------
//	RenderAsOffset
//---------------------------------------------------------------------
void CSkinHighlightBar::RenderAtRect( LPDIRECT3DDEVICE8 displayDevice, 
																			FLOAT left, 
																			FLOAT top, 
																			FLOAT right, 
																			FLOAT bottom ) const
{
  displayDevice->SetRenderState( D3DRS_ALPHABLENDENABLE,    TRUE );
  displayDevice->SetRenderState( D3DRS_SRCBLEND,            D3DBLEND_SRCALPHA );
  displayDevice->SetRenderState( D3DRS_DESTBLEND,           D3DBLEND_INVSRCALPHA );
  displayDevice->SetVertexShader( D3DFVF_XYZRHW | D3DFVF_DIFFUSE );
  displayDevice->SetTexture( 0, NULL );

  displayDevice->Begin( D3DPT_QUADLIST );
    displayDevice->SetVertexDataColor( D3DVSDE_DIFFUSE, m_cornerColors[0] );
    displayDevice->SetVertexData4f( D3DVSDE_VERTEX, left, top, 1.0f, 1.0f );
    
    displayDevice->SetVertexDataColor( D3DVSDE_DIFFUSE, m_cornerColors[1] );
    displayDevice->SetVertexData4f( D3DVSDE_VERTEX, right, top, 1.0f, 1.0f );
    
    displayDevice->SetVertexDataColor( D3DVSDE_DIFFUSE, m_cornerColors[2] );
    displayDevice->SetVertexData4f( D3DVSDE_VERTEX, right, bottom, 1.0f, 1.0f );

    displayDevice->SetVertexDataColor( D3DVSDE_DIFFUSE, m_cornerColors[3] );
    displayDevice->SetVertexData4f( D3DVSDE_VERTEX, left, bottom, 1.0f, 1.0f );
  displayDevice->End();
}