função:
void Gradient(float x,float y,float w,float h,DWORD colorStart,DWORD colorEnd, gr_orientation orientation,LPDIRECT3DDEVICE9 pDevice){
struct D3DVERTEX{float x,y,z,rhw; DWORD color;}
vertices[4] = {{0,0,0,1.0f,0},{0,0,0,1.0f,0},{0,0,0,1.0f,0},{0,0 ,0,1.0f,0}};
vertices[0].x = x;
vertices[0].y = y;
vertices[0].color = colorStart;
vertices[1].x = x+w;
vertices[1].y = y;
vertices[1].color = orientation == vertical ? colorEnd:colorStart;
vertices[2].x = x;
vertices[2].y = y+h;
vertices[2].color = orientation == vertical ? colorStart:colorEnd;
vertices[3].x = x+w;
vertices[3].y = y+h;
vertices[3].color = colorEnd;
pDevice->SetTexture(0, NULL);
pDevice->SetRenderState(D3DRS_ALPHATESTENABLE, true);
pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,true);
pDevice->SetRenderState(D3DRS_ALPHAFUNC,D3DCMP_GREATEREQUA L);
pDevice->SetRenderState(D3DRS_ALPHAREF,(DWORD)8);
pDevice->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1);
pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2,vertices,si zeof(D3DVERTEX));
}
em qualquer lugar declare:
enum gr_orientation {
horizontal,
vertical
};
dps se usa ele assim:
Gradient(menuX-10, menuY-35, 140, 20, mGray, mBlack, gr_orientation::horizontal, pDevice ); //só muda as posições como vc quer
créditos luccss tirei da base dele...