Irrlicht Gui 鼠标无法单击按钮
我正在 Irrlicht (C++) 中制作我的第一个游戏,这是一个带有鼠标控制的 RTS
,当您选择一个图块(通过单击它)时,它会亮起,屏幕上会出现一些 gui 按钮(请注意,不是在 gui 窗口中,我喜欢这样):
http://i1139.photobucket.com/albums/n549/Adam_Halley-Prinable/Untitled2.png
但是,由于我切换到鼠标控制,按钮不会记录我的鼠标点击。单击直接穿过按钮并选择后面的图块:
http:// /i1139.photobucket.com/albums/n549/Adam_Halley-Prinable/Untitled3.png
有办法吗我可以说“按钮获得点击的最高优先级”吗? 我正在使用 MyEventReceiver,我用它来接受鼠标点击等等。
非常感谢:D
I'm making my first game in Irrlicht (C++), an RTS with mouse control
and when you select a tile (by clicking on it) it lights up and some gui button appear on the screen (not in a gui window mind you, I like it this way):
http://i1139.photobucket.com/albums/n549/Adam_Halley-Prinable/Untitled2.png
However, since i switched to mouse control, the buttons wont register my mouse clicks. The click goes straight through the button and selects the tile behind instead:
http://i1139.photobucket.com/albums/n549/Adam_Halley-Prinable/Untitled3.png
Is there a way I can say "Buttons get top priority for clicks"?
I'm using MyEventReceiver, which i've messed around with to accept mouse clicks and that.
Thanks a bunch :D
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果其他人也有同样的问题,我会告诉你我是如何解决的:)
浏览 MyEventReceiver.h 并删除鼠标部分中的所有“return true;”。
不要问我为什么,但它确实有效,而且似乎没有副作用。确保保留“return false;”在该部分的末尾。
If anyone else has the same problem, ill tell you how I solved it :)
Go through the MyEventReceiver.h and get rid of all the "return true;"'s in the mouse section.
Don't ask me why, but it works, and appears to have no side effects. Make sure you leave the "return false;" at the end of the section there.
您的事件接收器在 GUI 访问事件之前触发,如果您想将其传递给 GUI,则可以通过手动将其发布到事件接收器中的 GUIEnvironment 来完成此操作。
Your event receiver fires before the GUI gets access to the event, if you want to pass it to the GUI then you can do this by manually posting it to the GUIEnvironment in your event receiver.