Hey guys, I am just getting started with Cocos2d-x and airplay. I was looking for exactly this solution, so thanks a lot for your work adding airplay to cocos2d.
The issue I am seeing is that the Y values at which sprites are rendered are different than the Y-values at which touches are registered and at which setPosition() sets them.
For example, if I touch the top left corner of my screen, it registers as 0,0, and I use setPosition() to put a sprite there and output the location of that sprite. At each point in the process, it has the right point data, 0,0.
However, when it displays the sprite, it is in the bottom left corner of the screen, rather than the top left.
I figured it out to some extent, but would still appreciate some explanation/clarification.
I ended up having to use “convertToGL()” to get the points to have the right Y-Values. I assume this is because of the difference between Cocos2d-x and the iphone’s axes (Cocos2d-x origin is at the bottom left, and the iphone origin is at the top left) but I am obviously pretty hazy on the exact details. Like, what situations would require the use of convertToGL, convertToUI, and convertToWorldSpace.
OpenGL/GL ES origin is at the bottom left, the mobile screen is in the 1st quadrant of rectangular coordinate system. Both cocos2d-iphone & cocos2d-x inherit this coordinate system. It’s different from the common window systems.