Keyboard buffer problem(?)

Blitz3D Forums/Blitz3D Programming/Keyboard buffer problem(?)

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.

Hi all.

I have a really strange problem in my program.
When I run it without holding any keys down, it works perfectly.
I can then move the little white square around with the arrow keys.

But if I hold a key down (any key) when I hit F5 to run the program from the B3D IDE, it's as if the program locks up. No keypresses seem to register.
It's like the keyboard buffer is filling up and locking the program or something.

I've tried FlushKeys() but with no success.
Can anyone help?

Graphics3D 800,600,32,2
SetBuffer BackBuffer()

Const KEY_LEFT=203
Const KEY_RIGHT=205
Const KEY_UP=200
Const KEY_DOWN=208

Global theMesh
Global theSurface
Global theVertex[3]

Global pMan
Global cam

setupStuff()

Repeat
	UpdateCamera()
	RenderWorld
	Flip True
Until KeyHit(1)

End

Function setupStuff()
	cam=CreateCamera()
	CameraRange cam,0.001,1000.0
	CameraViewport cam,0,0,GraphicsWidth(),GraphicsHeight()

	theMesh=CreateMesh()
	theSurface=CreateSurface(theMesh)

	theVertex[0]=AddVertex(theSurface,-0.5,0.0,0.5,0,0)
	theVertex[1]=AddVertex(theSurface,0.5,0.0,0.5,1,0)
	theVertex[2]=AddVertex(theSurface,0.5,0.0,-0.5,1,1)
	theVertex[3]=AddVertex(theSurface,-0.5,0.0,-0.5,0,1)
	
	AddTriangle(theSurface,theVertex[0],theVertex[1],theVertex[3])
	AddTriangle(theSurface,theVertex[2],theVertex[3],theVertex[1])
	
	RotateEntity cam,90.0,0.0,0.0,True
	EntityParent theMesh,cam,True
	PositionEntity theMesh,0.0,0.0,2.0,False

	pMan=CreateSprite(theMesh)
	PositionEntity pMan,0.0,0.0,0.0
	ScaleSprite pMan,0.1,0.1
End Function

Function UpdateCamera()
	Local manMove#=0.02

	If KeyDown(KEY_LEFT) Then
		TranslateEntity pMan,-manMove,0.0,0.0
	EndIf

	If KeyDown(KEY_RIGHT) Then
		TranslateEntity pMan,manMove,0.0,0.0
	EndIf

	If KeyDown(KEY_UP) Then
		TranslateEntity pMan,0.0,0.0,manMove
	EndIf

	If KeyDown(KEY_DOWN) Then
		TranslateEntity pMan,0.0,0.0,-manMove
	EndIf
End Function