README.iOS
changeset 6534 8faa51147576
parent 6392 fa7eb111f994
child 6589 46d985073364
equal deleted inserted replaced
6533:c784245304dd 6534:8faa51147576
   126 	SDL for iPhone does not yet support audio input.
   126 	SDL for iPhone does not yet support audio input.
   127 
   127 
   128 Loading Shared Objects:
   128 Loading Shared Objects:
   129 	This is disabled by default since it seems to break the terms of the iPhone SDK agreement.  It can be re-enabled in SDL_config_iphoneos.h.
   129 	This is disabled by default since it seems to break the terms of the iPhone SDK agreement.  It can be re-enabled in SDL_config_iphoneos.h.
   130 
   130 
       
   131 ==============================================================================
       
   132 Game Center 
       
   133 ==============================================================================
       
   134 
       
   135 Game Center integration requires that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using:
       
   136     
       
   137 int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
       
   138 
       
   139 This will set up the given function to be called back on the animation callback, and then you have to return from main() to let the Cocoa event loop run.
       
   140 
       
   141 e.g.
       
   142 
       
   143 extern "C"
       
   144 void ShowFrame(void*)
       
   145 {
       
   146     ... do frame logic and rendering
       
   147 }
       
   148 
       
   149 int main(int argc, char *argv[])
       
   150 {
       
   151    ... initialize game ...
       
   152 
       
   153 #if __IPHONEOS__
       
   154         // Initialize the Game Center for scoring and matchmaking
       
   155         InitGameCenter();
       
   156 
       
   157         // Set up the game to run in the window animation callback on iOS
       
   158         // so that Game Center and so forth works correctly.
       
   159         SDL_iPhoneSetAnimationCallback(screen->GetWindow(), 1, ShowFrame, 0);
       
   160 #else
       
   161         while ( gRunning ) {
       
   162                 ShowFrame(0);
       
   163                 DelayFrame();
       
   164         }
       
   165         CleanUp();
       
   166 #endif
       
   167         return 0;
       
   168 }