How to input text in game? RRS feed

  • Question

  • I wonder how to get the user input text from (virtual) keyboard in a full screen DirectX game.

    And how can I convert a scan code to ascii ?  Those APIs are desktop only.

    • Edited by Raptor K Monday, April 2, 2012 5:33 PM
    Monday, April 2, 2012 5:28 PM


  • Hi RaptorCK16,

    You can get the CoreWindow KeyUp and KeyDown events. If you want translated characters you can use CoreWindow.CharacterReceived.

    This is demonstrated in the Marble Maze sample (and likely the other DirectX samples since it's in the DirectXApp class): take a look at how the KeyUp and KeyDown events are hooked up in DirectXApp::SetWindow. CharacterReceived would be handled similarly.


    Tuesday, April 3, 2012 2:39 AM