My pixel by pixel 2D scrolling example with layers

Blitz3D Forums/Blitz3D Beginners Area/My pixel by pixel 2D scrolling example with layers

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

One way to speed up your drawing, is to use the LockBuffer and Unlockbuffer commands, just before and after your image drawing loops. Here is an example I made. Commenting out the commands the first time through, I measured around 2476 milliseconds. Putting in the lock commands, I measured about 385 millseconds.
Graphics 800,600

tile=CreateImage (32,32)
SetBuffer ImageBuffer(tile)

Rect 0,0,32,32,True
SetBuffer BackBuffer()

start=MilliSecs()
LockBuffer BackBuffer()
For loop=0 To 100000
	DrawImage tile,100,100
	Flip False
Next
UnlockBuffer BackBuffer()

SetBuffer FrontBuffer()
Print MilliSecs()-start
MouseWait()
End

So, if you want a significant speed boost, try the lock/unlock buffer commands. Cheers!

(Oh, BTW, the hero looks very much like the McDohl character from Suikoden I.)