I have an application using the Ogre3D to create multiple render windows, and I’m using the solution posted here to support non-exclusive mouse input to these windows. However, I find that I have to physically click on a render window before it regains focus, whereas I’d really like the render windows to gain focus on a mouseover event. Is it possible to capture a mouseover event on an unfocused render window in Ogre3D/OIS and then subsequently set the focus for the render window?
I have an application using the Ogre3D to create multiple render windows, and I’m
Share
To support this kind of functionality using Ogre3D in Windows, I had to implement a singleton object that kept a collection of all of the instantiated displays.
Then, in my UIFrameListener (which derives from Ogre3D’s ExampleFrameListener), I transform the mouse window coordinates to global screen coordinates. If the mouse happens to reside outside of the window region, I apply the relative mouse movement to the last recorded mouse position; otherwise, I simply apply the absolute mouse position within the window:
And in
InputProcessor::processMouseMoved(), I determine which window the mouse cursor is in (if any), and then set the focus appropriately, i.e.And in the implementation of
Display, I have a methodDisplay::setFocus()that sets the focus on the appropriate window: