在Java IDE上调试3D应用程序时如何防止鼠标抓取? [英] how to prevent mouse grab while debugging 3D application on a java IDE?

查看:126
本文介绍了在Java IDE上调试3D应用程序时如何防止鼠标抓取?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大多数3D应用程序抓住鼠标。这意味着操作系统光标被隐藏,只有3D应用程序光标被显示(并且只在应用程序中)。

如果是游戏,光标完全隐藏,所以你可以环顾四周移动使用鼠标的相机。



当我使用Eclipse IDE或NetBeans IDE进行调试时,会发生抓取鼠标事件。

休息时点到达,应用程序将不会响应,直到通过IDE,我命令它继续运行在调试模式。

如果我设法使应用程序继续运行,我可以释放鼠标(un-抓住,将鼠标光标放回到操作系统)通过在应用程序中打开一个控制台,例如将使其工作。



虽然我没有操作系统鼠标光标可用,限制键盘,使调试过程变得非常复杂。



如何解决问题?

解决方案

我发现必须使用一个简单的技巧。



添加一个评估结果的手表:

org.lwjgl.input.Mouse.setGrabbed(false)



在eclipse上,该手表可能需要可见或其评估可能会被跳过。



here 我正在寻找一个IDE独立的解除鼠标的方式。



比释放鼠标抓取更多的东西



后来,这还不够,我想做更多的事情,如自动暂停应用程序和清除键盘缓冲区,所以如果断点或异常发生在任何无法访问我创建的函数的代码这一切,这个功能不会奏效。



解决方法是创建一个线程来监视应该在主应用程序线程上更新的一些变量;如果该变量未更新1秒,请调用该函数解除等等。


Most 3D applications grab the mouse. This means the OS cursor is hidden and only the 3D application cursor is shown (and only within the application).
In case it is a game, the cursor is completely hidden so you can "look around" moving the camera with the mouse.

While I am debugging with Eclipse IDE or NetBeans IDE, the "grab mouse" event happens.
When a break point is reached, the application will not respond until, thru the IDE, I command it to continue running in the debug mode.
If I manage to make the application continue running I can release the mouse (un-grab, give back the mouse cursor to the OS) by opening a console within the application for example will make it work.

While I have no OS mouse cursor available, I get limited to the keyboard, what make things become really complicated on debugging procedure.

how to work around that?

解决方案

I found that a simple trick must be used.

Add a watch that evaluates this:
org.lwjgl.input.Mouse.setGrabbed(false)

On eclipse, that watch may require to be visible or its evaluation may be skipped.

here I am looking for an IDE independent way of ungrabbing mouse.

Doing more things than releasing mouse grab:

Later on tho, it did not suffice, I wanted to do more things like auto pause the application and clear keyboard buffer, so, if the breakpoint or exception happens at any code that have no access to the function I created that does it all, that function would not work.

The workaround for that was to create a thread to monitor some variable that should be updated at the main application thread; if that variable is not updated for 1s, call the function to ungrab and etc.

这篇关于在Java IDE上调试3D应用程序时如何防止鼠标抓取?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆