GetInputText
InputText$ = GetInputText(InputIndex)
 
Parameters:

    InputIndex = The Input handler you wish to query
Returns:

    InputText$ = The Text that input handler contains
 

      The GetInputText function gets text string from an input handler.





FACTS:


      * The GetInputText function is part of the "Input" expansion library. Therefore in order to use GetInputText in program you need to include that library in your project. To do so, place I.e. #include "Input" at the top of the your program.

      * Need an old school Input replacement, see the StaticInput() function





Mini Tutorial:


      This example demonstrates the use of asynchronous input. The demo just sets up an input handler and render loop. The loop will execute until the input handler is no longer active (the user pressed Enter). It will then display the entered text message before exiting. The interesting thing about this is that since we control the input loop, we can draw pretty much anything you like while input is taking place. Which is represented by a moving circle.


  
  
; Include the Input Library
  #Include "input"
  
  
; limit the FPS rate to 60 frames per second or less
  SetFPS 60
  
  Sw=GetScreenWidth()
  Sh=GetScreenHeight()
  
  
; load the arial font as font #2, size 32
  LoadFont "arial",2,32,0
  
  
; Create a new input prompt at Xpos 20, Ypos=250,
; with a custom starting text
  MyInput     =NewInput(20,250,_
  "Example Async Input (Get Input While Your Game Updates)")
  
  
; set this input routine to use Font #2
  Inputfont MyInput,2
  
; create some variables to hold and position
; and direction of our moving ball
  x#=Rnd(sw)
  y#=Rnd(sh)
  angle#=Rnd(360)
  
  
  Repeat
   ; clear the Screen to black (rgb(0,0,0)
     Cls RGB(0,0,0)
     
     Print FPS()
     
   ; draw and move our circle
     CircleC x#,y#,50,true,RGB(0,255,0)
     x#=x#+CosRadius(angle#,2)
     y#=y#+SinRadius(angle#,2)
     If X#<0 Then x#=0 : angle#=Rnd(360)
     If X#>sw Then x#=sw : angle#=Rnd(360)
     If Y#<0 Then Y#=0 : angle#=Rnd(360)
     If Y#>sh Then Y#=sh : angle#=Rnd(360)
     
     
   ; Call the Input Poll function to update
   ; and draw this input message
     Input(MyInput)
     
     
   ; refresh the display so the user can see it
     Sync
     
   ; Loop until the user hits Enter!
  Until GetInputActive(MyInput)=false
  
; wait until no keys are being pressed
  WaitNoKey
  
  Cls RGB(0,0,0)
  
; Display what the user typed
  Print GetInputText(MyInput)
  
  
; Delete the Input handler
  DeleteInput MyInput
  
  
  
; Refresh the screen and wait for a key to be pressed
  Sync
  WaitKey
  




This example would output.

  
  Example Async Input (Get Input While Your Game Updates)
  

 
Related Info: GetInputActive | Input | KeyState | Mouse | NewInput | Scancode | StaticInput :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com