We have a landscape game that works fine on all Android version including Android 7.0. However, on Android 7.1, the game gets confused about orientation and the graphics become broken. Anyone see the same issue for Cocos2D-X (we are running 3.10)
Here is an illustration of the issue:
Got more information from a player: “I found that if my device is locked in portrait orientation then this tends to happen. Even if I unlock the orientation so it can switch to landscape mode and delete it from my background apps it stays like this and I have to uninstall the app to fix it.” Player is using a Google Pixel phone.
In our android manifest we have this defined:
android:screenOrientation=“sensorLandscape”
android:theme="@android :style/Theme.NoTitleBar.Fullscreen"
android:configChanges=“orientation”>
May be this will help you,
So i modified onSizeChanged method in Cocos2dxGLSurfaceView.java as below
Note: Do this if your game is in landscape mode.
@Override
protected void onSizeChanged(final int pNewSurfaceWidth, final int pNewSurfaceHeight, final int pOldSurfaceWidth, final int pOldSurfaceHeight) {
if(!this.isInEditMode()) {
if(pNewSurfaceWidth < pNewSurfaceHeight)
this.mCocos2dxRenderer.setScreenWidthAndHeight(pNewSurfaceHeight, pNewSurfaceWidth);
…
1 Like
Anyone know if this is fixed in Cocos2d-x 3.14? I see in the change log:
cocos2d-x-3.16 Oct.9 2017
[NEW] Add RadialGradientLayer
[NEW] Web: Add GLProgramState and upgrade web shader usage APIs
[REFINE] 3rd: use prebuilt bullet
[REFINE] CameraBackgroundBrush: use VAO/VBO to improve performance
[REFINE] Color4F: add arithmentic operators
[REFINE] LayerMultiplex: add `LayerMultiplex::switch(int, bool)` to not clean up previous layer after switching to a new layer
[REFINE] ListView: add padding options
[REFINE] FileUtils: add more async functions
[REFINE] ImageView: add `ImageView::setBlendFunc()` to change blend function
[REFINE] PageView: allow customizing opacity of indicator nodes
[REFINE] ParticleSystem: add `ParticleSystem::setSourcePositionCompatible(bool)` to set source position instead of position
[REFINE] RichText: image tag supports sprite frame
[REFINE] RichText: support horizontal alignment
[REFINE] ScrollView: add `ScrollView::setSwallowTouches(bool)`
[REFINE] ScrollView: dispatch more useful events and add more getters
[REFINE] Spine: support ETC1
[REFINE] WebView: can set opacity
[REFINE] Android: update to support Android Studio 2.3.3
This file has been truncated. show original
[FIX] Android: adapt to Android pixel
Thank you this fixed the issue for our game.