I am new to cocos2d v2.3, I am creating an demo game, but I have problem with iPhone5 and iPhone6, I simply add an background image to a scene, it displays like below. my image is 3072 × 4096, the default scaling is 4, it works well on iPhone4, can anyone tell me why?
Related
I have created a app using SprikeKit and SKScene, the app runs perfectly on all iPhone simulators however with the iPad simulator, the top is cropped. Is there any settings to have this as an auto layout?
See image attached for GameScene.sks settings
Screenshot
No, SpriteKit does not behave the same as UIKit. It is designed for game development, so an "auto layout" feature is something that would be considered a very low priority to implement since not many games would utilize it outside of an overlay. If you want to make your game appear the same vertically on all devices, then make your scene size a 3:4 aspect ratio. This would mean that cropping will happen on the sides of iPhones.
You could fill in the extra space on the sides with eye candy like bushes so your iPad and iPhone will play the same, but iPad users would just see more.
I am trying to develop for the iPhone 6 and I have an issue here that has been discussed on S.O. before, but the solution that developers have offered is not working for me.
I have taken a few pictures to try to show better what is happening.
This first screenshot is just to show that I have my Launch Images loaded:
The next picture:
Shows at the left the storyboard. As you can see the image fits the screen. The size on the inspector is "inferred" and the dimensions of it I can check by looking the size inspector:
They are 320 by 564 which corresponds to the iPhone 5s.
On the simulator as you can see there is a white gap around. and the picture at the right is a screenshot from the device running the same thing.
So to recap, i want to make an app for the iPhone 6 but on the storyboard the "inferred" dimensions are those of the iPhone 5. The simulator displays an iPhone 6 but with an image that doesn't fit and the device -weirdly- displays the image correctly.
On the next picture I have changed "Inferred" to iPhone 4.7-inch:
And I have also resized the image to fit the bigger scene on the storyboard, its now 375 by 667:
So, the normal size for an iPhone 6.
As you can see, the simulator now shows the display correctly but the device (screenshot on the right) is not correct as the image is now too big for the screen (there is no white space around the "E").
I have researched this and everyone seems to say that loading the launch images makes xCode display correctly for the iPhone 6, but that's not happening here. So what else am I missing? Thanks.
I want to make my App compatible for iPhone 5, i got the point about auto resizing just need to confir, Do i need to add all the images re-sized for iPhone 5 OR can work with re-sizeing only Splash and Background image ?
You will be required to resize the launch images. You need a launch image for the older iPhone screen sizes in normal and retina resolutions as well as an iPhone 5 screen size retina image.
It will be a good idea to rework your app and have background images that can take advantage of the larger iPhone 5 screen size, but will be able to be cropped and still work on the older iPhone screens.
Using either auto layout or setting the resize and pinning struts properly, your other controls and images should be able to be used as they are to adapt your app to look good on the iPhone 5 screen.
You only need to resize the splash screen.
I wonder if you have any idea of why my Launch image get displayed upside down when using the iPhone application/storyboard on the iPad simulator. After the launch image the orientation is correct.
Running on iPad device also has the correct orientation. It is only the when running iPhone application on iPad it does not work. iPhone all works fine.
Any ideas?
I had the same problem today without having changed the UISupportedOrientation-key (my app supports all 4 orientations) while I was changing values in the summary view (Xcode 4.2). The app started to do strange behaviours while loading the launch image, it changed the orientation to upsideDown. I solved the problem by just by changing the sequence of the 4 different orientation levels. 1st element was somehow PortraitUpsideDown and the 4th element Portrait, I swapped these two values and then it was working smooth again.
I'm developing a game using cocos2d. It's running now on iPhone and also supports Retina display. With retina i'm using images with "-hd" postfix. Now i want my application to be able to work on iPad using this images. How can i do that ?
PS: I don't have a real iPad and can only use a simulator. I will test the game on my friend's iPad after it will work well on a simulator. Is it possible to use hi-res images with simulator and how to do it?
I'm using cocos2D 0.99.5
inside CCFileUtils.m
inside method name +(NSString*) getDoubleResolutionImage:(NSString*)path
edit if( CC_CONTENT_SCALE_FACTOR() == 2)
to if( CC_CONTENT_SCALE_FACTOR() == 2 || (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad))
this will make the app to load the -hd image when running on ipad, remember to change your app targeted device family to iPhone/iPad.
this will solve the loading of -hd problem for ipad.
but after loading -hd file for ipad resolution, you will also notice that most of your image position should be off alignment, now either you go directly into the cocos2d folder to edit how CCNode,CCSprite,CClabel handle the positioning of thing or you code it in your code checking if its ipad or not.
if you are using CCSpriteBatchNote. this will also cause another problem because you will be reading from the -hd SpriteSheet. so the texture Rect u set to cut need to be double too.
another method is position everything according to winsize. i haven try this method.
I don't exactly understand the question but I will try to answer.
You can technically use the same graphics for the iPad, but they will not look as nice. For one, they will all blurry and pixelated, and two, the iPad has a different screen aspect ratio that the iPhone/iPod Touch. If you do make separate images for an iPad version of your game, it will not be extremely difficult to do. If you want to do this, I suggest posting a new question.