Change HWND set in device

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
Qps
Posts: 18
Joined: Thu Jan 27, 2011 2:02 pm

Change HWND set in device

Post by Qps »

Hi,

Im rendering my scene in a controls by setting the HWND of the control in the SExposedVideoData.

Code: Select all

irr::video::SExposedVideoData data(m_hwnd);
m_pVideoDriver->beginScene(true, true, 0, data);
The control is placed in a dockable panel, docking and undocking the panel somehow changes the HWND of the control.

In my camera i use the relative position for some calculations.

Code: Select all

m_cursorStartPos = m_pCursorControl->getRelativePosition(); 
m_pCursorControl being a irr::gui::ICursorControl* uses the HWND which is set while creating the device. But since this HWND has changed the value returned by the code shown above is invalid. The scene is rendered as it should, also the key input is handled correctly, however the cursor movements remain an issue as they use the irr::gui::ICursorControl* which uses the invalid HWND.

Is there any way to change the HWND which was set in the constructor of the device and thus also updating the ICursorControl?

Thanks in advance
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Change HWND set in device

Post by CuteAlien »

You can't change that right now, but this certainly looks wrong, we should change that in Irrlicht.

But there is a workaround for you. You can set the dimensions for your new hwnd with cursor->setReferenceRect(rect);
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Qps
Posts: 18
Joined: Thu Jan 27, 2011 2:02 pm

Re: Change HWND set in device

Post by Qps »

Thanks for your quick reply, i will try this workaround.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Change HWND set in device

Post by CuteAlien »

Ok, I've moved it to bugreports as this should be fixed.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Qps
Posts: 18
Joined: Thu Jan 27, 2011 2:02 pm

Re: Change HWND set in device

Post by Qps »

I think that if this is possible the following function might not be needed anymore:

Code: Select all

 
irr::video::SExposedVideoData data(m_hwnd);
m_pVideoDriver->beginScene(true, true, 0, data);
as every thing can just use the hwnd set in the device. Although you could do a quick render to a different HWND this way.
Post Reply