iDevGames Forums
sdl with a native ui on the iphone is easier than you may think - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: sdl with a native ui on the iphone is easier than you may think (/thread-238.html)



sdl with a native ui on the iphone is easier than you may think - michelleC - Mar 17, 2010 12:05 PM

Now that we've finally found the time to post some of our code to the ffmpeg4iphone project that we have been contrbuting to, it makes it a lot easier to illustrate techniques.

Here is our common.m and common.h files.

The two methods to look at here are

Switch windows which switch between and iphone uiwindow and an sdl full screen window and iphonepump messages which run a cfrunloop to restore tableview click functionality lost after returning from the sdl function.

http://code.google.com/p/ffmpeg4iphone/source/browse/WebStreamx/WebStreamXNoLibs/common.m

Code:
void iPhonePumpMessages()
{

//printf("runloop return %u\n",CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1, TRUE));
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1, TRUE);
}


void switchWindows() {

SDLUIKitDelegate *appDelegate = [SDLUIKitDelegate sharedAppDelegate];
NSLog(@"switch windows");
[appDelegate switchTopWindow];
}

And the appdelegate looks like this

http://code.google.com/p/ffmpeg4iphone/source/browse/WebStreamx/WebStreamXNoLibs/uikit/SDL_uikitappdelegate.m

Code:
-(void) switchTopWindow {
NSLog(@"making uiwindw key window");
[myWindow makeKeyAndVisible];
}