Hello. Im trying to just play around with directX right now. And i tried to do a external crosshair but it seems something is wrong and i cant really se whats the problem.
Im trying to get my screencenter right. And it calculate everything right.
Since x = 1280 and y = 800, which is my resolution im trying to calculate where the middle is. And here i want to do my external crosshair. So i call : DrawFilledBoxX(screencenter[0],screencenter[1],25,25,255,0,0,200);
But here comes the problem.. the Boxx doesnt come in the middle. See picture : https://fuskbugg.se/dl/6NmhCd/aaa.png
Anyone knows why
)) ?
Edit : and ofc i call calcScreenCenter before I render my boxx
Im trying to get my screencenter right. And it calculate everything right.
Since x = 1280 and y = 800, which is my resolution im trying to calculate where the middle is. And here i want to do my external crosshair. So i call : DrawFilledBoxX(screencenter[0],screencenter[1],25,25,255,0,0,200);
But here comes the problem.. the Boxx doesnt come in the middle. See picture : https://fuskbugg.se/dl/6NmhCd/aaa.png
Anyone knows why
Edit : and ofc i call calcScreenCenter before I render my boxx
C++:
void calcScreenCenter(int x,int y)
{
screencenter[0] = x/2;//res[0]/2;
screencenter[1] = y/2;//res[1]/2;
}
C++:
void DrawFilledBox(int x, int y, int w, int h, int r, int g, int b, int a)
{
static ID3DXLine* pLine;
if (!pLine)
D3DXCreateLine(dx_Device, &pLine);
D3DXVECTOR2 vLine[2];
pLine->SetWidth( w );
pLine->SetAntialias( false );
pLine->SetGLLines( true );
vLine[0].x = x + w/2;
vLine[0].y = y;
vLine[1].x = x + w/2;
vLine[1].y = y + h;
pLine->Begin( );
pLine->Draw( vLine, 2, D3DCOLOR_RGBA( r, g, b, a ) );
pLine->End( );
}
Attachments
You can download 0 Attachments
-
84.2 KB Views: 22
Last edited: