Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Android / Issues locking orientation

Author
Message
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 19th Apr 2013 04:09
I thought I had this problem licked, but it apparently cropped back up somehow.
My game allows portrait and inverse portrait. I wrote it all in Tier 1 and am now working out of 10811b, but the issue persists in earlier versions of AGK.
If you hold the device in landscape mode and launch the game then the game will appear in portrait mode, but squished.

My code is straightforward for screen setup and is included below.
It is like the interpreter is conflicting with the game code.
I can't get this to occur on my phone running Android 2.3 because the phone doesn't allow landscape from the launcher. It occurs on my Nexus 7 and I have reports of it occurring on ASUS transformer.

Is there something I can set in the C++ files to ensure this works correctly?

Thanks!!



Check out dFenz on Google Play, Windows, or Mac:
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 19th Apr 2013 07:11
Er... nevermind... I must have forgot to change the Android manifest to
android:screenOrientation="sensorPortait"


Seems to work in the beta builds. I'll be running an update this weekend.

Check out dFenz on Google Play, Windows, or Mac:
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 19th Apr 2013 18:27
Thank you for discovering how to fix your problem.

It let me fix my manifest files so that the app starts in the correct landscape mode.

I thought that would fix the issue with using the AGKSplash.png file to fill the blank splash when my app starts (before I get enough control to put my own image up).

Unfortunately it didn't quite work. The black splash is shorter, but the landscape AGKSplash.png image is displayed as squished portrait.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 19th Apr 2013 19:35
Interesting. I also see some things in jni/CoreForApp.h that look like they might have an effect, but I wasn't confident enough to try it out.

Let me know if you find anything else out.

Check out dFenz on Google Play, Windows, or Mac:
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 20th Apr 2013 18:37
Recording another finding here:
The res/layout/main.xml also contains a setting for android:orientation = "vertical"
If you set this to horizontal it might be early on enough to fix the orientation of the AGKSplash.png.
I can't tell since I don't use that and the android:screenOrientation = "sensorPortait" fixes my issue.
Another thing I wanted to point out is that sensorPortait is an intentional misspelling. The Android SDK that AGK10811 uses does not accept the correct spelling of portrait and has been fixed in future incarnations of the sdk, but AppGameKit just doesn't use it yet.
I hope this saves someone else the time I spent looking it up.

Check out dFenz on Google Play, Windows, or Mac:
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 21st Apr 2013 05:38
The res/layout/main.xml is not part of the v1076 Tier 2 template.

But, I will copy one from the v10811 template and tweak it and see if that fixes the problem (tomorrow).

Thank you for the tip.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 8th May 2013 21:19
I discovered that 'android:orientation="vertical"' has nothing to do with portrait versus landscape. It has to do with layout putting things top to bottom (horizontal puts them left to right).

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 8th May 2013 21:21
Makes sense!
Thanks for logging that here!

Login to post a reply

Server time is: 2024-11-23 12:24:51
Your offset time is: 2024-11-23 12:24:51