XNA 中多个窗口中的鼠标位置

发布于 2024-11-07 13:04:33 字数 378 浏览 3 评论 0原文

我正在开发一款基于图块的游戏,我想为所有关卡编辑器信息创建一个单独的窗口,因为我不希望它覆盖在游戏之上并且希望进行实时编辑。

我通过在工作线程中生成一个新的 Microsoft.Xna.Framework.Game 创建了新窗口,一切运行良好。除了鼠标光标位置是相对于这个新窗口而言的,而不是相对于具有焦点的窗口而言。 我花了大约一个小时寻找解决方案,甚至设法让自定义光标正常工作,但窗口光标仍然处于活动状态,并且在单击 :? 时使其他窗口处于活动状态。不理想。

有没有什么可以重置鼠标的窗口相对坐标? 如果没有(而且我可能会这样做),当编辑器打开时,我会考虑在游戏窗口边缘创建另一个面板,并在其中添加所有细节,只是一个单独的窗口以某种方式接缝更干净......

任何想法?

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 thread 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

过去的过去 2024-11-14 13:04:33

这里有一些想法。您可以自己跟踪窗口之间的距离,然后在与需要调整的窗口交互时将该距离添加到鼠标位置。

另一个想法是创建两个不同的程序,让编辑器将其当前信息保存到文件或其他内容中,然后通知另一个程序有新的布局。如果我想象错了,请纠正我。听起来好像您在一个窗口中运行游戏,而在另一个窗口中运行关卡编辑器。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文