Cocos2d, How Set Device Orientation to portrait IOS - cocos2d-iphone

I had followed this http://www.cocos2d-x.org/wiki/Device_Orientation
but my RootViewController.mm not exactly look like that.
After i replace
'UIInterfaceOrientationMaskAllButUpsideDown'
to 'UIInterfaceOrientationMaskPortrait' there is some error on main.m
my cocos2d version = cocos2d-x-3.13.1 , on iPhone 7 simulator

You also need to go to xcode project setting and choose device orientation.
Here is a screenshot.

Related

Why is the orientation wrong on the 6.0 simulator but fine on iPhone 4 (4.3.3)?

I was testing my cocos2d-iphone 1.0.1 game on an iPhone 4 with iOS version 4.3.3. It is a landscape mode game.
I recently updated Xcode to 4.5.2, and it comes with iOS simulator 6.0.
If I run my game on the simulator (Hardware set to retina iPhone 4), the device window rotates to the expected position, but the game itself seems to be rotated 90 degrees to the right. The touches also seem to be caught rotated. So basically, I have the device window in the correct orientation but the game itself is rotated.
When I run this on the iPhone 4, it all works just fine.
What could have happened?
This solved it: Cocos2D with iOS6 faulty rotation
Just had to use the Cocos2d 1.1 link, which is: https://github.com/cocos2d/cocos2d-iphone/blob/develop/templates/Xcode4_templates/cocos2d.xctemplate/AppDelegate.m

What changes should I do to my cocos2d-iphone 1.0.1 project to run it on iPhone 5?

I've been developing a cocos2d-iphone 1.0.1 game project and have been testing it on an iPhone 4.
I'll soon be getting an iPhone 5. I just updated Xcode to 4.5.2.
Will my project be able to at least run on the iPhone 5 immediately? Or is there a major change I must do in my project? As in, is something going to crash when I try to run it?
If you don't do anything, the app will run on iPhone 5 at the original resolution. Meaning there will be empty (black) space on the sides.
Once you add an image named Default-586h#2x.png with dimensions 640x1136 then your app will use the entire width of the iPhone 5 screen. You will have to adapt your layout to support the iPhone 5 screen size.
It should be able to run on the iphone 5 immediately but it will probably be letter boxed since im guessing it does not support a taller screen size yet.

Will Apple reject cocos2D game if it does not fit iPhone 5 screen?

In two days I will upload Cocos2D game for iPhone to itunesconnect for review. Now this game does not support iPhone 5 resolution, but does support both iPhone 4S and iPhone 3GS. Will Apple reject this app for absence of compatibility for iPhone 5 or (maybe, I don't know now) incorrect behavior of cocos2d's sprites or so? I will correct that in the first patch, but now I need to release the game immediately, because game does not belong to me and customer want it be released as soon as possible.
Thanks in advance!
No. In the same way Apple doesn't reject iPhone apps that don't support iPad resolution.
An older iOS app running on iOS 6 will automatically be letter-boxed (with black spaces at the top and bottom of the screen), so you don't have to worry about the screen layout. There are a lot of other things in iOS 6 that may break an older app, however, so you'll definitely want to at least run the app on the iOS 6 4-inch screen simulator (and the sim won't catch all the potential problems).
YES.
From 1st May 2013, Apple reject all app if iPhone 5 is not supported. iPhone HD is must but not iPad HD. All you need to do is just upload iPad HD image in screenShot.

Cocos2d-Things appear bigger in simulator

I've recently noticed that things accommodate differently on the simulator and a real device when using Cocos2d.To make sure I did the following:
1. I created a blank Cocos2d project. In the init method I created 7 sprites from Icon-72.png(which is found in the resources folder of the Cocos2d template) and added them to the screen.In the simulator only 6.5 sprites could accommodate side-by-side whereas in the iPod touch all seven sprites could accommodate easily and almost half of the screen width remained unused.
2.Then I created a project from Single View Application template. I added the same Icon-72.png to the project. Then on the storyboard I added 6 image views and set their image property to Icon-72.png. This time I had exactly the same result with both simulator and the device.
I guess there should be some tweak as to how to fix this issue with Cocos2d because it's not Apple's fault. Do you know how to handle this?
The iPod Touch could have the retina display and the simulator wont have have it. If you need the same display as of the iPod Touch You can use the iPhone Simulator with the Retina Display and you would get the same screen. Another Option you can use is Copy and paste the Same file with -hd prefix ex:(Icon-72-hd.png) with 72x72 size and you can get the same result.
There is no problem with either the version of cocos2d or with the Apple for the issue you are facing.
I guess I do have poor explanation but you would understand my explanation.
The iPod Touch will be a retina display. Cocos2d doesn't automatically double the size of images.

How to create iPad Application in cocos2d

I am new to iphone game development, i have recently install cocoas2d. But the problem i whenever i search it always result in iPhone game tutorials. I want my game to use iPad screen resolution.
Thanks
Inam
its same, just change TARGETED_DEVICE_FAMILY in project settings to ipad