New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enabled content scale mode and support for variable screen aspect ratio on android #538
Conversation
I don't understand the modification of CCEGLView_android.cpp. |
Sure Usually you create a view with view->create(320, 480); The other changes just enables the ability to use HD images and removed the override of m_fScreenScaleFactor. I'm not sure, what should happen, if you're changing the content scale factor on runtime, but m_fScreenScaleFactor should be changed only, if the "virtual" screen size would change, not when changing the content scale. |
I think you can not do it. For example, CCDirector::getWinSizeInPixels() should use the scale factor. |
X and Y have the same scale factor. The only thing, i'm changing is the virtual screen resolution, the part which is measured in points. |
What's the current state with this patch? Do you need further explanations or changes on the code, or are you just busy? As explained above, I do not use different scaling values for X and Y (which would result in an ugly, stretched image). I just extend either width or height of the size given to view->create to fill the whole screen, instead of leaving blank bars on the side. |
We are releasing a new version, so I am too busy to test these codes. Does touch coordinate correct by your change? |
Thanks for ChristianFischer submits codes to us.
Is it acceptable that scale the origin image to full screen which don't keep w/h rate? |
Hi, touch coordinates are working fine with the changes. I've tested the changes also on a honeycomb device with it's additional softkey-bar and it looks good, too. (maybe I should get a few more honeycombs to be sure it works on all of them). @yangws: If your UI contains borders, fullscreen background images, or something like this, you have to care about the screen size. We're using tiled background images for some UI backgrounds (streched images may also work in some situations, but may be ugly in other situations) Scaling the image to fullscreen on all devices should be a no-go. Try to scale a screenshot of your game to 854x480 (xpera-play display size). The result won't make you happy My patch also enables the HD-mode on android. So you can use your -hd images on android in the same way as on IOS. |
Ok, I will test it and merge it in next version if it work ok. Then I hope you can write a document to describe it in the wiki. |
I applied your patches to my code manually, I just get a black screen and a hang. This does this on a Galaxy S and also the HVGA emulator. |
Thank you for your testing. |
Hi, please add a "view->create(480, 320, true);" to your android main.cpp (or uncomment the existing one, if it's still there). If you still have problems, plase check if the HelloWorld example in your cocos2dx version is working. |
If you want to a full screen, you don't need to invoke CCEGLView::create(). This function is used for scale the screen. |
I'm use same approach, call In your FileUtils additions code not totally correct, condition if (std::string::npos != dotPos && dotPos > pos) Check it, for "texture.png" returns "texture.png-hd". |
should be fixed now (the bug just happened on files in "assets", not on files in any subdirectories) |
Works fine for me. Thanks ! |
[iOS] fixed cocos2d#538: add template of lua for xcode3
[iOS] fixed cocos2d#538: add template of lua for xcode3
[iOS] fixed #538: add template of lua for xcode3
Changes: