PDA

View Full Version : How to simulate a procedure?



Qiaowen
04-28-2012, 04:38 AM
Hi.
I want to simulate a procedure, this means I want to draw sutffes one by one. For example, I want to draw a column first, after that, I want to draw the second column, then the third one, .... Each one should be drawn after the previous one is finished. How to do this? How to control it?
Thanks.

tonyo_au
04-28-2012, 07:24 PM
This is basically a program logic problem. You need to know what objects to render in the display pass. A simple list of objects to render that you add to will work

Qiaowen
04-29-2012, 10:45 PM
Hi.
Perhaps I didn't get myself understood well. I want to darw a column, then there will be some delay(one or two seconds), then draw the second colunm, .... I already have the logic fixed. I just need the technology the do so.
Thanks.

tonyo_au
04-30-2012, 05:13 AM
I don't quite understand you problem. Do you not know how to do the delays or not know how to break you draw function into a set of draws?

ZbuffeR
04-30-2012, 06:42 AM
You already have the technology, you just need the logic.

In your display function :

if (timeToDrawColumnA) drawColumnA;
if (timeToDrawColumnB) drawColumnB;
if (timeToDrawColumnC) drawColumnC;

You can do that procedurally depending of your case, ex :
for i in 0 to n :
if (timeToDrawColumn(i)) drawColumn(i);
endfor

Qiaowen
05-01-2012, 04:33 AM
Hi.
I don't know how to do the delays.

BionicBytes
05-01-2012, 05:17 AM
Use a clock or a counter. The windows API offers the use of system clocks or other related timing functions.
This one's quite useful - getTickCount(). Returns the number of milliseconds since Windows was started.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724408(v=vs.85).aspx