Incorrect cursor position after resize the rendering window

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

nachilau
Just popping in
Just popping in
Posts: 5
Joined: Thu Nov 09, 2006 07:14

Incorrect cursor position after resize the rendering window

Postby nachilau » Thu Nov 16, 2006 20:22

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!

Arcanor
Not too shy to talk
Not too shy to talk
Posts: 38
Joined: Sat Jan 27, 2007 14:03
Contact:

Postby Arcanor » Tue Mar 27, 2007 21:54

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.
Arcanoria - a SMORPG project - http://www.arcanoria.com


Return to “Help”

Who is online

Users browsing this forum: No registered users and 20 guests