Help with allegro.

I just need to know how to use time in allegro...

1
2
3
  // code
  /* Time code */
  // next code 


Amy help will be good, thanks :)
bump...
"Time code" could be anything. What exactly do you want to do?

-Albatross
Well...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
planetMERCURY = load_bitmap( "planetMERCURY.bmp1", NULL);
/* Time code (1 sec)*/
planetMERCURY = load_bitmap( "planetMERCURY.bmp2", NULL);
/* Time code (1 sec)*/
planetMERCURY = load_bitmap( "planetMERCURY.bmp3", NULL);
/* Time code (1 sec)*/
planetMERCURY = load_bitmap( "planetMERCURY.bmp4", NULL);
/* Time code (1 sec)*/
planetMERCURY = load_bitmap( "planetMERCURY.bmp5", NULL);
/* Time code (1 sec)*/
planetMERCURY = load_bitmap( "planetMERCURY.bmp6", NULL);
/* Time code (1 sec)*/
planetMERCURY = load_bitmap( "planetMERCURY.bmp1", NULL);
/* Time code (1 sec)*/
planetMERCURY = load_bitmap( "planetMERCURY.bmp7", NULL);


So...
I want the planet to rotate image by image.
~ Thanks.
First off it's probably a good idea to load the images ahead of time instead of reload every time you rotate the planet.

But in response to the question, Allegro has section for timers. The wiki has a little tutorial on how to make the main thread pause for a while, but you might find it a bit advanced.
http://wiki.allegro.cc/index.php?title=Timers

Alternatively, you can use system-specific sleep functions to similar effect. I wouldn't necessarily recommend this, but it'll be easier to grasp.

On Windows, the Sleep() function is in <windows.h>.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms686298%28v=vs.85%29.aspx

On Unix-like systems (Mac OS, Linux, BSDs), there are several sleep functions. The one you might be interested in is just called sleep() in <unistd.h>
http://unixhelp.ed.ac.uk/CGI/man-cgi?sleep+3

-Albatross
Topic archived. No new replies allowed.