Hello guys,
I'm trying to draw some lines with DirectX. I hooked into present, and using the games LPDIRECT3DDEVICE9 to draw strings/lines. Somehow only the strings are visible, and not the lines.
I'm trying to draw some lines with DirectX. I hooked into present, and using the games LPDIRECT3DDEVICE9 to draw strings/lines. Somehow only the strings are visible, and not the lines.
Code:
void Menu::Box(int x, int y, int w, int h, DWORD Color, LPDIRECT3DDEVICE9 pDevice)
{
if (!pDevice)
return;
const DWORD D3D_FVF = (D3DFVF_XYZRHW | D3DFVF_DIFFUSE);
struct Vertex
{
float x, y, z, ht;
DWORD yourcolor;
}
V[4] =
{
{ (float)x, (float)(y + h), 0.0f, 0.0f, Color },
{ (float)x, (float)y, 0.0f, 0.0f, Color },
{ (float)(x + w), (float)(y + h), 0.0f, 0.0f, Color },
{ (float)(x + w), (float)y, 0.0f, 0.0f, Color }
};
pDevice->SetTexture(0, NULL);
pDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
pDevice->SetRenderState(D3DRS_FOGENABLE, false);
pDevice->SetFVF(D3D_FVF);
pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, V, sizeof(Vertex));
}