Page 1 of 1

Window Movement Animation

Posted: Fri Mar 12, 2010 22:45
by paperpusher
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();
}

Re: Window Movement Animation

Posted: Sat Mar 13, 2010 09:03
by CrazyEddie
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.

Re: Window Movement Animation

Posted: Sat Mar 13, 2010 15:01
by paperpusher
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();
    }