Cuatom Cursor Pointer

BlitzMax Forums/BlitzMax Programming/Cuatom Cursor Pointer

Hi,
The custom cursor module works with Maxgui but not with a single graphics application window. In our project it is required to do this. Can the code be modified for this.
Regards,
Ramesh

If you are using a Graphics window...

use HideMouse() to make the standard pointer invisible.

and then track the mouse position with MouseX() and MouseY(), drawing your own image at that location...

Does anyone know what at what Hz rate the mouse position is updated? Is it independent from the Hz rate of the display?
If I do an update at 120Hz, will it be pointless?

HideMouse() .. is too slow.Isn't it possible to do the same with changecursor.mod
Regards

How is HideMouse() too slow?

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)


What code are you trying?
I have MaxGUI and this works for me in 'non-GUI' mode :
Strict 
Local n:Int=0
Graphics 800,600,32
While Not KeyHit(KEY_ESCAPE)
	Cls
	SetPointer n
	Flip
	If MouseHit(1) n:+1
Wend

Can't you use the source to see how its done and then set-up your own?