GetStringTyped
Introduction
The Keyboard class can be used for text input. Unfortunately, at the time of this writing the keyboard only understands the English keyboard. The GetStringTyped method returns the string that was typed during the last frame. It is possible for multiple keys to be pressed during a frame and the GetStringTyped method also considers whether the Shift key is pressed.
Code Example
The following code creates a Text object which displays the string typed.
Add the following using statement:
in your Game class scope:
Replace Initialize with the following:
Copy/Paste
GetStringTyped supports ctrl+c and ctrl+v for copy and paste; however, your game must be set to use [STAThread]. For more information, see this page.
Last updated