Page 1 of 1

Needed Timer functionality

Posted: Mon May 02, 2005 09:03
by ritz
Hello All,

I need to implement timer functionality for following scenario

I am working on a HTML Viewer widget. For implementing this widget, It is required to take images as inputs from Container application. I can send a request to the container application for sending an image-using Message.

The issue is, to specify the time limit for receiving the response form the container, i.e. for how much time widget should wait before displaying an error.

I want to implement this feature-using feature similar to standard windows timers[WM_TIMER event]. i.e.

Widget should be able to set a timer after sending a Request for image to container.

After specified amount of time, a timer event should be received by widget, at this moment widget should check whether container has given the image or not, and take the necessary action.


Any other design approach is also welcome.

Thanks and regards,
Ritz

Re: Needed Timer functionality

Posted: Tue May 03, 2005 17:33
by lindquist
CEGUI::Window has a virtual member function which you can use instead - or to make the feature.

Code: Select all

/*!
   \brief
      Perform actual update processing for this Window.

   \param elapsed
      float value indicating the number of seconds elapsed since the last update call.

   \return
      Nothing.
   */
virtual void   updateSelf(float elapsed);

Re: Needed Timer functionality

Posted: Wed May 04, 2005 05:43
by ritz
Hi,

I tried using this method bu calling injectTimePulse fucntion of System class, but could not get the desired effects.

Please validate my understanding regarding the usage.

If i will call injectTimePulse(10) function updateself method will be called by the system class internally after 10 ticks(secs).

Please help me out by giving some sample code.

Some more details about your approach for using the method will help.

Thanks a Lot.
Ritz

Re: Needed Timer functionality

Posted: Wed May 04, 2005 10:00
by lindquist
not exactly.

when you call injectTimePulse with 10 updateSelf will be called instantly with the same parameter ten.

injectTimePulse should be used to constantly pass timer events to CEGUI.

fx if you send 100 time pulses each second, the elapsed parameter should be 0.01f

so... do as the code comment says. call injectTimePulse as often as possible (moderate) and make sure the elapsed parameter holds the time in seconds since the last time you injected.

HTH