Jump to content

how to pass keyboard and mouse input to just Unigine Gui


photo

Recommended Posts

Due to several reasons I want to handle part (if not all non-gui) keyboard and mouse input on our side and not pass everything to Unigine. However, all things gui in Unigine should keep working properly.

 

As we are using a GLAppQt derivative getting the input first is not the problem. Doing something with input and only passing 'unhandled' would work fine as well. But I need the other way around: pass it to Unigine gui and just gui and handle it further on our side if Unigine gui did not handle it. And if we then did not handle it ourselves maybe then pass it back to Unigine again.

 

For keyboard using Unigine::App::keyPressUnicode seems to work at first glance for passing just to Gui. But it does not report anything back if gui actually handled it and we do not have to consider it further.

 

For mouse I see no immediate equivalent as mouse status is checked during widget update() and not propagated through function calls as keyPress(Unicode).

 

It is not a huge problem to modify Unigine where we need, but I would prefer not modifying anything if unnecessary.

 

Is there a way this behavior can be achieved without any modifications?

 

 

 

Link to comment

for keyboard using Gui::getActivity looks like it might work: pass key to Unigine if gui has some widget in focus, pass nothing if no widget is in focus

 

now for mouse..

Link to comment
  • 2 weeks later...

Hello, Esger!

 

I think the quickest way to handle mouse is to check if the mouse cursor is within widget's bounds. Just a simple loop over root gui widgets and you're done. You can also try to use Gui::getMouseButton and Gui::getMouseGrab functions.

Link to comment
×
×
  • Create New...