Code: Select all
; Define
EnableExplicit
Enumeration
#WinMain
#WinCursor
#ImgCursor
EndEnumeration
Structure CursorType
Updating.i
Size.i
Timer.i
EndStructure
Global Cursor.CursorType
With Cursor
\Size=150
EndWith
; EndDefine
Procedure InitCursorWindow()
CreateImage(#ImgCursor,Cursor\Size,Cursor\Size,32)
OpenWindow(#WinCursor,0,0,Cursor\Size,Cursor\Size,"",#PB_Window_BorderLess|#PB_Window_Invisible)
SetWindowColor(#WinCursor,#Red)
SetWindowLongPtr_(WindowID(#WinCursor),#GWL_EXSTYLE,#WS_EX_LAYERED|#WS_EX_TOOLWINDOW|#WS_EX_TOPMOST)
StickyWindow(#WinCursor,1)
HideWindow(#WinCursor,0)
EndProcedure
Procedure DrawCursor(uID,uMsg,du,d1,d2)
Protected hdc
Protected ContextOffset.POINT
Protected BlendMode.BLENDFUNCTION
Protected size.Size
Protected mouse.Point
If Cursor\Updating=#Null
Cursor\Updating=#True
hdc=StartDrawing(ImageOutput(#ImgCursor))
DrawingMode(#PB_2DDrawing_AllChannels)
Box(0,0,150,150,RGBA(0,0,0,0))
Circle(75,75,74,$40ffffff)
;Circle(75,75,74,RGBA($FF,$FF,$FF,$01))
Circle(75,75,54,$10000000)
Circle(75,75,34,$40000000)
Circle(75,75,14,$10ffffff)
size\cx=Cursor\Size
size\cy=Cursor\Size
BlendMode\SourceConstantAlpha = 255
BlendMode\AlphaFormat = 1
With BlendMode
\AlphaFormat= #AC_SRC_ALPHA
;\SourceConstantAlpha=10
\BlendOp= 0
\BlendFlags= 0
EndWith
UpdateLayeredWindow_(WindowID(#WinCursor),0,0,@size,hdc,@ContextOffset,0,@BlendMode,2)
StopDrawing()
GetCursorPos_(mouse)
ResizeWindow(#WinCursor,mouse\x-75,mouse\y-75,150,150)
EndIf
Cursor\Updating=#Null
EndProcedure
Procedure Main()
InitCursorWindow()
Cursor\Timer=timeSetEvent_(10,1,@DrawCursor(),#WinCursor,#TIME_PERIODIC)
Repeat
WaitWindowEvent(10)
Until GetAsyncKeyState_(#VK_LBUTTON) & 32768
While Cursor\Updating
Debug "*wait*"
Delay(1)
Wend
timeKillEvent_(Cursor\Timer)
EndProcedure
Main()
