My issue is that it seems the method explained by Cocos2d-x does not take into consideration the screen density (DPI) or physical screen size of the device. So, an asset that appears large enough on a 1024x768 10" tablet will still seem very small on an Android phone that has a similar resolution but much higher DPI. I am trying to achieve the result as shown in Figure 3 on the Google guide.
Am I just not understanding the concept correctly or is it this difficult in Cocos2d-x? All of the multi resolution examples I’ve seen only consider iOS which is very simplistic by comparison to Android devices.
Kevin is right in my opinion because on Android you also have to provide different resources for different densities. A quick solution for you for know may be to make for example 4 directories like “ldpi”, “mdpi”, “hdpi”, “xhdpi” and put all other resources there, according to their target density/resolution. Then, when your app starts you can determine the device density (I think it can be done fairly easy on Java-side, I don’t know about passing a return value back from a JNI call though), and based on it determine the directory prefix for your resource access.
Then, when your app starts you can determine the device density (I think it can be done fairly easy on Java-side, I don’t know about passing a return value back from a JNI call though)
I discovered yesterday that there is already a method available in the latest release to get the DPI from within C++ (getDPI() within the CCDevice class). So, I’m able to use that as a multiplier to manually scale the desired assets based on DPI rather than screen resolution. However, now I’m going mad trying to position a scaled CCMenu (I apply the scale to the CCMenu object itself). If I have a properly positioned CCMenu at 1.0 scale, even scaling it to 1.1 causes the anchor to get out of whack and I can’t figure out exactly what’s happening…
Can you expand a little more on getDPI? I have cocos2d-2.1beta3-x-2.1.1 and I can’t say that I see CCDevice in my project. Do I need to upgrade in order to use it?