I am using cocos2d-x to develop on Windows. I have plans to write for the iOS and to simulate that, I set the window size to: 320x480.
When I enable retina display using:
The window size adjusts to a larger size: 640x960.
The correct assets are also used. I’m not sure if this is how retina display works on the iPhone simulator for mac developers.
My main problem is that I am loading data from a .tmx file. It loads the following coordinates for a sprite from my~~hd .tmx file: (800, 160).
I assume this is correct because the window size is adjusted to (960x640), note: it is set to portrait mode.
However, the sprite does not appear on screen, so I debug by hardcoding the coordinates to:
The sprite shows up in the center, the window size is (960x640), but the log shows that the sprite was placed at: (240, 160). Which means that director~~>getSize is actually: .
So now, I correct the position by hard-coding it to: .
Can someone please explain this for me and let me know how I can resolve this issue? If I change the window resolution to 960x640: win~~>Create(TEXT (“Title”), 640, 960);
The director will give me those values, but the window will be twice as large (because retina is enabled to use the HD graphics). If I disable retina display with this window size, it will load the SD graphics instead of the HD graphics, which isn’t correct because they are scaled for 320x480.