![]() |
|
Sleep( ); Function not working |
rrm74001
Member #9,548
February 2008
|
I am trying to simply have the program pause for 1 second between executing each blit(); function, as shown below. However, I keep getting build errors, saying sleep(); is undefined, even though I am including the windows.h header file? Any ideas why this is not working? Thank you in advance for your response.
|
Trent Gamblin
Member #261
April 2000
![]() |
The function is called "Sleep" with a capital 'S'. Besides that, you should include winalleg.h instead of windows.h (just replace the second include with winalleg.h). It has to do some magic since Allegro and the Windows API use some of the same structure names.
|
gnolam
Member #2,030
March 2002
![]() |
Or just use rest() -- |
rrm74001
Member #9,548
February 2008
|
Quote: The function is called "Sleep" with a capital 'S'. Besides that, you should include winalleg.h instead of windows.h (just replace the second include with winalleg.h). It has to do some magic since Allegro and the Windows API use some of the same structure names. AH HA! After I posted this, I found out it was Sleep(); (With a capital S), but it still did not work. But that winalleg.h header file worked like a charm. I remember using windows.h header file to do this same thing before, I guess I was just lucky that time. Thanks for your help. By the way, is there some repository that list all of the header files that are associated with Allegro? The hardest thing I find with programming is figuring out what header files do what. |
gnolam
Member #2,030
March 2002
![]() |
allegro.h is the only one you should need. If you're using platform-specific headers, chances are you're doing something wrong. Like using Sleep() here instead of rest(). -- |
rrm74001
Member #9,548
February 2008
|
Quote:
allegro.h is the only one you should need. If you're using platform-specific headers, chances are you're doing something wrong. Like using Sleep() here instead of rest(). Oh I see. I guess the Manual would be helpful in the case, huh? I am going to try and compile this on my Mac using the rest(); function. Thanks again everyone for your help. |
|