开发者

Mouse Position in Multiple Windows in XNA

开发者 https://www.devze.com 2023-03-06 14:18 出处:网络
I\'m working on a tile-based game and I was wanting to create a separate window for all the Level Editor information because I don\'t want it overlaid on top of the game and would like live-editing.

I'm working on a tile-based game and I was wanting to create a separate window for all the Level Editor information because I don't want it overlaid on top of the game and would like live-editing.

I created the new window by spawning a new Microsoft.Xna.Framework.Game in a worker th开发者_如何学JAVAread and it all works nicely. Apart from the mouse cursor positions are relative to this new window, not the one that has focus. I've spent about an hour looking around for solutions and even managed to get a custom cursor working instead, but the windows cursor was still active and made other windows active when clicking :? Not Ideal.

Is there something that can reset the mouse's Window Relative coordinates? If not (and I might do it anyway) I'll look at creating another panel on the edge of the game window when the editor is open and add in all the details there, just a separate window seamed cleaner somehow...

Any Ideas?


Here are a couple of ideas. You could keep track of the distances between windows yourself and then add that distance to your mouse position when interacting with the window that needs the adjustment.

Another idea would be to just create 2 different programs and have the editor save it's current info to a file or something and then notify the other that there's a new layout. Correct me if I'm picturing this wrong. It sounds like you have the game running in one window and the level editor in another.

0

精彩评论

暂无评论...
验证码 换一张
取 消