Nice, workt.
Boxen kannst du auch noch drawen ;)
VOID __stdcall DrawBox(INT xx,INT yy,INT hh,INT ww,LPDIRECT3DDEVICE9 pDevice)
{
D3DRECT rec;
FLOAT x,y,w,h;
struct vertex
{
FLOAT x,y,z,t;
DWORD Color ;
};
vertex V[8];
x = (float)xx; y = (float)yy; h = (float)hh; w = (float)ww;
V[0].Color = V[1].Color = V[2].Color = V[3].Color = BLACK;
V[4].Color = V[5].Color = V[6].Color = V[7].Color = BLACK;
V[0].z = V[1].z = V[2].z = V[3].z = 0;
V[4].z = V[5].z = V[6].z = V[7].z = 0;
V[0].t = V[1].t = V[2].t = V[3].t = 0;
V[4].t = V[5].t = V[6].t = V[7].t = 0;
V[0].x = V[1].x = x;
V[0].y = V[2].y = y + h;
V[1].y = V[3].y = y;
V[2].x = V[3].x = x + w;
V[4].x = V[5].x = x;
V[4].y = V[6].y = y + h;
V[5].y = V[7].y = y;
V[6].x = V[7].x = x + w;
pDevice->SetTexture(0, NULL);
pDevice->SetPixelShader( NULL );
pDevice->SetRenderState(D3DRS_CLIPPING,FALSE);
pDevice->SetFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1 );
pDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP,2,V,sizeof(vertex));
rec.x1 = xx;rec.y1 = yy;rec.x2 = xx+ww;rec.y2 = yy+1;
pDevice->Clear(1,&rec,D3DCLEAR_TARGET,RED,0,0);
rec.x1 = xx;rec.y1 = hh+yy;rec.x2 = xx+ww;rec.y2 = hh+yy+1;
pDevice->Clear(1,&rec,D3DCLEAR_TARGET,RED,0,0);
rec.x1 = xx;rec.y1 = yy;rec.x2 = xx+1;rec.y2 = yy+hh;
pDevice->Clear(1,&rec,D3DCLEAR_TARGET,RED,0,0);
rec.x1 = xx+ww;rec.y1 = yy;rec.x2 = xx+ww+1;rec.y2 = yy+hh;
pDevice->Clear(1,&rec,D3DCLEAR_TARGET,RED,0,0);
return;
}
Usage
DrawBox((INT)x+8,(INT)y - 3,18,174, pDevice);//Top Box
DrawBox((INT)x+8,(INT)y + 22,10 + Mmax * 17,174, pDevice);//Middle Box
Credits to Croner ;)