Jump to content
Sign in to follow this  
Vindicator209

Draw

Recommended Posts

Vindicator209

How can I create a line that starts at a specified location to the cursor (as the cursor is moving)?

I want to avoid using Guis though, because it will be done constantly...

I've seen this done somewhere, but I dont remember where...


[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites
Muchuchu

So what exactly do you want to do?

I know mousegetpos() is most likely the function you want to use though.

Share this post


Link to post
Share on other sites
Vindicator209

Wellm I want to be able to left-click, then drag my mouse to another position, and have it draw a line between the positions


[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites
monoceres

Maybe?

#include <GDIPlus.au3>
#include <misc.au3>
HotKeySet("{ESC}", "close")
_GDIPlus_Startup()
$dc = DllCall("user32.dll", "int", "GetDC", "hwnd", "")
$graphic = _GDIPlus_GraphicsCreateFromHDC($dc[0])
Do
    $pos = MouseGetPos()
    If _IsPressed("01") Then
        Do
            Sleep(10)
        Until Not _IsPressed("01")
        $pos2 = MouseGetPos()
        _GDIPlus_GraphicsDrawLine($graphic, $pos[0], $pos[1], $pos2[0], $pos2[1])
    EndIf
    Sleep(50)
Until False

Func close()
    _GDIPlus_GraphicsDispose($graphic)
    _GDIPlus_Shutdown()
    Exit
EndFunc   ;==>close

:)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×