README.iOS
changeset 8314 24f2de48557b
parent 8311 40f2e97c4051
parent 6589 46d985073364
child 8340 e470405f3ae9
equal deleted inserted replaced
8313:14f5f5fdcc75 8314:24f2de48557b
   113 ==============================================================================
   113 ==============================================================================
   114 Notes -- iPhone SDL limitations
   114 Notes -- iPhone SDL limitations
   115 ==============================================================================
   115 ==============================================================================
   116 
   116 
   117 Windows:
   117 Windows:
   118 	Full-size, single window applications only.  You cannot create multi-window SDL applications for iPhone OS.  The application window will fill the display, though you have the option of turning on or off the menu-bar (pass SDL_CreateWindow the flag SDL_WINDOW_BORDERLESS).  Presently, landscape mode is not supported.
   118 	Full-size, single window applications only.  You cannot create multi-window SDL applications for iPhone OS.  The application window will fill the display, though you have the option of turning on or off the menu-bar (pass SDL_CreateWindow the flag SDL_WINDOW_BORDERLESS).
   119 
       
   120 Video:
       
   121 	For real time frame-rates, you are advised to use strictly SDL 2.0 video calls.  Using compatibility video calls uploads an OpenGL texture for each frame drawn, and this operation is excruciatingly slow.
       
   122 
   119 
   123 Textures:
   120 Textures:
   124 	SDL for iPhone Textures supports only SDL_PIXELFORMAT_ABGR8888 and SDL_PIXELFORMAT_RGB24 pixel formats.  This is because texture support in SDL for iPhone is done through OpenGL ES, which supports fewer pixel formats than OpenGL, will not re-order pixel data for you, and has no support for color-paletted formats (without extensions).
   121 	The optimal texture formats on iOS are SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, and SDL_PIXELFORMAT_RGB24 pixel formats.
   125 
       
   126 Audio:
       
   127 	SDL for iPhone does not yet support audio input.
       
   128 
   122 
   129 Loading Shared Objects:
   123 Loading Shared Objects:
   130 	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.
   124 	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.
   131 
   125 
       
   126 ==============================================================================
       
   127 Game Center 
       
   128 ==============================================================================
       
   129 
       
   130 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:
       
   131     
       
   132 int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
       
   133 
       
   134 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.
       
   135 
       
   136 e.g.
       
   137 
       
   138 extern "C"
       
   139 void ShowFrame(void*)
       
   140 {
       
   141     ... do event handling, frame logic and rendering
       
   142 }
       
   143 
       
   144 int main(int argc, char *argv[])
       
   145 {
       
   146    ... initialize game ...
       
   147 
       
   148 #if __IPHONEOS__
       
   149         // Initialize the Game Center for scoring and matchmaking
       
   150         InitGameCenter();
       
   151 
       
   152         // Set up the game to run in the window animation callback on iOS
       
   153         // so that Game Center and so forth works correctly.
       
   154         SDL_iPhoneSetAnimationCallback(window, 1, ShowFrame, NULL);
       
   155 #else
       
   156         while ( running ) {
       
   157                 ShowFrame(0);
       
   158                 DelayFrame();
       
   159         }
       
   160 #endif
       
   161         return 0;
       
   162 }