Monkey
Store
Community
Apps
Contact
Login or Signup

is my pc to slow or monkey ? drawrect(mousex,my)

Monkey Programming Forums/Monkey Programming/is my pc to slow or monkey ? drawrect(mousex,my)

GC-Martijn(Posted 1+ years ago) #1
The rect is keeping out of sync with the mouse cursor.
Is this becauce my pc is to slow ?

Or in other words, the mouse cursor is moving to fast.
How to handle this ?

Or maybe my pc is to slow :S

Strict
Import mojo

Class MyGame Extends App
	Field XMouse:Float
	Field YMouse:Float
	
	Method OnCreate:Int()
		SetUpdateRate 30 ' or 60
		Return 0
	End
	
	Method OnUpdate:Int()
		XMouse = MouseX()
		YMouse = MouseY()
		Return 0
	End
	
	Method OnRender:Int()
		Cls
		SetColor 255,0,0
		DrawRect(XMouse,YMouse,20,40)
		Return 0
	End
End

Function Main:Int()
	New MyGame
	Return 0
End




Raz(Posted 1+ years ago) #2
While I am not sure of the extent you are seeing this lag, I'd wager that there will always be lag to some degree. I can notice it at 30 FPS and it's still noticeable at 60 FPS (though not as much).

Maybe you could hide the mouse cursor to make the lag less obvious?


muddy_shoes(Posted 1+ years ago) #3
The OS mouse cursor is bound to be ahead of your game as the OS reports the mouse position which is then handled in the update and later used in the render.


therevills(Posted 1+ years ago) #4
What target are you testing on?

This could also be down to vsync...


GC-Martijn(Posted 1+ years ago) #5
at the moment the target is html5

maybe I have to hide the cursor, so there is no visible lag anymore.
And I have to check this with a other pc.


Fryman(Posted 1+ years ago) #6
this is essentially the same method I used to draw the light in pizza pestz and never noticed a problem with lag (drawing 4 recs and 2 images with alpha) my money is on pc speed like you said or possibly even your browser?

Have you tested it in both Chrome and FF?


Farflame(Posted 1+ years ago) #7
Wasn't there a problem with Setcolor being really slow?


muddy_shoes(Posted 1+ years ago) #8

this is essentially the same method I used to draw the light in pizza pestz and never noticed a problem with lag


You can't see the OS cursor in your submitted Pizza Pestz app. That makes it difficult to see the lag.


MikeHart(Posted 1+ years ago) #9
Using SetColor in HTML5 is bring your FPS down for sure and you will notice a lag.


GC-Martijn(Posted 1+ years ago) #10
It was a weird hardware/software problem, I reinstalled windows with the latests drivers and now its moving as fast like light ;)


Fryman(Posted 1+ years ago) #11
I do hide the cursor on it but I dont when debugging, the lag just isnt there in pizzapests

glad you sorted it :p