Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: new to mac

  1. #1
    Junior Member Regular Contributor
    Join Date
    Nov 2000
    Location
    los angeles
    Posts
    131

    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!

  2. #2
    Junior Member Regular Contributor
    Join Date
    Mar 2000
    Location
    east norwalk, ct, usa
    Posts
    184

    Re: new to mac

    take a look over at macnn.com
    they've got a nice osx dev section.

  3. #3
    Junior Member Regular Contributor
    Join Date
    Nov 2000
    Location
    los angeles
    Posts
    131

    Re: new to mac

    actually, it's not on OS X, but I'll take a look anyways. Thanks.

  4. #4
    Junior Member Newbie
    Join Date
    Mar 2001
    Location
    Rochester, New York, USA
    Posts
    15

    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.

  5. #5
    Junior Member Regular Contributor
    Join Date
    Nov 2000
    Location
    los angeles
    Posts
    131

    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
  •