-
Junior Member
Regular Contributor
new to mac
I realize this isn't strictly openGL, sorry...
I'm trying my first bit of Mac programming. i'm taking a windows GLUT program I wrote and trying to compile it on a Mac. Everything's working fine, but I've had to remove my Sleep() calls because I can't seem to find an equivalent in the Mac world.
in Windows, Sleep(x) will sleep for 'x' milliseconds, but on the Mac the only thing I could find was the unix standard sleep(x) which sleeps for 'x' seconds. Can somebody point me in the right direction please?
Also I'm not using the GLUT keyboard interface beause I want access to the Keypad... I've gotten one thing to work -- "GetKeys". Is that the best way to get keystates? Also, is there an include or something that describes the keycodes returned for the various keys? (like the letter K is #xxx the letter L is #xxx)
Thanks!
-
Junior Member
Regular Contributor
Re: new to mac
take a look over at macnn.com
they've got a nice osx dev section.
-
Junior Member
Regular Contributor
Re: new to mac
actually, it's not on OS X, but I'll take a look anyways. Thanks.
-
Re: new to mac
Try this out:
void Sleep( int numberOfSeconds )
{
long timeUntilWake = TickCount() + ( numberOfSeconds * 60 )
while( TickCount() < timeUntilWake );
}
TickCount() returns the number of ticks ( 60th of a second ) since system startup.
GetKeys() should return the ascii code for the characters, i.e. 'K' and 'L'. You'd actually have to look up the hex values for keys such as the arrow or function keys though.
-
Junior Member
Regular Contributor
Re: new to mac
Interesting... Yeah, actually, I have found a way to get milliseconds from a counter, so I could just have the program twiddle it's thumbs till the timer indicates the correct time...
That seems a little strange to do on a system that's semi-multitasking, but what the heck.
Hopefully, I'll have my Barrel Patrol game for the Mac soon. I just need to figure out openAL...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules