KeyboardInkey()
Syntax
String$ = KeyboardInkey()Description
Returns the last typed character, very useful when easy keyboard input is needed for a game (name in highscore, in game console, etc.).
Example:If InitSprite() And InitKeyboard() And OpenScreen(800,600,16,"") Repeat FlipBuffers() ClearScreen(0, 0, 0) ExamineKeyboard() FullText$ + KeyboardInkey() ; Add the new text to the current one (if any) ; If we press the 'Back' key, delete the last character ; If KeyboardReleased(#PB_Key_Back) FullText$ = Left(FullText$, Len(FullText$)-1) EndIf ; Display the result ; If StartDrawing(ScreenOutput()) DrawingMode(1) FrontColor(128, 255, 0) Locate(20,20) : DrawText("Just type some text...:") Locate(20,40) : DrawText(FullText$) StopDrawing() EndIf Until KeyboardPushed(#PB_Key_Escape) EndIf
Supported OS
Windows, Linux, MacOS X