0

UrhoSharp example app from UrhoSharp template for Visual Studio should exit when ESC key is pressed:

Input.SubscribeToKeyDown(args => { if (args.Key == Key.Esc) Exit(); });

However, it seems that it does not.

I have found that I need to click the app window first and then press ESC. The problem seems to be caused that the app window doesn't have a focus when the app starts. (App's console window has focus when app starts.)

How to give focus to the app window in UrhoSharp?

TN.
  • 18,874
  • 30
  • 99
  • 157

1 Answers1

1

Are you starting the program via the debugger with F5? If so, then use Ctrl+F5 instead to 'start without debugging' and the templates main window should have focus.

I also usually set the mouse to visible as a default when starting on these projects via:

Input.SetMouseVisible(true, false);

  • Thx for the idea. It also works with debugging, when Visual Studio hosting process is disabled. – TN. Jul 06 '16 at 10:16