MoSync 3.3.1, landscape screen orientation causing crashing

276 Views Asked by At

Im creating an app using OpenGL ES 2.0 on Mosync 3.3.1 and ideally I would like the screen to rotate to whatever orientation the screen is tilted. However using maScreenSetSupportedOrientations() and setting it to dynamic or landscape caused to the app to crash when it tries to rotate to landscape. Is this a bug that needs fixing or am I doing something wrong? Im sending my code to a nexus 7 tablet.

Im initiating the call in the init function of my code:

maScreenSetSupportedOrientations(MA_SCREEN_ORIENTATION_DYNAMIC);
maScreenSetOrientation(MA_SCREEN_ORIENTATION_LANDSCAPE);

my whole code is available here: http://codetidy.com/6378/

1

There are 1 best solutions below

0
On

It works for me

extern "C" int MAMain() { // Declare MAMain function as "C"
maScreenSetSupportedOrientations(MA_SCREEN_ORIENTATION_LANDSCAPE);
Moblet::run(new MyGLMoblet());
return 0;

instead of

void init() { // Screen Size

    mWidth = EXTENT_X(maGetScrSize());
    mHeight = EXTENT_Y(maGetScrSize());

    maScreenSetSupportedOrientations(MA_SCREEN_ORIENTATION_PORTRAIT|MA_SCREEN_ORIENTATION_LANDSCAPE);
    maScreenSetOrientation(MA_SCREEN_ORIENTATION_LANDSCAPE);