XNA - how to determine which window has focus?

I am thinking of writing an XNA game for Windows. It will have the main game window and another form of WPF in which there are chat controls or debugging information. When I type something into this helper form, obviously I don’t want the main XNA window to display what I type.

What is the best way to do this? I thought that if I could determine if the sub window has focus, I could ignore any keystrokes in my game loop. But to make this definition is not obvious in XNA. How it's done?

+4
source share
1 answer

Check Game.IsActive ( MSDN ) before responding to any input changes.

+9
source

All Articles