I changed “AndroidManifest.xml”
android:screenOrientation=“landscape” -> android:screenOrientation=“portrait”
“AccelerometerTest” not working properly
Testdevice : Galaxy Tab 10.1
I changed “AndroidManifest.xml”
android:screenOrientation=“landscape” -> android:screenOrientation=“portrait”
“AccelerometerTest” not working properly
Testdevice : Galaxy Tab 10.1
Which version of cocos2d-x did you test?
Version of cocos2d-x is “cocos2d-1.0.1-x-0.11.0”.
I test in my g10, and it works ok when changing orientation to portrait.
Sorry, I don’t have Galaxy Tab, so could you help us to resolve it?
Please refer Cocos2dxAccelerometer.java, it receives sensor event and pass data to c++.
May be you can look if the data is correct.
Thank you!
Consider me a little.
I was able to solve this problem.
I “Cocos2dxAccelerometer.java” was changed as follows.
(before)
if ((orientation == Configuration.ORIENTATION_LANDSCAPE) && (mNaturalOrientation != Surface.ROTATION_0))
{
float tmp = x;
x = -y;
y = tmp;
}
(after)
if ((orientation == Configuration.ORIENTATION_LANDSCAPE) && (mNaturalOrientation != Surface.ROTATION_0))
{
float tmp = x;
x = -y;
y = tmp;
}
else if ((orientation == Configuration.ORIENTATION_PORTRAIT) && (mNaturalOrientation != Surface.ROTATION_0))
{
float tmp = x;
x = y;
y = -tmp;
}
Oh, we forgot to handle portrait when the device is tablet.
#954 is created for it.
Thank you.