BIG Problem,.. box slow at following the cursor..?

BlitzMax Forums/BlitzMax Beginners Area/BIG Problem,.. box slow at following the cursor..?

Apollonius(Posted 2007) [#1]
I've got a big problem. I have a huge sheet of Types for Windows and Buttons which are Dragable by the cursor. My problem is when I drag the Window it's slow at following the cursor and the Buttons are even slower.. its not uber slow its just a few second delay.. it's smooth though.

(3GHZ, Windows Vista, 6600 GeForce 256MB, Using Flip 0/Flip 1.. tried with OpenGL and without.)

Anyone have ever experienced this? Is This bad coding or just BMax being slow? Cuz Basicly XPos=MouseX() which should be exactly on it at all time.

EDITED

I just tried Flip 0, it goes faster now but still not a 100%
because when I move it really fast my mouse overlaps abit on the buttons(which lights them up for a very short period of time) It shouldnt light up cuz i grabbed the window not on the button.. if you get what i mean

EDITED
How do I check for FPS(frame per second)?


AltanilConard(Posted 2007) [#2]
It isn't supposed to be really slow, maybe it has something to do with your code. XPos=MouseX() means your XPos will get updated everytime your program runs trough the main loop, maybe something holds it up.

If you want to check the FPS you'll have to calculate it, there is some FPS code in the code archives I think.


Perturbatio(Posted 2007) [#3]
Graphics 640, 480, 0, 0

While Not KeyDown(KEY_ESCAPE)
Local XPos:Int = MouseX()
Local YPos:Int = MouseY()

DrawRect(XPos, YPos, 20, 20)

Flip
Cls

Wend
End



This doesn't lag for me.


Apollonius(Posted 2007) [#4]
I just fixed my problem this morning,... I had to separate the actual Updating of my objects from the actual Drawing Method of the Object and join it up into my Window's Drawing Method.

Which now runs really great using any Drivers and any Flip.

Now my Buttons follow my Windows at a 100%, the only down side is that my Window doesn't follow my Cursor 100%, it's like 1/2 second delay, which to me is probably a problem with the Dragging Code:

	Method Drag() 
		Local mx:Int=MouseX()
		Local my:Int=MouseY()
		
			' On Dragging
			If MouseDown(1)
				
				If Dragging=True Then
					Xpos=mx-offx
					Ypos=my-offy
				Else
					If(mx > Xpos)And(mx < Xpos+Width)And(my > Ypos)And(my < Ypos+Height)Then
					' Does Once on mouse down
					offx=mx-Xpos
					offy=my-Ypos
					Dragging=True
					EndIf
				EndIf
				
			Else
				If Dragging=True Then Dragging=False
			End If
			
		
	End Method