|
NewInput | ||
InputIndex = NewInput(Xpos, Ypos, StartingText$) | ||
Parameters: Xpos = The Xpos of the input cursor Ypos = The Ypos of the input cursor StartingText$ = The starting text of the input handler |
||
Returns: InputIndex = The Index of the newly created input handler |
||
The NewInput function creates an asynchronous input handler ready for use. Unlike the traditional input statement found in older flavors of basic (which isn't very useful for games ) PB's input expansion library gives us the ability to manage/poll user text input during each update of your game. So you can receive input while your game is running! The "Input" library manages inputs handlers with a collection of simple functions. These functions allow us to create/delete/poll and query the important properties of the input handler. FACTS: * The NewInput function is part of the "Input" expansion library. Therefore in order to use NewInput 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. * When an input handler is created with NewInput the handler defaults to Activate mode. When Activate mode is enabled the input handler is active (True) and can receive text input, when it's False, the handler will no longer receive input from the user (the User Hit Enter). You can query the input state using the GetInputActive() function. * Use Input() the query the input handler each update * 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.
This example would output.
|
Related Info: | DeleteInput | GetInputActive | GetInputText | Inkey$ | Input | InputFont | KeyState | Mouse | Scancode | StaticInput : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |