Delay Function In Dev C++

  

Dev c++ delay functionDelay function in dev c 4

  1. Use of sound and delay function in C and C Sound function in C Sound functions is used to make a sound or a sequence of sound in program. For example a piano C project use different sequences to get different sounds.
  2. Jan 19, 2018  How To Make Clock In c/c (Delay Function Introduced) - Duration: 3:27. Karan Gupta 393 views.

Global Dev Delay

Dev

While it is easy to create a blinking LED with the delay function and many sketches use short delays for such tasks as switch debouncing, the use of delay in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt.

P: n/a
'Shuo Xiang' <sx****@uwaterloo.ca> wrote in message
news:bf**********@tabloid.uwaterloo.ca...
I'm working on some graphical game and need to animate certain things (by
continuously changing the x/y coordinate and update the display), however,
the system is blinkingly fast so no actual animations can be seen.
Therefore I need a 'delay' function. Is there a 'delay' function in C++
that accepts a time argument in seconds or its varieties (i.e. so that I
don't have to resort to the 'big for loop' scheme).

I would say that you are taking the wrong approach to this problem.
Each object should be given a velocity, and then you work out the position
according to the time at which you draw the frame. In this way, the speed
at which it moves across the screen is independant of your frame rate or the
speed of your computer/graphics card.
---------------------------------------
start_time = time
loop {
current_time = time
position = start_position + velocity * (current_time - start_time)
draw object at calculated position
}
---------------------------------------
No delays required, and everything moves in a well controlled manner.
--
Regards,
Joe Hotchkiss,
http://joe.hotchkiss.com
XXXXXXXXXXXXXXXXXXXXXXXXX
X joe.hotchkiss X
X at baesystems.com X
XXXXXXXXXXXXXXXXXXXXXXXXX

C++ Delay Function

P: n/a
'Nils O. Selåsdal' wrote:
Chen Shusheng wrote:
>'Richard Bos' <rl*@hoekstra-uitgeverij.nl>
дÈëÏûÏ¢ÐÂÎÅ:45*****************@news.xs4all.nl.. .
>>'Chen Shusheng' <cs*****@gmail.comwrote:
I want to write a time delay function like 'Timedelay(float
time_lenth){}'.
When execute it, it will delay some seconds as long as
'time_lenth'
indicating. Could you help on how to write such a function?
You use a system-specific function, which you can ask for in a
system-specific newsgroup.
Alternatively, you _could_ use a busy-loop, and be killed by your
systems manager for tying up the system.
Richard

My system is windowsXP. Where should I post to get the answer?
Could
you pls indicate?

Start at http://msdn.microsoft.com/ . If you need a newsgroup -
query
your news server for windows programming groups.
The things to look for are SetTimer and KillTimer... These are
Windows-API and thus off topic here. Just to provide a reference for
future lookups. If you need higher resolution use the
multimedia-timer. It's also described there.
HTH
--
Johannes
You can have it:
Quick, Accurate, Inexpensive.
Pick two.