Page 1 of 1

Incorrect cursor position after resize the rendering window

Posted: Thu Nov 16, 2006 20:22
by nachilau
Hello,

When I resize my rendering windows, the CEGUI cursor position become different than the actual mouse position. I am using the DirectX9 render, and don't know if I forget to initialize anything. I have test the samples which come with the SDK, and all of them work fine when I resize the rendering windows. I have checked the forum and I find out that someone have the same problem long time ago

http://www.cegui.org.uk/phpBB2/viewtopic.php?t=755&start=0&postdays=0&postorder=asc&highlight=resize

and I try to use the same method to resolve the problem but I found out that some of the functions are obsoleted already. Can anyone give me some ideas about this? Thanks!

Posted: Tue Mar 27, 2007 21:54
by Arcanor
It's a bit late for this reply, but I've just had to solve the same problem and CE's post was helpful to me. Here are the specifics of how I resolved the problem of resizing the GUI to match with the newly resized viewport. Note that I'm using Ogre 1.4.x.

Code: Select all

void MyApp::ResizeGUIToRenderWindow(void)
{
   Ogre::Viewport* vp = mCamera->getViewport();

   mGUIRenderer->setDisplaySize(CEGUI::Size(Ogre::Real(vp->getActualWidth()), Ogre::Real(vp->getActualHeight())));
   mMainGuiSheet->setMaxSize(CEGUI::UVector2( CEGUI::UDim(0, Ogre::Real(vp->getActualWidth())), CEGUI::UDim(0, Ogre::Real(vp->getActualHeight()))));
   mMainGuiSheet->setSize(CEGUI::UVector2( CEGUI::UDim(0, Ogre::Real(vp->getActualWidth())), CEGUI::UDim(0, Ogre::Real(vp->getActualHeight()))));
   CEGUI::MouseCursor::getSingleton().setConstraintArea(NULL);
}


I hope this is able to help someone.