iPhone4 CG drawing scale doesn't seem the same as the simulator
I'm coding the "Asteroids" app in chapter 4 of "Beginning iPhone Games Development". The atlas sprite section of the chapter has the sprite running back and forth on the screen (when it comes to an edge it changes direction). On the simulator my sprite moves as expected but on the device (iPhone 4) it runs back and forth only in the lower right quadrant of the screen. Does this have something to do with using pixels instead of points to refer to screen positions? This app uses a lot of CG... methods.
Do some of the CG drawing methods refer to screen positions in pixels instead of points? That might explain what's happening. But other projects I did using CG methods behaved the same on the device as they did on the simulator. I've been assuming that screen measurements are always in points.
Any other ideas to explain why one quarter of the screen on the device is the same as the whole screen on the simulat开发者_开发知识库or?
I am having the same problem. I've been playing around with this and found something which might help. In the sprite.m file, change this:
t = CGAffineTransformTranslate(t,y+160,240-x);
to this:
t = CGAffineTransformTranslate(t,y+320,480-x)
t = CGAffineTransformTranslate(t,y+0,0-x);
It appears to work okay but all Sprites are small so you'll need to adjust the scales.
精彩评论