Jump to content

_Angle(x,y) relevant to center of screen.


gvus
 Share

Recommended Posts

$centerx=@DesktopWidth / 2
$centery=@DesktopHeight / 2

$CALx=0
$CALy=0
While 1
Local $pos = MouseGetPos()
If $pos[0] > $centerx Then
$CALx=$centerx-$pos[0]
ElseIf $pos[0] < $centerx Then
$CALx=$centerx+$pos[0]
EndIf
If $pos[1] > $centery Then
$CALy=$centery-$pos[1]
ElseIf $pos[1] < $centery Then
$CALy=$centery+$pos[1]
EndIf
ToolTip(_Angle($CALx,$CALy ))
WEnd

Func _Angle($X, $Y)

    Local $CX = $centerx, $CY = $centery

    If ($CX = $X) And ($CY = $Y) Then
        Return SetError(1, 0, -1)
    EndIf

    Local $Grad = ($Y <= $CY) * 180 - ATan(($CX - $X) / ($CY - $Y)) * 180 / 3.1415926535897932384626 + 90

    If $Grad = 360 Then
        $Grad = 0
    EndIf
    Return $Grad
EndFunc   ;==>_Angle

It sort of works but  doesn't.

can I get some help here?

Link to comment
Share on other sites

Currently I'm sick and my brain doesn't work well but you can try this:

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...