struct sVertex
{
float x, y, z, RHW;
DWORD color;
enum FVF
{
FVF_Flags = (D3DFVF_XYZRHW | D3DFVF_DIFFUSE)
};
};
sVertex new_sVertex(DWORD x, DWORD y, DWORD color)
{
float fx = float(x);
float fy = float(y);
float fz = float(0);
float RHW = float(0);
sVertex ret = {fx,fy,fz,RHW, color};
return ret;
}
void DrawBox(LPDIRECT3DDEVICE9 pDevice, DWORD x, DWORD y, DWORD w, DWORD h, DWORD color)
{
sVertex Veri[4] =
{
new_sVertex(x,y,color),
new_sVertex(x+w,y,color),
new_sVertex(x,y+h,color),
new_sVertex(x+w,y+h,color)
};
pDevice->SetFVF( sVertex::FVF_Flags );
pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2,Veri,sizeof (sVertex));
}