Solved C# Direct-x Custom Crosshair Tutorial(Fleep's Tutorial)

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

mPulse

Coder
Full Member
Nobleman
Jun 19, 2013
106
733
0
I didnt find that topic where is talking about "C# Direct-x Custom Crosshair Tutorial" and if there is that im sorry :/'




Ã￾ downloaded wrote everything what Fleep wrote(also fix) and got some problems :/ I Downloaded Fleep's Source and checked there,everything was ok.... But I can't choose Crosshair/Size/Color/OnOff button :( Only "App/Game" Menu does work :/

I tried out Fleep's One and When I run it(tested run an adminstor still problems) I can see only black screen :/
---------------------
Here is my form.cs



And some Pictures:
Fleep's One
https://i.imgur.com/7e5qdY5.png


Mine:
[Imgur](https://i.imgur.com/fQDwbMU.png)
 

rN'

Jr.Hacker
Meme Tier VIP
Jan 19, 2014
340
6,268
41
Try to translate this from C++ to C#. It's not hard..
C++:
void DrawCrosshair( int iSize )
{
	static bool bEnabled = false;

	if( GetAsyncKeyState( VK_INSERT ) & 1 )
	{
		bEnable = !bEnable;
	}
	if( bEnable )
	{
		Direct3D9::pRender->Rect( Direct3D9::getCenter( "x" ) - iSize / 2, Direct3D9::getCenter( "y" ), iSize, 1, Color( 0xFFFF0000 ) );
		Direct3D9::pRender->Rect( Direct3D9::getCenter( "x" ), Direct3D9::getCenter( "y" ) - iSize / 2, 1, iSize, Color( 0xFFFF0000 ) );
	}
}
best regards
 

GAFO666

Hacker
Meme Tier VIP
Aug 19, 2012
520
3,188
23
this does not work for me as well. no idea why not o_O

But you could do it in c++ by parsing a picture of your costum painted crosshair like a smiley into a byte array and just :
C++:
int posX, posY;

LPDIRECT3DTEXTURE9 pTextureInterface = NULL;
LPD3DXSPRITE pSpriteInterface = NULL;

D3DXCreateTextureFromFileInMemoryEx(pDevice, bBackground, sizeof(bBackground), posX, posY, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, 0, 0, &pTextureInterface);
	D3DXCreateSprite(pDevice, &pSpriteInterface);
	
	pSpriteInterface->Begin(D3DXSPRITE_ALPHABLEND);
	pSpriteInterface->Draw(pTextureInterface, NULL, NULL, &MenuPosition, 0xFFFFFFFF);
	pSpriteInterface->End();
If you want do that, I mean its just a suggestion you can parse it by a "file to bytearray tool" if you search the net or just pm me, if you dont find one ;) (bBackground == the byte array from the tool you get, just put it into your source)


orrrrr if you want a simple crosshair

C++:
void DrawCross(LPDIRECT3DDEVICE9 pDevice, int size)
{
	float ScreenCenterX = 0.0f;
	float ScreenCenterY = 0.0f;	
	D3DVIEWPORT9 g_ViewPort; 

	pDevice->GetViewport(&g_ViewPort);
 
    ScreenCenterX = (float)g_ViewPort.Width / 2;
    ScreenCenterY = (float)g_ViewPort.Height / 2;
		
	
		D3DRECT rec2 = {ScreenCenterX-size, ScreenCenterY, ScreenCenterX+size, ScreenCenterY+1};
		D3DRECT rec3 = {ScreenCenterX, ScreenCenterY-size, ScreenCenterX+1, ScreenCenterY+size};
		pDevice->Clear(1, &rec2, D3DCLEAR_TARGET,RED, 0, 0);
		pDevice->Clear(1, &rec3, D3DCLEAR_TARGET,RED, 0, 0);	
}
Thats no c# or an overlay like in that tut but I dont know any other way, hope your not mad at me :p I dont know someone who write hacks in c# anyways soooo :eek: Well if you not wanna stick to c# you can take this, otherways ignore it, just a suggestion cuz no1 answered 3 days :)
 

mPulse

Coder
Full Member
Nobleman
Jun 19, 2013
106
733
0
//bumb// Anyone? I want update that but I cant because there is problem what I cant solv :/
 

TheUnknown

Newbie
Full Member
Nobleman
Feb 19, 2013
51
418
0
Try to translate this from C++ to C#. It's not hard..
C++:
void DrawCrosshair( int iSize )
{
	static bool bEnabled = false;

	if( GetAsyncKeyState( VK_INSERT ) & 1 )
	{
		bEnable = !bEnable;
	}
	if( bEnable )
	{
		Direct3D9::pRender->Rect( Direct3D9::getCenter( "x" ) - iSize / 2, Direct3D9::getCenter( "y" ), iSize, 1, Color( 0xFFFF0000 ) );
		Direct3D9::pRender->Rect( Direct3D9::getCenter( "x" ), Direct3D9::getCenter( "y" ) - iSize / 2, 1, iSize, Color( 0xFFFF0000 ) );
	}
}
best regards
C#:
public static void DrawCrosshair( int iSize )
{
    static bool bEnabled = false;
 
    if( GetAsyncKeyState( VK_INSERT ) & 1 )
    {
        bEnable = !bEnable;
    }
    if( bEnable )
    {
        Direct3D9::pRender->Rect( Direct3D9::getCenter( "x" ) - iSize / 2, Direct3D9::getCenter( "y" ), iSize, 1, Color( 0xFFFF0000 ) );
        Direct3D9::pRender->Rect( Direct3D9::getCenter( "x" ), Direct3D9::getCenter( "y" ) - iSize / 2, 1, iSize, Color( 0xFFFF0000 ) );
    }
}
This one.
Hope i helped.
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods