GW2 Cursor

12/20/2020 11:15 labyhub#1
Hi all, is it possible to change the classic cursor to GW2? Even just changing its size or color.

Hallo zusammen, ist es möglich den klassischen Cursor auf GW2 zu ändern?Entschuldigung für meinen nicht so guten Deutsch

TY ^_^
12/22/2020 00:54 eqtunare#2
yes and no.

A lot of people use a program called yolomouse. I basically just changes the default cursor to one of the available ones in the program. The problem I found with it is that it only changes the default cursor, and not when it changes to the merchant, red/green, disappears when using the rt-mouse button, etc. I found it very annoying.

Instead, I found an autoit script that always has the mouse up on screen using a yolomouse cursor thats being reproduced. I did find that the original WinActive used a lot more cpu, so changed it to ProcessExists, which doesn't seem to cause much lag.

Code:
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <Constants.au3>
#include <Misc.au3>

Global Const $pi = 3.14159265358979
;HotKeySet("{ESC}", "_Bye")

$iCircleR = 30; <=== Edit this for different circle radius (in pixels)
$iCircleD = $iCircleR * 2
Global $radius = 0 ;radius of movement of the blob mouse cursor to centre of circle blob
Global $angle = 4
Global $incr = 3
$pt = MouseGetPos()

$hChild = GUICreate("", $iCircleD, $iCircleD, $pt[0] - $iCircleR, $pt[1] - $iCircleR, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED, $WS_EX_TRANSPARENT))
_WinAPI_SetLayeredWindowAttributes($hChild, 0xFFFFFF, 100)
GUISetBkColor(0x00a3ff)
$a = _CreateRoundRectRgn(0, 0, $iCircleD, $iCircleD, $iCircleD, $iCircleD)
_SetWindowRgn($hChild, $a)

$hChild2 = GUICreate("", $iCircleD, $iCircleD, $pt[0] - $iCircleR, $pt[1] - $iCircleR, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED, $WS_EX_TRANSPARENT))
GUISetBkColor(0x0000F4)
GUICtrlCreateGraphic(0, 0, $iCircleD, $iCircleD)
GUICtrlSetGraphic(-1, $GUI_GR_PENSIZE, 2)
GUICtrlSetGraphic(-1, $GUI_GR_NOBKCOLOR)
GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x000000)
GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, $iCircleD, $iCircleD)
GUICtrlCreateGraphic(3, 3, $iCircleD-6, $iCircleD-6)
GUICtrlSetGraphic(-1, $GUI_GR_PENSIZE, 3)
GUICtrlSetGraphic(-1, $GUI_GR_NOBKCOLOR)
GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xffffff)
GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, $iCircleD-6, $iCircleD-6)
GUICtrlCreateGraphic(7, 7, $iCircleD-14, $iCircleD-14)
GUICtrlSetGraphic(-1, $GUI_GR_PENSIZE, 5)
GUICtrlSetGraphic(-1, $GUI_GR_NOBKCOLOR)
GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x00a3ff)
GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, $iCircleD-14, $iCircleD-14)
GUICtrlCreateGraphic($iCircleR-2, $iCircleR-2, 4, 4)
GUICtrlSetGraphic(-1, $GUI_GR_PENSIZE, 2)
GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xffffff)
GUICtrlSetGraphic(-1, $GUI_GR_DOT, 2,2)
_WinAPI_SetLayeredWindowAttributes($hChild2, 0x0000F4)

;GUISetState(@SW_SHOWNOACTIVATE, $hChild)
$winstate = 0;

While 1
    Sleep(15)

	;If WinActive("Guild Wars 2","") And $winstate = 0 Then
	If ProcessExists("gw2-64.exe") And $winstate = 0 Then
		ConsoleWrite("1")
		GUISetState(@SW_SHOWNOACTIVATE, $hChild)
		GUISetState(@SW_SHOWNOACTIVATE, $hChild2)
		_WinAPI_SetWindowPos($hChild, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_NOACTIVATE, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOSENDCHANGING))
		_WinAPI_SetWindowPos($hChild2, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_NOACTIVATE, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOSENDCHANGING))
		$winstate = 1
	;ElseIf Not WinActive("Guild Wars 2","") And $winstate = 1 Then
	ElseIf Not ProcessExists("gw2-64.exe") And $winstate = 1 Then
		ConsoleWrite("0")
		GUISetState(@SW_HIDE, $hChild)
		GUISetState(@SW_HIDE, $hChild2)
		$winstate = 0
	EndIf
	If Not _IsPressed('02') And $winstate = 1 Then
		$pt = MouseGetPos()
		MoveBlob($pt)
	EndIf
WEnd


Func _CreateRoundRectRgn($l, $t, $w, $h, $e1, $e2)
    $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $l, "long", $t, "long", $l + $w, "long", $t + $h, "long", $e1, "long", $e2)
    Return $ret[0]
EndFunc   ;==>_CreateRoundRectRgn

Func _CombineRgn(ByRef $rgn1, ByRef $rgn2)
    DllCall("gdi32.dll", "long", "CombineRgn", "long", $rgn1, "long", $rgn1, "long", $rgn2, "int", 3)
EndFunc   ;==>_CombineRgn

Func _SetWindowRgn($h_win, $rgn)
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1)
EndFunc   ;==>_SetWindowRgn

Func _bye()
    Exit
EndFunc   ;==>_bye

Func Setangle()
    $angle = Mod($angle + $incr, 360);degrees
EndFunc   ;==>Setangle

Func MoveBlob($mousePos)
    $radAng = $angle * $pi / 180
    Local $x = $mousepos[0] + $radius * Cos($radAng) - $iCircleR
    Local $y = $mousepos[1] + $radius * Sin($radAng) - $iCircleR
    WinMove($hChild, "", $x, $y)
    WinMove($hChild2, "", $x, $y)
EndFunc   ;==>MoveBlob
01/12/2021 01:17 labyhub#3
Thanks :) I'll take a look ;)