I understand that the iPhone 5s has a pixel resolution of 640 x 1136 and a point resolution of 320 x 568 (for backward compatibility with non-Retina devices).
The problem/confusion/oddity seems to come in when I'm working with SpriteKit. Example:
I'm drawing a line from bottom-left corner (0, 0) to top-right corner (width, height). The result was that the line was drawn almost halfway. And indeed when i print out the screen size, it should 320 x 568. So i decided to draw from (0, 0) to (width * 2, height * 2). And of course, this printed out 640 x 1136.
So the oddity is this: Even though I'm drawing from what should be a diagonal line corner to corner, it is not, in actuality, being drawn from corner to corner.
Notes:
- I'm getting the width & height values from self.value.frame.size.
- The diagonal line seems to draw just fine using any of the iPad simulators.
Any ideas what is going on here?
Anyways here is how I got good results:
Just open up a new project and try this:
In your GameViewContrller instead of using viewDidLoad use viewWillLayoutSubviews.
EDIT: Here is a good explanation by Rob Mayoff about methods like viewDidLoad and viewWillLayoutSubviews.
So now in your didMoveToView method in scene class, just draw a line :
Read this about init vs didMoveToView (read comments posted by LearnCocos2D).
So this is pretty much it, and I hope it helps.