Hidemouse is not slow but to display a custom cursor from with in a blitzmax application makes it seem slow. the reason is that you have to wait for flip function to update the custom "drawimage" cursor while the mouse is updated at the rate windows is updated. the drawimage cursor will only be desplayed as fast as the rate bmax refresh rate is set and is why it seems there is a lag when displaying a custom cursor. the most effective way is to update the window cursor with a custom cursor. even then dragging items will allways have a lag relative to the bmax program screen update.
to ilustrate my point here is a little program first run it as is then run it with flip(0)
SuperStrict
Type Tbox
Field x% 'object x
Field y% 'object y
Field msx% 'mouse x
Field msy% 'mouse y
Field Width% 'object width
Field Height% 'object height
Field inuse% 'object selected flag
Field dragging% 'mouse dragging object flag
Field Oldmx% ' old mouse x
Field Oldmy% ' old mouse y
' create a box(square) object
Function Create:tbox(x%,y%,Width%,Height%)
Local box:Tbox = New Tbox
box.x = x
box.y = y
box.Width = width
box.Height = Height
box.dragging = False
box.inuse = False
Return box
End Function
' test to see if mouse is width in the box/squre object
Method mouseinbox%()
If msx < Self.x Return False
If msx > (Self.x+Self.Width) Return False
If msy < Self.y Return False
If msy > (Self.y+Self.Height) Return False
Return True
End Method
' move object to new position
Method shift()
Self.x :+(msx-oldmx)
Self.y :+(msy-oldmy)
End Method
' check to see if mouse was moved
Method mousemove%()
If oldmx <> msx Return True
If oldmy <> msy Return True
Return False
End Method
' draw Object
Method getxy(x% Var,y% Var)
x = Self.x
y = Self.y
End Method
' animate box
Method animate()
msx = MouseX() 'assign to variable to avoid continuous mouse function calls
msy = MouseY() ' '' ''
If MouseDown(1)
If dragging = True
If mousemove() shift() ' set new position of object
Else
If mouseinbox() And inuse = False
dragging = True ' find box and allow dragging'
Else
inuse = True 'prevent any more selection of object/s
EndIf
EndIf
Else
If dragging = False
inuse = False ' allow selection of object/s
Else
dragging = False ' if mouse is not pressed stop moving object
EndIf
End If
oldmx = msx ' store mouse current position for futere use
oldmy = msy ' '' '' ''
End Method
End Type
Graphics 800,600,32
Local x% = 200, y% = 200
Local box:tbox = Tbox.Create(x,y,20,20) 'set start position and area to drag. (x,y,width,height)
Repeat
Cls
box.animate()
box.getxy(x,y)
SetColor 255,255,255
DrawRect x,y,20,20 'even if dragging area is 20 by 20 the object can be any size.
SetColor 140,180,140
DrawRect x,y+20,20,20
Flip
Until KeyDown(key_escape)