C++ her oyunda crosshair hilesi yapma (2 Viewers)

Joined
Sep 28, 2019
Credits
100,000
Rating - 88.9%
Her oyunda açar d3d sourcenin içine yapıştırın geçin.

C++:
Variant 1:
/*This down here create the function with the name "DrawXHair", so for use you'll  write: DrawXHair(pDevice, D3DCOLOR_XRGB(0, 0, 0); //for example. The  color can be as in the example but also hex (0xFFFFFFFF), and in ARGB.*/



void DrawXHair(LPDIRECT3DDEVICE9 pDevice, D3DCOLOR color)

{

    D3DVIEWPORT9 viewP;    //this create a D3DVIEWPORT9 variable

    pDevice->GetViewport( &viewP );    //put the values of screen resolution, viewport coords, in viewP

    DWORD ScreenCenterX = viewP.Width / 2;    //Create a DWORD that represent the screen center X     // STUDY CARTESIAN AXES AND ALGEBRA

    DWORD ScreenCenterY = viewP.Height / 2;    // Same as up there, but for Y                           

    

    D3DRECT rect1 = {ScreenCenterX-25, ScreenCenterY, ScreenCenterX+ 25,  ScreenCenterY+1};    //Create a D3DRECT variable that contains the coord of where we are going to draw a line

    D3DRECT rect2 = {ScreenCenterX, ScreenCenterY-25, ScreenCenterX+ 1,  ScreenCenterY+25};    //Same as up there



    pDevice->Clear( 1, &rect1, D3DCLEAR_TARGET, color, 0,  0 );    //This function draw a line on determinated coords

    pDevice->Clear( 1, &rect2, D3DCLEAR_TARGET, color, 0,  0 );    //Same as up there

}


here another way to draw a crosshair:
void CrossHair(LPDIRECT3DDEVICE9 pDevice, int size, int strong,  D3DCOLOR xcolor){

    int iCenterX = GetSystemMetrics( 0 ) / 2;

    int iCenterY = GetSystemMetrics( 1 ) / 2;

    if( iCenterX < 20 && iCenterY < 20 )

    {

        iCenterX = ( GetSystemMetrics( 0 ) / 2 );

        iCenterY = ( GetSystemMetrics( 1 ) / 2 );

    }

    D3DRECT rec2 = { iCenterX- size, iCenterY, iCenterX+ size, iCenterY+ strong};

    D3DRECT rec3 = { iCenterX, iCenterY- size, iCenterX+ strong,iCenterY+ size};

    pDevice->Clear(1, &rec2, D3DCLEAR_TARGET, xcolor, 1000,  0);

    pDevice->Clear(1, &rec3, D3DCLEAR_TARGET, xcolor, 100,  0);

}
 
Joined
Oct 6, 2020
Credits
3,034
Rating - 0%
Her oyunda açar d3d sourcenin içine yapıştırın geçin.

C++:
Variant 1:
/*This down here create the function with the name "DrawXHair", so for use you'll  write: DrawXHair(pDevice, D3DCOLOR_XRGB(0, 0, 0); //for example. The  color can be as in the example but also hex (0xFFFFFFFF), and in ARGB.*/



void DrawXHair(LPDIRECT3DDEVICE9 pDevice, D3DCOLOR color)

{

    D3DVIEWPORT9 viewP;    //this create a D3DVIEWPORT9 variable

    pDevice->GetViewport( &viewP );    //put the values of screen resolution, viewport coords, in viewP

    DWORD ScreenCenterX = viewP.Width / 2;    //Create a DWORD that represent the screen center X     // STUDY CARTESIAN AXES AND ALGEBRA

    DWORD ScreenCenterY = viewP.Height / 2;    // Same as up there, but for Y                          

   

    D3DRECT rect1 = {ScreenCenterX-25, ScreenCenterY, ScreenCenterX+ 25,  ScreenCenterY+1};    //Create a D3DRECT variable that contains the coord of where we are going to draw a line

    D3DRECT rect2 = {ScreenCenterX, ScreenCenterY-25, ScreenCenterX+ 1,  ScreenCenterY+25};    //Same as up there



    pDevice->Clear( 1, &rect1, D3DCLEAR_TARGET, color, 0,  0 );    //This function draw a line on determinated coords

    pDevice->Clear( 1, &rect2, D3DCLEAR_TARGET, color, 0,  0 );    //Same as up there

}


here another way to draw a crosshair:
void CrossHair(LPDIRECT3DDEVICE9 pDevice, int size, int strong,  D3DCOLOR xcolor){

    int iCenterX = GetSystemMetrics( 0 ) / 2;

    int iCenterY = GetSystemMetrics( 1 ) / 2;

    if( iCenterX < 20 && iCenterY < 20 )

    {

        iCenterX = ( GetSystemMetrics( 0 ) / 2 );

        iCenterY = ( GetSystemMetrics( 1 ) / 2 );

    }

    D3DRECT rec2 = { iCenterX- size, iCenterY, iCenterX+ size, iCenterY+ strong};

    D3DRECT rec3 = { iCenterX, iCenterY- size, iCenterX+ strong,iCenterY+ size};

    pDevice->Clear(1, &rec2, D3DCLEAR_TARGET, xcolor, 1000,  0);

    pDevice->Clear(1, &rec3, D3DCLEAR_TARGET, xcolor, 100,  0);

}
++
 

Users who are viewing this thread

Top