Why so slow.

Blitz3D Forums/Blitz3D Beginners Area/Why so slow.

iceman(Posted 2004) [#1]
I'm quite new to blitzplus and I wonder why tis image moves so slow over the screen?
I just want to move the image 1 pixel at the time.

While Not KeyHit (1)
Cls
DrawImage image,x,y
x=x+1

VWait
Flip

Wend


Shambler(Posted 2004) [#2]
The speed the image moves is going to be based on the refresh rate of your monitor.

This is because VWait waits for the vertical blank and so does Flip so in effect you may be slowing it down by waiting twice as long as you have to.

The reason we wait for the vertical blank is so that graphics on screen are not changing at the same time that they are being drawn, because this will result in the image tearing.

Whether or not you want to stop this is up to you, try these two examples and see what you think.

;This wait for the vertical blank
While Not KeyHit (1) 
Cls 
DrawImage image,x,y 
x=x+1 
Flip 
Wend



and this


;This does not wait for the vertical blank
While Not KeyHit (1) 
Cls 
DrawImage image,x,y 
x=x+1 
Flip False
Wend 



iceman(Posted 2004) [#3]
Thanks lad.