Wrong x,y coordinates with Texture2D class - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: Wrong x,y coordinates with Texture2D class (/thread-1774.html)
Wrong x,y coordinates with Texture2D class - Minishlink - Feb 11, 2009 12:03 PM
Hi everyone !
I'm currently creating a game with OpenGL|ES and the Texture2D class which is from Apple.
But the x,y coordinates seems to be wrong with a little code like :
Here when I touch the screen, the player is not at x,y coordinates of my touch !
I have to "CGPointMake(0, 16)" to have it at right coordinates...
This is with CGPointMake(0,0) :
And with my "handcrafted" CGPointMake(0,16) it is approximately in the center of my touch.
Can you help me ?
Wrong x,y coordinates with Texture2D class - reubert - Feb 11, 2009 11:46 PM
I think you want 480-y. Your view is probably 480 pixels high when the status bar is hidden.
And I'm not sure how exactly drawAtPoint works, but it may not be centered, so if this is the case you will have to offset it by half the texture size.
Wrong x,y coordinates with Texture2D class - Minishlink - Feb 12, 2009 11:37 AM
Oh god !
Yes it is simply that ^^
For drawAtPoint, it centres the texture
Thank you a lot man ! =)