Page 1 of 1

what's the update frequency in cegui?

Posted: Wed Dec 22, 2010 08:37
by spracle
better if anyone can talk about more information about this :D

Re: what's the update frequency in cegui?

Posted: Wed Dec 22, 2010 13:06
by uelkfr
There is no constant frequency. It limited by your hardware (CPU, GPU, RAM speed, bus speed, algorithm optimization, etc). The CEGUI lib's overhead is very low, because CEGUI Team optimizes speed in each release.

The animation speed is implemented through injectTimePulse() function. I think you are curious why the delta is in float data type, not in integer milleseconds. Well because all animation is calculated in floats, so it better to store time in float.

It used for example for displaying tooltips after some time, fade in and fade out windows, wobbling effect, animation system.

Re: what's the update frequency in cegui?

Posted: Thu Dec 23, 2010 07:52
by spracle
I don't know where to call the function "Window::update()"

Re: what's the update frequency in cegui?

Posted: Thu Dec 23, 2010 17:16
by uelkfr
spracle wrote:I don't know where to call the function "Window::update()"


As said here:
virtual void CEGUI::Window::update ( float elapsed ) [virtual]
Cause window to update itself and any attached children. Client code does not need to call this method; to ensure full, and proper updates, call the injectTimePulse methodname method provided by the System class.


You just call CEGUI::System::getSingleton().renderGUI() in main event loop and it draws all your GUI, for example:

Code: Select all

   // Main loop
   int runningFlag = GL_TRUE;
   double lastTime = glfwGetTime();
   while( runningFlag == GL_TRUE )
   {
      glClear( GL_COLOR_BUFFER_BIT ); // Clear the window with the defined clear color

      CEGUI::System::getSingleton().injectTimePulse( glfwGetTime() - lastTime );
      lastTime = glfwGetTime();

      drawScene();

      CEGUI::System::getSingleton().renderGUI();

      glfwSwapBuffers();
      runningFlag = !glfwGetKey( GLFW_KEY_ESC ) && glfwGetWindowParam( GLFW_OPENED ); // ESC key or Window Closed test
   }