Simple user in put example
Monkey Forums/Monkey Beginners/Simple user in put example
| ||
| Can someone show me simple example code of how to use GetString() Thanks |
| ||
Simplest user input example using GetChar(), without handling special chars (TAB, RETURN, ..):Import mojo
Class Game Extends App
Field text:String
Method OnCreate()
EnableKeyboard()
End
Method OnUpdate()
Local char:Int
Repeat
char = GetChar()
If char
If char = CHAR_BACKSPACE
Self.text = text[..text.Length()-1]
Else
Self.text += String.FromChar(char)
Endif
Endif
Until char = 0
End
Method OnRender()
Cls(0,0,0)
DrawText(Self.text,50,50)
End
End
Function Main()
New Game()
End |
| ||
| Thanks -- |