Needed Timer functionality

Discussion regarding the development of CEGUI itself - as opposed to questions about CEGUI usage that should be in the help forums.

Moderators: CEGUI MVP, CEGUI Team

User avatar
ritz
Quite a regular
Quite a regular
Posts: 49
Joined: Wed Jan 12, 2005 12:06

Needed Timer functionality

Postby ritz » Mon May 02, 2005 09:03

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

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Re: Needed Timer functionality

Postby lindquist » Tue May 03, 2005 17:33

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);

User avatar
ritz
Quite a regular
Quite a regular
Posts: 49
Joined: Wed Jan 12, 2005 12:06

Re: Needed Timer functionality

Postby ritz » Wed May 04, 2005 05:43

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

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Re: Needed Timer functionality

Postby lindquist » Wed May 04, 2005 10:00

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


Return to “CEGUI Library Development Discussion”

Who is online

Users browsing this forum: No registered users and 8 guests