Because previous codes assume that the state of the internal cursor count is 0 when starting the loop, here a little enhancement:
ShowCursor(Flag): Flag=#False --> Hide cursor, Flag=#True --> Show cursor
Works what ever the number of time that ShowCursor_ was called before.
But I haven’t find another way then calling several time ShowCursor_ to adapt the internal cursor count.
PLEASE, before trying, suppress the ‘_’ in the third line
Made it unless the code does appared correctly (someone knows how to disable the '<' character under BBcode?)
Code: Select all
Procedure ShowCursor(Flag); Flag=#True/#False, show/hide cursor
Static CursorState
If Flag <_> CursorState
CursorState = ShowCursor_(Flag)
If (CursorState >=0 And Flag = 0) Or (CursorState <0 And Flag)
Repeat
Until ShowCursor_(Flag) =Flag-1
EndIf
CursorState =Flag
EndIf
EndProcedure
OpenWindow(0,0,0,320,240,"Test",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
For i=0 To 10000
ShowCursor_(#True)
Next
Repeat
If WindowMouseX(0)=-1 Or WindowMouseY(0)=-1
ShowCursor(#True)
Else
ShowCursor(#False)
EndIf
StartDrawing(WindowOutput(0))
Circle(WindowMouseX(0),WindowMouseY(0),5,#Red)
StopDrawing()
Until WaitWindowEvent(1) = #PB_Event_CloseWindow