Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Windows GL, the game still collects/handles mouse events when the window is no longer active. #4923

Closed
SoundGoddess opened this issue Jun 11, 2016 · 14 comments

Comments

@SoundGoddess
Copy link

This seems like unexpected behavior. Try dragging another application window on top of your game window and then notice how in the background the game is still reacting to mouse events.

@Tzenchor
Copy link
Contributor

That is the standard behaviour on XNA

@SoundGoddess
Copy link
Author

No it isn't.

@SoundGoddess
Copy link
Author

If I load up Stardew Valley and then open up a web browser window in front of it, SDV does not react to the mouse clicks on the web browser. That game is XNA4. If I load up a Windows/GL game and then open a browser window on top of it, the game reacts as if it was the selected window.

@Tzenchor
Copy link
Contributor

I remember from my project having to add a check if window was active to avoid processing input.
Also I have just checked the the code I built for a manual test framework for monogame where I used components from the XNA project without the check and it is receiving and handling input (it is using the DirectX backend)

@kameko
Copy link

kameko commented Jun 12, 2016

I think it's standard behavior for pretty much all game engines to do that. Like @Tzenchor said you have to manually check if the window has focus, and I'm pretty sure that's how all games work, Stardew Valley included. I remember having to check for window focus in a variety of engines and frameworks I've used for making games. It's really not a huge issue, it's just one little conditional.

@mrhelmut
Copy link
Contributor

Game.IsActive is here for this kind of purpose (and probably what Stardew Valley is doing).

@SoundGoddess
Copy link
Author

SoundGoddess commented Jun 12, 2016

ok, thanks for clarifying :)

I still think that this is kind of strange behavior, and that you ought to have to opt in to it if you really need it for something instead of having it default this way. Could be named something like Window.AllowInactiveInputCapture that is set to false by default.

@mrhelmut
Copy link
Contributor

The current MonoGame direction is to be faithful to XNA, for compatibility reasons. While additional features are welcome, default behaviors which differ from XNA are to be avoided (even if they have a positive impact on the original design), for now. At some point, MonoGame will take its own path, but that is not yet scheduled.

@SoundGoddess
Copy link
Author

Gotcha, but at some point I'd say version 4 or 5 it'd make sense to change the namespace from Microsoft.XNA.Framework to Mono.MonoGame and then instead of a focus on legacy support the focus can be on what makes the most sense for the project.

@mrhelmut
Copy link
Contributor

There has been a few discussions which tend towards your suggestion. #3306

@harry-cpp
Copy link
Member

harry-cpp commented Jun 12, 2016

Mono.MonoGame

Mono and MonoGame are 2 completely different things.

@SoundGoddess
Copy link
Author

SoundGoddess commented Jun 12, 2016

Well I was under the impression that this was an extension of Mono project seeing as the github is set up under Mono's official github. But it doesn't really matter if we name it Mono.MonoGame or MonoGame.Framework or whatever else makes the most logical sense; my point was that calling it Microsoft.XNA.Framework ought to be deprecated at some point.

@dellis1972
Copy link
Contributor

I think this is related #4924

@harry-cpp
Copy link
Member

Not a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants