How to Draw a Line in Flexi 12

We strive to provide all our services for free and not interrupt your visit with intrusive advertisements or restrictions - support us by disabling your ad blocker or whitelisting our site.


Go Back UnKnoWnCheaTs - Multiplayer Game Hacking and Cheats
  • Anti-Cheat Software & Programming
  • Direct3D
  • D3D Tutorials and Source
  • Reload this Page [Coding] How To Draw A Line in DirectX

    How To Draw A Line in DirectX How To Draw A Line in DirectX
    Authenticator Code

    Reply

    Thread Tools

    How To Draw A Line in DirectX
    Old 7th March 2010, 10:02 PM #1

    Pyro666

    Master Roaster TM


    Pyro666's Avatar

    Join Date: Feb 2010

    Posts: 1,216

    Reputation: 35685
    Rep Power: 336
    Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen!

    Recognitions Award symbolizing a retired staff member who dedicated a notable amount of time and effort to their past staff position. Former Staff
    The UC Member of the Month award is a prestigious award given to a single community member on a monthly basis. Based on a vote from community members, the award is given to the forum member that has shown exemplary achievement and potential in the UnKnoWnCheaTs community, and has shown great commitment to upholding the principles upon which UnKnoWnCheaTs stands for. A member who has been awarded the Member of the Month award has been distinguished as an asset to the UnKnoWnCheaTs community. Member of the Month (1)
    Members who have contributed financial support towards UnKnoWnCheaTs. Donator (2)

    Points: 52,021, Level: 34

    Points: 52,021, Level: 34 Points: 52,021, Level: 34 Points: 52,021, Level: 34

    Level up: 18%, 2,979 Points needed

    Level up: 18% Level up: 18% Level up: 18%

    Activity: 1.9%

    Activity: 1.9% Activity: 1.9% Activity: 1.9%
    Last Achievements How To Draw A Line in DirectX How To Draw A Line in DirectX How To Draw A Line in DirectX How To Draw A Line in DirectX

    Smile How To Draw A Line in DirectX


    okay for some quick info,
    what this does is draw a line in d3d8/d3d9(tested on d3d9)
    by giving the base x value and base y value and the width you want it set at it will draw a line at the specified co-ords

    so here is the first line of the code

    Code:

    void DrawLine(LPDIRECT3DDEVICE9 Device_Interface,int bx,int by,int bw,D3DCOLOR COLOR) { }

    that is going to be the base function, THIS WILL NOT RENDER ANYTHING YET

    now

    add D3DRECT rec; to your function, it should look like this now

    Code:

    void DrawLine(LPDIRECT3DDEVICE9 Device_Interface,int bx,int by,int bw,D3DCOLOR COLOR) { D3DRECT rec; }

    now we add the x,y,w, color etc
    add

    rec.x1 = bx-bw;
    rec.y1 = by;
    rec.x2 = bx+bw;
    rec.y2 = by+1;

    should look like this

    Code:

    void DrawLine(LPDIRECT3DDEVICE9 Device_Interface,int bx,int by,int bw,D3DCOLOR COLOR)  { D3DRECT rec; rec.x1 = bx-bw;//makes line longer/shorter going left     rec.y1 = by;/base y     rec.x2 = bx+bw;//makes line longer/shorter going right     rec.y2 = by+1;//makes line one pixel tall   }

    add pDevice->Clear(1,&rec,D3DCLEAR_TARGET,Color,0,0);

    here is the final function

    Code:

    void DrawLine(LPDIRECT3DDEVICE9 Device_Interface,int bx,int by,int bw,D3DCOLOR COLOR)   {      D3DRECT rec;     rec.x1 = bx-bw;//makes line longer/shorter going lef     rec.y1 = by;/base y      rec.x2 = bx+bw;//makes line longer/shorter going right     rec.y2 = by+1;//makes line one pixel tall     Device_Interface->Clear(1,&rec,D3DCLEAR_TARGET,Color,0,0);     }

    now a call example

    Code:

    drawline(pDevice,40,60,100,D3DCOLOR_ARGB(0,0,0,0);

    that will draw a black line

    have fun,
    prototype666
    please note i will be releasing more in the future
    unless u dont want me to
    p.s. ill add S.S in a second.
    to change to dx8 just change LPDIRECT3DDEVICE9 to LPDIRECT3DDEVICE8
    if they'res anything wrong tell me and i will fix it


    Last edited by Pyro666; 8th March 2010 at 12:41 PM. Reason: added ss

    Pyro666 is offline
    Reply With Quote


    Old 7th March 2010, 10:45 PM #2

    Riffe420

    Posting Well


    Riffe420's Avatar

    Join Date: Feb 2010

    Posts: 33

    Reputation: -181
    Rep Power: 0
    Riffe420 is nearly a complete Unknown Asshat Riffe420 is nearly a complete Unknown Asshat

    Good, now make a crosshair out of it!
    +1

    Riffe420 is offline
    Reply With Quote


    Old 7th March 2010, 10:50 PM #3

    Anddos

    Supreme H4x0|2


    Anddos's Avatar

    Join Date: Dec 2009

    Posts: 695

    Reputation: 734
    Rep Power: 0
    Anddos is a Rep Demon Anddos is a Rep Demon Anddos is a Rep Demon Anddos is a Rep Demon Anddos is a Rep Demon Anddos is a Rep Demon Anddos is a Rep Demon

    Recognitions Members who have contributed financial support towards UnKnoWnCheaTs. Donator (5)

    That's a screenspace line how about a worldspace line?

    Anddos is offline
    Reply With Quote


    Old 7th March 2010, 11:46 PM #4

    Pyro666

    Master Roaster TM


    Pyro666's Avatar

    Threadstarter

    Join Date: Feb 2010

    Posts: 1,216

    Reputation: 35685
    Rep Power: 336
    Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen!

    Recognitions Award symbolizing a retired staff member who dedicated a notable amount of time and effort to their past staff position. Former Staff
    The UC Member of the Month award is a prestigious award given to a single community member on a monthly basis. Based on a vote from community members, the award is given to the forum member that has shown exemplary achievement and potential in the UnKnoWnCheaTs community, and has shown great commitment to upholding the principles upon which UnKnoWnCheaTs stands for. A member who has been awarded the Member of the Month award has been distinguished as an asset to the UnKnoWnCheaTs community. Member of the Month (1)
    Members who have contributed financial support towards UnKnoWnCheaTs. Donator (2)

    Points: 52,021, Level: 34

    Points: 52,021, Level: 34 Points: 52,021, Level: 34 Points: 52,021, Level: 34

    Level up: 18%, 2,979 Points needed

    Level up: 18% Level up: 18% Level up: 18%

    Activity: 1.9%

    Activity: 1.9% Activity: 1.9% Activity: 1.9%
    Last Achievements How To Draw A Line in DirectX How To Draw A Line in DirectX How To Draw A Line in DirectX How To Draw A Line in DirectX

    Quote:

    Originally Posted by Anddos View Post

    That's a screenspace line how about a worldspace line?

    fine -.-

    Riffe420,
    thank you very much for the positive feedback and will do .
    as for you mr. Anddos,sure i will but not now, i'm tired.
    I'm gonna make a crosshair quick then i'm going offline

    [Auto Merged - 0:00:37 UTC]

    Quote:

    Originally Posted by Riffe420 View Post

    Good, now make a crosshair out of it!
    +1

    Quote:

    void crosstwo(LPDIRECT3DDEVICE9 pDevice,int tx,int ty,int tw,int th,D3DCOLOR COLORZ)
    {
    D3DRECT RECTONE;
    RECTONE.x1 = tx-tw;
    RECTONE.y1 = ty;
    RECTONE.x2 = tx+tw;
    RECTONE.y2 = ty+1;
    D3DRECT RECTTWO;
    RECTTWO.x1 = tx;
    RECTTWO.y1 = ty-th;
    RECTTWO.x2 = tx+1;
    RECTTWO.y2 = ty+th;
    pDevice->Clear(1,&RECTONE,D3DCLEAR_TARGET,COLORZ,0,0);
    pDevice->Clear(1,&RECTTWO,D3DCLEAR_TARGET,COLORZ,0,0);
    }

    theres the crosshair func i made, ill explain it later via edit.
    use GetSystemMetrics to well,get the center of screen and then set it to that
    to do that use this as call

    Quote:

    crosstwo(pDevice,GetSystemMetrics(0)/2,GetSystemMetrics(1)/2,35,35,red);

    have fun guys


    Last edited by Pyro666; 8th March 2010 at 12:01 AM.

    Pyro666 is offline
    Reply With Quote


    Old 8th March 2010, 01:40 AM #5

    Anddos

    Supreme H4x0|2


    Anddos's Avatar

    Join Date: Dec 2009

    Posts: 695

    Reputation: 734
    Rep Power: 0
    Anddos is a Rep Demon Anddos is a Rep Demon Anddos is a Rep Demon Anddos is a Rep Demon Anddos is a Rep Demon Anddos is a Rep Demon Anddos is a Rep Demon

    Recognitions Members who have contributed financial support towards UnKnoWnCheaTs. Donator (5)

    Thats still screenspace as you're working with rect's

    Anddos is offline
    Reply With Quote


    Old 8th March 2010, 01:58 AM #6

    sysbi0sis

    Guess who's back?


    sysbi0sis's Avatar

    Join Date: Dec 2009

    Location: Behind a computer

    Posts: 754

    Reputation: 1752
    Rep Power: 300
    sysbi0sis is Capable of creating the apocalypse sysbi0sis is Capable of creating the apocalypse sysbi0sis is Capable of creating the apocalypse sysbi0sis is Capable of creating the apocalypse sysbi0sis is Capable of creating the apocalypse sysbi0sis is Capable of creating the apocalypse sysbi0sis is Capable of creating the apocalypse sysbi0sis is Capable of creating the apocalypse sysbi0sis is Capable of creating the apocalypse sysbi0sis is Capable of creating the apocalypse sysbi0sis is Capable of creating the apocalypse

    Recognitions Award symbolizing a retired staff member who dedicated a notable amount of time and effort to their past staff position. Former Staff

    you made a mistake:

    Quote:

    Originally Posted by prototype666 View Post

    add pDevice->Clear(1,&rec,D3DCLEAR_TARGET,Color,0,0);

    here is the final function

    Code:

    void DrawLine(LPDIRECT3DDEVICE9                                  Device_Interface,int bx,int by,int bw,D3DCOLOR COLOR)   {      D3DRECT rec;     rec.x1 = bx-bw;//makes line longer/shorter going lef     rec.y1 = by;/base y      rec.x2 = bx+bw;//makes line longer/shorter going right     rec.y2 = by+1;//makes line one pixel tall                                  pDevice->Clear(1,&rec,D3DCLEAR_TARGET,Color,0,0);     }

    you have to add

    Code:

                                Device_Interface->Clear(1,&rec,D3DCLEAR_TARGET,Color,0,0);

    or am I wrong?

    __________________

    ...From the ashes I rise...

    sysbi0sis is offline
    Reply With Quote


    Old 8th March 2010, 06:35 AM #7

    Pyro666

    Master Roaster TM


    Pyro666's Avatar

    Threadstarter

    Join Date: Feb 2010

    Posts: 1,216

    Reputation: 35685
    Rep Power: 336
    Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen!

    Recognitions Award symbolizing a retired staff member who dedicated a notable amount of time and effort to their past staff position. Former Staff
    The UC Member of the Month award is a prestigious award given to a single community member on a monthly basis. Based on a vote from community members, the award is given to the forum member that has shown exemplary achievement and potential in the UnKnoWnCheaTs community, and has shown great commitment to upholding the principles upon which UnKnoWnCheaTs stands for. A member who has been awarded the Member of the Month award has been distinguished as an asset to the UnKnoWnCheaTs community. Member of the Month (1)
    Members who have contributed financial support towards UnKnoWnCheaTs. Donator (2)

    Points: 52,021, Level: 34

    Points: 52,021, Level: 34 Points: 52,021, Level: 34 Points: 52,021, Level: 34

    Level up: 18%, 2,979 Points needed

    Level up: 18% Level up: 18% Level up: 18%

    Activity: 1.9%

    Activity: 1.9% Activity: 1.9% Activity: 1.9%
    Last Achievements How To Draw A Line in DirectX How To Draw A Line in DirectX How To Draw A Line in DirectX How To Draw A Line in DirectX

    Quote:

    Originally Posted by shamwow100 View Post

    you made a mistake:

    you have to add

    Code:

                                      Device_Interface->Clear(1,&rec,D3DCLEAR_TARGET,Color,0,0);

    or am I wrong?

    no your not wrong at all, but i have clear in my function
    but i see were i slipped up, thanks


    Last edited by Pyro666; 8th March 2010 at 12:40 PM.

    Pyro666 is offline
    Reply With Quote


    Old 8th March 2010, 07:28 AM #8

    iExclusive

    Super H4x0r


    iExclusive's Avatar

    Join Date: Jan 2009

    Posts: 321

    Reputation: 138
    Rep Power: 318
    iExclusive is in the shadow of all hacking legends iExclusive is in the shadow of all hacking legends

    Quote:

    Originally Posted by shamwow100 View Post

    you made a mistake:

    you have to add

    Code:

                                      Device_Interface->Clear(1,&rec,D3DCLEAR_TARGET,Color,0,0);

    or am I wrong?

    No, it's the same analogy, it's just that you may declare it as Device_Interface and OP declares it as pDevice. Obviously not everyone declares the same name for all devices.

    iExclusive is offline
    Reply With Quote


    Old 8th March 2010, 07:40 AM #9

    Gellin

    The Legendary Cheater


    Gellin's Avatar

    Join Date: Nov 2007

    Location: msdn

    Posts: 563

    Reputation: 5519
    Rep Power: 354
    Gellin DEFINES UNKNOWNCHEATS Gellin DEFINES UNKNOWNCHEATS Gellin DEFINES UNKNOWNCHEATS Gellin DEFINES UNKNOWNCHEATS Gellin DEFINES UNKNOWNCHEATS Gellin DEFINES UNKNOWNCHEATS Gellin DEFINES UNKNOWNCHEATS Gellin DEFINES UNKNOWNCHEATS Gellin DEFINES UNKNOWNCHEATS Gellin DEFINES UNKNOWNCHEATS Gellin DEFINES UNKNOWNCHEATS

    Recognitions Award symbolizing a retired staff member who dedicated a notable amount of time and effort to their past staff position. Former Staff
    Members who have contributed financial support towards UnKnoWnCheaTs. Donator (1)

    I like mine better,

    Code:

    void Direct3D::DrawCrosshair( int ScreenW, int ScreenH, DWORD Color ) { 	if( !cVar.Var.pDevice ) 		return;  	int DrawSpotX = ( ScreenW / 2 ) - 1;  	int DrawSpotY = ( ScreenH / 2 ) - 1;  	D3DRECT Line1 = { DrawSpotX - 20, DrawSpotY, DrawSpotX + 20, DrawSpotY + 3 }; 	D3DRECT Line2 = { DrawSpotX, DrawSpotY - 20, DrawSpotX + 3, DrawSpotY + 20 };  	cVar.Var.pDevice->Clear( 1, &Line1, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, Color, 0, 0 ); 	cVar.Var.pDevice->Clear( 1, &Line2, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, Color, 0, 0 );  }

    __________________

    Gellin is offline
    Reply With Quote


    Old 8th March 2010, 12:34 PM #10

    learn_more

    Retired Administrator


    learn_more's Avatar

    Join Date: Sep 2006

    Posts: 14,758

    Reputation: 160116
    Rep Power: 679
    learn_more has a huge epeen! learn_more has a huge epeen! learn_more has a huge epeen! learn_more has a huge epeen! learn_more has a huge epeen! learn_more has a huge epeen! learn_more has a huge epeen! learn_more has a huge epeen! learn_more has a huge epeen! learn_more has a huge epeen! learn_more has a huge epeen!

    Recognitions Members who have contributed financial support towards UnKnoWnCheaTs. Donator (48)
    Award symbolizing a retired staff member who dedicated a notable amount of time and effort to their past staff position. Former Staff
    Awarded to members who have donated 10 times or more. Gratuity (4)

    Points: 250,133, Level: 59

    Points: 250,133, Level: 59 Points: 250,133, Level: 59 Points: 250,133, Level: 59

    Level up: 25%, 243,867 Points needed

    Level up: 25% Level up: 25% Level up: 25%

    Activity: 2.7%

    Activity: 2.7% Activity: 2.7% Activity: 2.7%
    Last Achievements How To Draw A Line in DirectX How To Draw A Line in DirectX How To Draw A Line in DirectX How To Draw A Line in DirectX How To Draw A Line in DirectX
    Award-Showcase How To Draw A Line in DirectX

    device is not a cvar :/

    __________________

    ~ UC-Downloads ~ UC-Forum Rules ~ UC-Wiki ~

    learn_more is offline
    Reply With Quote


    Old 8th March 2010, 01:49 PM #11

    Roverturbo

    Site Adviser


    Roverturbo's Avatar

    Join Date: Feb 2005

    Posts: 7,175

    Reputation: 128306
    Rep Power: 610
    Roverturbo has a huge epeen! Roverturbo has a huge epeen! Roverturbo has a huge epeen! Roverturbo has a huge epeen! Roverturbo has a huge epeen! Roverturbo has a huge epeen! Roverturbo has a huge epeen! Roverturbo has a huge epeen! Roverturbo has a huge epeen! Roverturbo has a huge epeen! Roverturbo has a huge epeen!

    Recognitions This certification is awarded to forum staff members that are educated in the fields of reverse engineering and file analysis. All forum staff members with this certification have successfully gone through the process of becoming certified, which includes an individual assessment by upper staff, and the requirement of passing an internal file analysis examination. Anyone with a File Analysis certification is trusted by upper staff to be able to safely and competently approve files within UnKnoWnCheaTs, and only forum staff members that are certified file analyzers have permission to approve files within the UnKnoWnCheaTs downloads section. File Analyzer
    Members who have contributed financial support towards UnKnoWnCheaTs. Donator (9001)
    Awarded to members who have donated 10 times or more. Gratuity (9001)

    Points: 196,122, Level: 59

    Points: 196,122, Level: 59 Points: 196,122, Level: 59 Points: 196,122, Level: 59

    Level up: 8%, 297,878 Points needed

    Level up: 8% Level up: 8% Level up: 8%

    Activity: 2.9%

    Activity: 2.9% Activity: 2.9% Activity: 2.9%
    Last Achievements How To Draw A Line in DirectX How To Draw A Line in DirectX How To Draw A Line in DirectX How To Draw A Line in DirectX How To Draw A Line in DirectX How To Draw A Line in DirectX

    Quote:

    Originally Posted by iExclusive View Post

    No, it's the same analogy, it's just that you may declare it as Device_Interface and OP declares it as pDevice. Obviously not everyone declares the same name for all devices.

    No, prototype666 was using Device_Interface AND pDevice in the function. That is just the normal C+P errors you see floating around most times though...

    __________________

    I've learned that something constructive comes from every defeat.

    Real programmers don't document, if it was hard to write, it should be hard to understand.

    First learn computer science and all the theory, next develop a programming style, then forget all that and just hack.

    Learning is creation and not consumption. Knowledge is not something a learner absorbs, but something a learner creates.

    The path to success is paved with small wins. Even the grandest and most glorious victories rest on a string of modest but constructive steps forward.

    Note: I am not a member of any other community, any communication from this username outside of UC is not from myself.


    Roverturbo is offline
    Reply With Quote


    Old 8th March 2010, 06:39 PM #12

    Pyro666

    Master Roaster TM


    Pyro666's Avatar

    Threadstarter

    Join Date: Feb 2010

    Posts: 1,216

    Reputation: 35685
    Rep Power: 336
    Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen! Pyro666 has a huge epeen!

    Recognitions Award symbolizing a retired staff member who dedicated a notable amount of time and effort to their past staff position. Former Staff
    The UC Member of the Month award is a prestigious award given to a single community member on a monthly basis. Based on a vote from community members, the award is given to the forum member that has shown exemplary achievement and potential in the UnKnoWnCheaTs community, and has shown great commitment to upholding the principles upon which UnKnoWnCheaTs stands for. A member who has been awarded the Member of the Month award has been distinguished as an asset to the UnKnoWnCheaTs community. Member of the Month (1)
    Members who have contributed financial support towards UnKnoWnCheaTs. Donator (2)

    Points: 52,021, Level: 34

    Points: 52,021, Level: 34 Points: 52,021, Level: 34 Points: 52,021, Level: 34

    Level up: 18%, 2,979 Points needed

    Level up: 18% Level up: 18% Level up: 18%

    Activity: 1.9%

    Activity: 1.9% Activity: 1.9% Activity: 1.9%
    Last Achievements How To Draw A Line in DirectX How To Draw A Line in DirectX How To Draw A Line in DirectX How To Draw A Line in DirectX

    Smile


    Quote:

    Originally Posted by Roverturbo View Post

    No, prototype666 was using Device_Interface AND pDevice in the function. That is just the normal C+P errors you see floating around most times though...

    I DID NOT C+P this, i made this from an idea in my head oh and by the way i was tired and i did it as a mistake, i use pdevice thats why it was in there

    Pyro666 is offline
    Reply With Quote


    Old 11th March 2010, 05:34 AM #13

    stefanlg

    h4x0!2


    stefanlg's Avatar

    Join Date: Oct 2007

    Posts: 105

    Reputation: 228
    Rep Power: 347
    stefanlg is becoming A true Rep whore stefanlg is becoming A true Rep whore stefanlg is becoming A true Rep whore

    there is allready a tut.

    http://www.unknowncheats.me/forum/tu...raw-lines.html

    stefanlg is offline
    Reply With Quote

    Reply


    We strive to provide all our services for free and not interrupt your visit with intrusive advertisements or restrictions - support us by disabling your ad blocker or whitelisting our site.


    Similar Threads
    Thread Thread Starter Forum Replies Last Post
    [Question] [C++] Reading line by line from streaming webpage Brownstone C and C++ 6 10th August 2012 12:57 AM
    [Help] [C++] Reading line by line from streaming webpage Brownstone Programming for Beginners 0 5th August 2012 11:04 PM
    [Question] on line demo? U$eLe$$ Call Of Duty 1 4 13th July 2005 10:39 PM
    Is there a line to draw in hacking? Alkatraz America's Army Operations 2.x 17 22nd March 2005 03:38 PM

    Tags
    directx, draw, line

    « Previous Thread | Next Thread »


    Forum Jump


    All times are GMT. The time now is 11:39 PM.


    Contact Us - Toggle Dark Theme

    Terms of Use Information Privacy Policy Information
    Copyright ©2000-2021, Unknowncheats� UKCS #312436
    How To Draw A Line in DirectX How To Draw A Line in DirectX

    no new posts

    How to Draw a Line in Flexi 12

    Source: https://www.unknowncheats.me/forum/d3d-tutorials-and-source/62490-draw-line-directx.html

    0 Response to "How to Draw a Line in Flexi 12"

    Post a Comment

    Iklan Atas Artikel

    Iklan Tengah Artikel 1

    Iklan Tengah Artikel 2

    Iklan Bawah Artikel