Input (Getkey ?)

BlitzMax Forums/BlitzMax Beginners Area/Input (Getkey ?)

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.

try this:
not perfect but does the job


Graphics 640,480,0

foo$ = gl_input$(10,10,"what is your name? ")

SetColor 255,255,0 ; SetScale(2,2) 

DrawText "hello "+foo$+", how are you?",100,100

flip
waitmouse

End 


'-------------------------------------
Function gl_input$(x,y,prompt$ = "?")

	Repeat
	
		Cls
		DrawText prompt$+m$,10,10
		DrawText key,10,50
		hit_key = 0
		For key = 1 To 226
		
			hit_key = KeyHit(key)
			If hit_key 
				m$ = m$ + Chr(key)
			
				If key = KEY_ENTER
					Return m$
				EndIf
				If key = KEY_BACKSPACE
					l = Len(m$)
					m = m[..l-2]
				EndIf
			EndIf 
		Next
	
 	Flip
	Until KeyHit(KEY_ESCAPE)

End Function