I’d like to know the way to customize the splash screen with a little animation or a video or whatever…
My natural thoughts would be to use setup() but indeed, the solid/fix splash screen would be there before and it wouldn’t be the best way…
The Default.png and its variants are automatically displayed by the app when loading the initial startup. Most devs would play a little movie once the app has loaded.
If your app takes a long time to load, you might want to consider doing this:
- make the default png image be the first frame of your movie
- load only the movie in setup, nothing else
- play the movie
- when movie finished, have a loading screen & load the rest of the assets
- when loaded, jump to next run mode
That is what I am planning to do anyway
Hi Chris and thanks for the little step by step guide.
In my case, this is not because the app is too long to be loaded, but only for aesthetic purpose.
It wouldn’t even be a progress bar, but more a little animation.
I guess to change the Default.png loading would require… a lot.
simply spoken: you can’t change the default.png mechanism.
What you can do: Load all your assets when your app has finished starting (not in the constructor, and not in setup), then you can play back a loading-animation as you like while you load your assets.
the default.png-mechanism on ios is the same as the bouncing app-icon on mac os x, the system loads your app and the corresponding dynamic libs. The default.png-image is shown until the app enters the event-loop.
none other way to do that in the app itself… which is very okay
I don’t think this method will work unless you load your assets with a frameNum() filter or something… which is a very bad idea…?
if you draw something it will just show one frame, because draw needs to go full circle to refresh a frame. So loading a heavy file will mean that it won’t show anything but the first frame (like a splashscreen) and after it finishes with the allocation of the file it will go to the next frame
even if you load a video… it wont draw anything unless it has finished allocating the file, it might start playing the sound but it wont show anything
the correct way to do it is to add a subView
so basically in the setup or where you load your assets… you put:
indicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
indicator.frame = CGRectMake(0.0, 0.0, 40.0, 40.0);
p = ofxiPhoneGetGLView().center;
indicator.center = p;
//and when you want to stop loading:
//or testApp::indicator.stopAnimating; if you are using it in another scope etc..
declare it as a pointer in the header file or somewhere in the class you want to use it :
you can modify this object/method to add an image or a small animation…
but whatever you do you have to activate the subview to draw stuff while allocating other stuff…
more information here:
Ok man I’ve figure it out,
it gives the correct answer
I am gonna clean the code and post an addon tomorrow.