We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 847 - SDL Initializes but does not draw to the window with iPhone 3.0 SDK
Summary: SDL Initializes but does not draw to the window with iPhone 3.0 SDK
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: 2.0.0
Hardware: iPhone/iPod touch iOS 4
: P2 critical
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-15 07:32 UTC by Yevgeniy Goyfman
Modified: 2009-11-01 23:56 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yevgeniy Goyfman 2009-10-15 07:32:04 UTC
Steps to replicate:

1)  Compile and run any of the Demo projects for iPhone 3.0
2)  Screen will display SLD "Loading" screen
3)  SDL "Loading" screen is not replaced by the application's graphics/UI

Demo apps are being compiled under OSX 10.6 with XCode 3.2

Please note that compiling for iPhone 2.x targets works fine.  There are no errors reported by SDL or by iPhoneOS itself during the execution of the program
Comment 1 Roger Willcocks 2009-10-25 08:45:37 UTC
appDidFinishLaunching is triggered before all the setup's complete. The easiest fix is to arrange for another event to be sent when it's really ready, and run SDL_main from there. Ref. http://blog.rightsprite.com/2008/11/iphone-applicationdidfinishlaunching.html

SDL-1.3.0-4563/src/video/uikit/SDL_uikitappdelegate.m:



- (void)postFinishLaunch {
	
	/* run the user's application, passing argc and argv */
	int exit_status = SDL_main(forward_argc, forward_argv);
	
	/* free the memory we used to hold copies of argc and argv */
	int i;
	for (i=0; i<forward_argc; i++) {
		free(forward_argv[i]);
	}
	free(forward_argv);	
		
	/* exit, passing the return status from the user's application */
	exit(exit_status);
		
}

- (void)applicationDidFinishLaunching:(UIApplication *)application {
			
	/* Set working directory to resource path */
	[[NSFileManager defaultManager] changeCurrentDirectoryPath: [[NSBundle mainBundle] resourcePath]];

	[self performSelector:@selector(postFinishLaunch) withObject:nil afterDelay:0.0];
}
Comment 2 Sam Lantinga 2009-11-01 23:56:19 UTC
This fix works great, thanks!