Ich habe ein kleines problem :-D9
Ich möchte einen D3D hack coden aber leider fehlt mir
ein wichtiger teil
also hat einer vielleciht eine neuere DrawBox für mich ???
sonst würde der hack funzen :-D
oder könnt ihr ihn überarbeiten
Hier die source von der DrawBox:
Problem ist jetzt nur das cih D3D9 benutze und i wie funzt das da nciht.
void DrawBox(IDirect3DDevice8 *pD3Ddev, int x, int y, int w, int h, D3DCOLOR col)
{
struct QuadVertex {
float x,y,z,rhw;
DWORD dwColor;
};
IDirect3DVertexBuffer8 *pVertexBuffer = NULL;
QuadVertex qV[4];
BYTE *pVertexData = NULL;
if (pD3Ddev->CreateVertexBuffer((4*sizeof(QuadVertex)),(D3DUSA GE_WRITEONLY|D3DUSAGE_DYNAMIC),(D3DFVF_XYZRHW|D3DF VF_DIFFUSE),D3DPOOL_DEFAULT,&pVertexBuffer)<0) return;
pD3Ddev->SetRenderState(D3DRS_ZENABLE , FALSE);
pD3Ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
pD3Ddev->SetRenderState(D3DRS_LIGHTING, FALSE);
pVertexBuffer->Lock(0,0,&pVertexData,D3DLOCK_NOSYSLOCK | D3DLOCK_DISCARD);
if(pVertexData)
{
qV[0].dwColor = qV[1].dwColor = qV[2].dwColor = qV[3].dwColor = col;
qV[0].z = qV[1].z = qV[2].z = qV[3].z = 0.0f;
qV[0].rhw = qV[1].rhw = qV[2].rhw = qV[3].rhw = 0.0f;
qV[0].x = (float)x;
qV[0].y = (float)(y + h);
qV[1].x = (float)x;
qV[1].y = (float)y;
qV[2].x = (float)(x + w);
qV[2].y = (float)(y + h);
qV[3].x = (float)(x + w);
qV[3].y = (float)y;
memcpy(pVertexData,qV,sizeof(QuadVertex)*4);
pVertexBuffer->Unlock();
pVertexData = NULL;
pD3Ddev->SetStreamSource(0,pVertexBuffer, sizeof(QuadVertex));
pD3Ddev->SetVertexShader( D3DFVF_XYZRHW | D3DFVF_DIFFUSE );
pD3Ddev->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 );
}
if (pVertexBuffer) {
pVertexBuffer->Release();
pVertexBuffer=NULL;
}
pD3Ddev->SetRenderState(D3DRS_LIGHTING, true);
}
Ich möchte einen D3D hack coden aber leider fehlt mir
ein wichtiger teil
also hat einer vielleciht eine neuere DrawBox für mich ???
sonst würde der hack funzen :-D
oder könnt ihr ihn überarbeiten
Hier die source von der DrawBox:
Problem ist jetzt nur das cih D3D9 benutze und i wie funzt das da nciht.
void DrawBox(IDirect3DDevice8 *pD3Ddev, int x, int y, int w, int h, D3DCOLOR col)
{
struct QuadVertex {
float x,y,z,rhw;
DWORD dwColor;
};
IDirect3DVertexBuffer8 *pVertexBuffer = NULL;
QuadVertex qV[4];
BYTE *pVertexData = NULL;
if (pD3Ddev->CreateVertexBuffer((4*sizeof(QuadVertex)),(D3DUSA GE_WRITEONLY|D3DUSAGE_DYNAMIC),(D3DFVF_XYZRHW|D3DF VF_DIFFUSE),D3DPOOL_DEFAULT,&pVertexBuffer)<0) return;
pD3Ddev->SetRenderState(D3DRS_ZENABLE , FALSE);
pD3Ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
pD3Ddev->SetRenderState(D3DRS_LIGHTING, FALSE);
pVertexBuffer->Lock(0,0,&pVertexData,D3DLOCK_NOSYSLOCK | D3DLOCK_DISCARD);
if(pVertexData)
{
qV[0].dwColor = qV[1].dwColor = qV[2].dwColor = qV[3].dwColor = col;
qV[0].z = qV[1].z = qV[2].z = qV[3].z = 0.0f;
qV[0].rhw = qV[1].rhw = qV[2].rhw = qV[3].rhw = 0.0f;
qV[0].x = (float)x;
qV[0].y = (float)(y + h);
qV[1].x = (float)x;
qV[1].y = (float)y;
qV[2].x = (float)(x + w);
qV[2].y = (float)(y + h);
qV[3].x = (float)(x + w);
qV[3].y = (float)y;
memcpy(pVertexData,qV,sizeof(QuadVertex)*4);
pVertexBuffer->Unlock();
pVertexData = NULL;
pD3Ddev->SetStreamSource(0,pVertexBuffer, sizeof(QuadVertex));
pD3Ddev->SetVertexShader( D3DFVF_XYZRHW | D3DFVF_DIFFUSE );
pD3Ddev->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 );
}
if (pVertexBuffer) {
pVertexBuffer->Release();
pVertexBuffer=NULL;
}
pD3Ddev->SetRenderState(D3DRS_LIGHTING, true);
}