Bink SDK 1.5v

# Sharing the CPU under MacOS

#### Discussion

Under MacOS, you must share the processor time with other applications. To do this, we have to process events while we're waiting for each frame. Bink handles timing with the BinkWait function, so we just need to check this function whenever we're not processing an event. So, we'll simply monitor the BinkWait function in our event loop - when BinkWait tells us that it's time for the next frame, we'll just call the code to advance a frame. A simple example of MacOS playback would look something like this:

`

    while ( !done ){  // check for a MacOS event  if ( OSEventAvail( everyEvent, &e ) )  {    WaitNextEvent( everyEvent, &e, 0, 0 );    switch ( e.what )    {      case keyDown:        done=1;        break;
          // rest of your event handling code here    }  }  else  {    // no events, so check on our playback    if ( !BinkWait( bink ) )    {      // go process the next Bink frame      Show_next_frame( bink, bink_buf );    }  }}

`

Next Topic (Bink Examples for MacOS)

Previous Topic (Memory management under MacOS)

Group: The MacOS Platform
Related Functions: BinkWait

For technical support, e-mail Bink1@radgametools.com
© Copyright 1994-2003 RAD Game Tools, Inc. All Rights Reserved.