Skip to content
This repository has been archived by the owner. It is now read-only.
Browse files

Updated iOS Readme to reflect Game Center integration changes.

  • Loading branch information
gabomdq committed Oct 2, 2012
1 parent 8be1341 commit b9e5e9896bc686d47f2a98c28a00972f901614f9
Showing with 38 additions and 0 deletions.
  1. +38 −0 README.iOS
@@ -128,3 +128,41 @@ Audio:
Loading Shared Objects:
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.

Game Center

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:

int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);

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.


extern "C"
void ShowFrame(void*)
... do frame logic and rendering

int main(int argc, char *argv[])
... initialize game ...

#if __IPHONEOS__
// Initialize the Game Center for scoring and matchmaking

// Set up the game to run in the window animation callback on iOS
// so that Game Center and so forth works correctly.
SDL_iPhoneSetAnimationCallback(screen->GetWindow(), 1, ShowFrame, 0);
while ( gRunning ) {
return 0;

0 comments on commit b9e5e98

Please sign in to comment.