Code:
VOID Efeito_Degrade( float x, float y, float w, float h, DWORD IniciaCor, DWORD FimCor, Gr_Orientation Orientation, LPDIRECT3DDEVICE9 pDevice){//Modificado para funcionar(Aparecer) em todos Computadores by Kssiobr/oO>Kssio<Oo™
extern enum Gr_Orientation;
const DWORD D3DGRADE_ALLCOMPUTER = 0x004 | 0x040;
struct D3DVERTEX{ float x, y, z, rhw; DWORD COR; }
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].COR = IniciaCor;
vertices[1].x = x + w;
vertices[1].y = y;
vertices[1].COR = Orientation == vertical ? FimCor:IniciaCor;
vertices[2].x = x;
vertices[2].y = y + h;
vertices[2].COR = Orientation == vertical ? IniciaCor:FimCor;
vertices[3].x = x + w;
vertices[3].y = y + h;
vertices[3].COR = FimCor;
pDevice->SetTexture(false, false);
pDevice->SetRenderState(D3DRS_ALPHATESTENABLE, true);
pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,true);
pDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL);
pDevice->SetRenderState(D3DRS_ALPHAREF,(DWORD)8);
pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
pDevice->SetRenderState(D3DRS_FOGENABLE, D3DZB_FALSE);
pDevice->SetFVF( 0x004 | 0x040 | 0X100);
pDevice->SetFVF(D3DGRADE_ALLCOMPUTER);
pDevice->SetTexture(0, NULL);
pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, vertices, sizeof(D3DVERTEX));
}