Grabbing key presses

BlitzMax Forums/BlitzMax Beginners Area/Grabbing key presses

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.

Here you have a 'cursor' version of the TwoEyedPete
routine.

Graphics 640, 480, 0

Local Line$

Repeat
	Cls                       
	Local OutputText:String = " > " + Line$
	DrawText OutputText, 10, 100 	
	If MilliSecs() mod 800 < 400 Then DrawRect(10+TextWidth( OutputText), 100,2,TextHeight("|"))
	Flip 
	Local char = GetChar()
	If char<>0 Then
		Print char 'Debug porpouses, check for spetial characters not being displayed in the BM window becouse of a incomplet default font.
		Select True
			Case char >= 32
				Line$ :+ Chr(char)
				
			Case char = 8
				Line$ = Line$[..Line$.length - 1]
				
			Case (char = 27) or (char = 13)
				Exit
		End Select     
	EndIf
	FlushMem
Forever

Notify Line$

End