Just wondering if there was a good way to edit the way Cocos2d initializes to get a nice splash image transition? At the moment, it seems as if the rotation for the device is being changed many times before the application starts so my splash image is rotated in all sorts of funny ways before it sets to LandscapeLeft. Is this just a result of the simulator or does the initialization for the cocos2d template switch the orientation a few times?
Crazy Splash Image Rotation?
(13 posts) (9 voices)-
Posted 1 year ago #
-
Like "Default" splash image? You can't change that. But you can create four images for rotational purposes. Or you could have the splash image, then when you load up you can have the exact same image display. After that you can animate THAT image normally. The first splash image is done by the IOS and not Cocos.
Posted 1 year ago # -
Yea, I understand that. But cocos2d seems to be changing the orientation of the device within its initialization code. As a result, on the simulator, my splash image is being rotated all over the place until it reaches my code that settles on LandscapeLeft. Is there a way to stop cocos2d from constantly changing orientation or is this just visible in the simulator?
And also, how is the default image displayed? is the image taken and placed in portrait mode always? Is there a way to flip the image depending on the orientation of the device? (so that if the person plays from a different landscape mode the default image would appear facing that direction as well as the game?)
Posted 1 year ago # -
What you see on the simulator is sometimes of little importance. And this is such case - no matter what cocos2d does with the orientation, it will not physically move the device (together with the player of course) around
Posted 1 year ago # -
Your second question was what @napierzaza was trying to answer. As to your first... I'd say yours in a unique case, I've personally never experienced that.
Posted 1 year ago # -
"And also, how is the default image displayed? is the image taken and placed in portrait mode always? Is there a way to flip the image depending on the orientation of the device? (so that if the person plays from a different landscape mode the default image would appear facing that direction as well as the game?)"
YES the Default.png is always displayed in Portrait view. So if you want to signal the user that your game is going to launch in LandscapeLeft, then open your Default.png in the Preview app (or whatever image editing tool you like) and rotate the image so that when it is viewed in Portrait mode, it will be shown the way you want on your device. There is no way to rotate the Default.png to reflect the device orientation. You CAN do this on an iPad and on iOS 4.0
Link to Apple Dev Docs
Posted 1 year ago # -
Heh, I guess it's just my eyes :D
Hmm, I'm developing for the iPad, so there is a way to rotate the Default.png to reflect device orientation?
Posted 1 year ago # -
Hi,
I´m stuck with the same problem at the moment. I´m developing an iPad only app with landscape orientation (the user is free to choose LandscapeLeft and -Right - just like apple likes it). I´ve managed to get that landscape left/right stuff by studying the demo code in version 0.99.4 (bug 914).As I´m loading a lot of stuff right from the beginning, the splash screen is showing quite some time. I´ve added different launch images according to apples guidelines (e.g. Default-Portrait.png, Default-PortraitUpsideDown.png, Default-LandscapeRight.png, Default-LandscapeLeft.png). But no matter how the device orientation is at app startup - I just see the launch image "Default-Portrait.png" (obviously because it´s the default orientation all apps start.) When I add a "UIInterfaceOrientation" param in my info.plist file and set it to "UIInterfaceOrientationLandscapeRight" just my Default-LandscapeRight.png image is shown at startup. (No matter what the device orientation actually is)
So if there is a way to rotate the launch image to reflect device orientation on the iPad - how can that be done and where?
Thanks so much for your help. I´ve been dealing with that sh*** the whole day already and I´m going slightly mad...
Marco
Posted 1 year ago # -
Hi,
now I found the solution myself...When you don´t give any further information in the info.plist of your app the launch image will be shown in "Portrait" mode. No matter which launch images you provide (landscaperight / left etc...). The app will always show the Portrait one.
As mentioned above I then tried to set the "UIInterfaceOrientation" param in my info.plist file and set it to "UIInterfaceOrientationLandscapeRight". With the effect that now only the Default-LandscapeRight.png was shown at startup. When I turned the device upside down (in landscape mode) and started the app again - the same launch image was still shown (not the Default-LandscapeLeft.png).
So here is the solution: You have to provide a different param in the info.plist, namely: UISupportedInterfaceOrientations !
This has to be of type "Array" and you have to set the orientations you want to support. In my case: UIInterfaceOrientationLandscapeLeft and UIInterfaceOrientationLandscapeRight .Now the device selects the appropriate launch image when starting up! (I now use a simple Default-Landscape.png which is turning automatically now) (It still isn´t turning when you re-orient the device while the app is starting up but at least it´s getting the initial orientation correct now)
Holy Moly... Almost two whole days for that stupid thing...
Marco
Posted 1 year ago # -
Just made the same mistake so here's a cut and paste snippet to add all 4 Orientations to your plist file. Open plist as Source code (right click > Open as) and paste in the following.
<key>UISupportedInterfaceOrientations</key> <array> <string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortraitUpsideDown</string> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> </array>Then place the following 4 images into your resources;
Default-Portrait.png 768 x 1004 (1024 if no status bar) Default-PortraitUpsideDown.png 768 x 1004 (1024 if no status bar) Default-LandscapeLeft.png 1024 x 748 Default-LandscapeRight.png 1024 x 748Alternatively you can use ;
Default-Portrait.png Default-Landscape.pngand it will rotate them. When creating each image create them all the right way up, apple will handle the orientation for you.
Posted 1 year ago # -
Any clue how to insert a video (landscape) in place of Default-Landscape.png files for the iPhone/iPad Launch Image?
Posted 1 year ago # -
Any clue how to insert a video (landscape) in place of Default-Landscape.png files for the iPhone/iPad Launch Image?
You can't, the default image is an image not a video. You fake this though by creating an image which matches the first frame of your video so its shown while your video is loading, and then once your app is loaded you play the video, effectively achieving a "a video was used as the default.png" effect.
Posted 1 year ago # -
I don't know about that, was working with the following code I found on the developer forum yesterday with interesting results. Added the following to the App delegate.m file:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Add the view controller's view to the window and display.
[window addSubview:viewController.view];
[window makeKeyAndVisible];NSString *path = [[NSBundle mainBundle] pathForResource:@"Movie" ofType:@"m4v"];
NSURL *url = [NSURL fileURLWithPath:path];
MPMoviePlayerViewController *moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
[moviePlayer.view setFrame:CGRectMake(0.0, 0.0, 640.0, 480.0)]; //setting bounds for iPad and iPhone
[myViewController.view addSubview:moviePlayer.view];
//[self.view addSubview:moviePlayer.view]; //causing error 'Request for member 'view' in something not a structure or union
[moviePlayer play];return YES;
}I'll post again with a link to my final results and the solution.
Posted 1 year ago #
Reply
You must log in to post.