This site is no longer active and is available for archival purposes only. Registration and login is disabled.

timedelta


timedelta

Postby Petre » May 27, 2006 @ 4:55pm

helo felow developers.

i am doing some testings with edge and i was woundering how i could use device independent timing in a game for animations, moving, input, etc.

i noticed the timedelta variable in the onnextframe loop, what is the best way to use it?

tank you!

petre
Petre
pm Member
 
Posts: 34
Joined: Apr 1, 2006 @ 4:34pm


Postby edge » May 29, 2006 @ 8:37am

When using the timedelta parameter it's a good idea to measure animations in "units" rather than pixels (because the timedelta variable is usually bigger than the amount of pixels to move). It's not a good idea to divide the timedelta parameter, because the amount of movement may be 0 if the timedelta parameter contains a low value (this will be the case if the game runs at a high fps).

For example, when using sprites, update the x-position of the sprite using timedelta (sprite[0]->x += timedelta). When drawing, convert the "unit position" back to the position in pixels and draw it onscreen.

A good example of using timedelta is shown in the Blastar sample and tutorial on our website: http://www.edgelib.com
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Postby Petre » Jun 4, 2006 @ 5:56pm

Petre
pm Member
 
Posts: 34
Joined: Apr 1, 2006 @ 4:34pm


Postby edge » Jun 6, 2006 @ 8:19am

EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Return to EDGELIB


Sort


Forum Description

Powerful and affordable C++ middleware solution covering true multi-platform 2D, 3D and network features for Apple iPhone, Windows Mobile, Symbian S60, UIQ, Linux and Windows desktop.

Moderator:

edge

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron