DirectX Render problem.

Hexui Undetected CSGO Cheats PUBG Accounts

j3b

Jr.Coder
Full Member
Nobleman
Dec 18, 2012
67
408
1
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

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
Last edited:

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,183
19,938
76
You might need to compensate for the game window boundaries since you are in windowed mode but the resolution seems like a screen res.

Btw look at your 4 vLine[... statements, you have a mistake there.
 

j3b

Jr.Coder
Full Member
Nobleman
Dec 18, 2012
67
408
1
You might need to compensate for the game window boundaries since you are in windowed mode but the resolution seems like a screen res.

Btw look at your 4 vLine[... statements, you have a mistake there.
Soo instead of taking the resoultion i should take the hwnd´s widht and height?
But if im going to do a ESP, do i need Screenres or the hwnds for world2screen?

And i will take a look at my vLine tomorrow.. Thank u, and i will return if i dont get it ;)
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,183
19,938
76
You need to het the window size and then compensate for those ugly blue windows borders (1-2px or smth alike).
 

j3b

Jr.Coder
Full Member
Nobleman
Dec 18, 2012
67
408
1
You need to het the window size and then compensate for those ugly blue windows borders (1-2px or smth alike).
Didnt help :< It comes almost at the same place... so i guess its wrong with my DrawBox method :)?
 

TastyHorror

Coder
Dank Tier Donator
Nobleman
Oct 11, 2012
179
2,268
8
Full source would be nice but I'll reiterate what c5 has said... Debug at the draw filled box and see what values are, 99% has to do with the vLine[0].x.
 

j3b

Jr.Coder
Full Member
Nobleman
Dec 18, 2012
67
408
1
Full source would be nice but I'll reiterate what c5 has said... Debug at the draw filled box and see what values are, 99% has to do with the vLine[0].x.
x = 640
y = 400
which is right.. when im debugging..

vLine[0].x becomes like... 680 or something when i use my code.. but problem is.. if i put vLine[0].x= 640 the box is not a square then :/ more like this -> https://matematika.martinmarinov.info/en/grafiki/romb.png
 

Similar threads

Community Mods