bryanedds

I see that the mouse / keyboard state reflects the state of the mouse / keyboard even when the application is not focused. In a way, this makes perfect sense.

What I'd like to know is what is a good way to make sure my application does not process these events when the app isn't focused or a click happens outside of the app window.

Thanks!




Re: XNA Game Studio Express Ignoring mouse events outside of window / while app is not focused

pitil

by using this :
for not fullscreen :
Resolution_Height = graphics.GraphicsDevice.Viewport.Height;
Resolution_Width = graphics.GraphicsDevice.Viewport.Width;
Resolution_X = graphics.GraphicsDevice.Viewport.X;
Resolution_Y = graphics.GraphicsDevice.Viewport.Y;

you can check if the mouse is inside your game.


for fullscreen :
You have to check if it is fullscreen, if not you can do a pause...

But it is a problem only on windows so you can use some other function not include in xna... (for example for not fullscreen, you can move you windows upper other...)




Re: XNA Game Studio Express Ignoring mouse events outside of window / while app is not focused

Jim Perry

Override the Deactivated and Activated events in the Game object and set a switch that you check in the Update.




Re: XNA Game Studio Express Ignoring mouse events outside of window / while app is not focused

pitil

Yes sorry !!
I don't see that :)

Thanks for the info !