Window Movement Animation

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

User avatar
paperpusher
Just popping in
Just popping in
Posts: 8
Joined: Fri Mar 12, 2010 22:35

Window Movement Animation

Postby paperpusher » Fri Mar 12, 2010 22:45

I have looked through the forum on the topic of animation and found reference to using UIAE to animate textures.

My question is a bit more simple (I think), I just want to rotate a window on the screen. I have tried to simply rotate a window, but it only updates the view port when I mouse over a button or otherwise generate an event.

How do I Request a Redraw?

I see:
CEGUI::System::getSingleton().isRedrawRequested();
and
CEGUI::System::getSingleton().renderGUI();

but renderGUI only works if something has changed... and rotating a window doesn't trigger it.

Here is my code:

Code: Select all

CEGUI::PushButton* pProducts = (CEGUI::PushButton *)CEGUI::WindowManager::getSingleton().getWindow("cmdProducts");
CEGUI::Vector3 menuRot;
   
while (CurrentState != SHUTDOWN) {
   menuRot = pProducts->getRotation();
   menuRot.d_z+=.1;
   pProducts->setRotation(menuRot);
   
   CEGUI::System::getSingleton().renderGUI();

   Ogre::WindowEventUtilities::messagePump();
 
        ogre->renderOneFrame();
}

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Window Movement Animation

Postby CrazyEddie » Sat Mar 13, 2010 09:03

Hi,

Sounds like a bug - because setting the rotation should trigger the redraw ;) I'll test that and fix any issues I find.

To answer the question, you trigger a redraw via CEGUI::System::signalRedraw. If that does not work, you may need to invalidate the window that you've rotated via CEGUI::Window::invalidate. Though as I say, I'll test it for bugs since it should be automatic.

CE.

User avatar
paperpusher
Just popping in
Just popping in
Posts: 8
Joined: Fri Mar 12, 2010 22:35

Re: Window Movement Animation

Postby paperpusher » Sat Mar 13, 2010 15:01

CEGUI::Window::invalidate did the trick. I am sure the CEGUI::System::getSingleton().renderGUI(); in the code below is not needed.... but it works.

Code: Select all

CEGUI::Window* pLayout = CEGUI::WindowManager::getSingleton().loadWindowLayout((CEGUI::utf8*)"MyNew.layout");
   
CEGUI::PushButton* pProducts = (CEGUI::PushButton *)CEGUI::WindowManager::getSingleton().getWindow("cmdProducts");
    CEGUI::Vector3 menuRot;
       
    while (CurrentState != SHUTDOWN) {
       menuRot = pProducts->getRotation();
       menuRot.d_z+=.1;
       pProducts->setRotation(menuRot);
       pLayout->invalidate();
       CEGUI::System::getSingleton().renderGUI();

       Ogre::WindowEventUtilities::messagePump();

            ogre->renderOneFrame();
    }


Return to “Help”

Who is online

Users browsing this forum: No registered users and 7 guests