polled input on a MaxGUI canvas?

BlitzMax Forums/BlitzMax Beginners Area/polled input on a MaxGUI canvas?

Edit: Maybe this wasn't what you were asking, but someone else might have use of it, or a comment on my crummy code.

I have this old wonky function I wrote ages ago. I'm sure there's some better solution. I haven't looked at polled input yet.

Graphics 640,480,0 ' Windowed

Global useleft, useright, useup, usedown ' Keys
Global x=320,y=240 ' Player

SetClsColor 16,31,63
SetColor 255,191,63


While Not KeyHit(KEY_ESCAPE)

	Cls
	check_input()
	check_player()
	
	DrawRect x-8,y-8,16,16
	Flip

Wend



Function check_player()

	If useleft=1
	useleft=0
	x=x-2
	EndIf
	
	If useright=1
	useright=0
	x=x+2
	EndIf
	
	If useup=1
	useup=2
	y=y-8
	EndIf
	
	If usedown=1
	usedown=2
	y=y+8
	EndIf
	
End Function 


Function check_input()

	If useleft=0 And KeyDown(KEY_LEFT) Then useleft=1
	If Not KeyDown(KEY_LEFT) Then useleft=0
	
	If useright=0 And KeyDown(KEY_RIGHT) Then useright=1
	If Not KeyDown(KEY_RIGHT) Then useright=0
	
	If useup=0 And KeyDown(KEY_UP) Then useup=1
	If Not KeyDown(KEY_UP) Then useup=0
	
	If usedown=0 And KeyDown(KEY_DOWN) Then usedown=1
	If Not KeyDown(KEY_DOWN) Then usedown=0

End Function