fixing screen orientation on mobile devices

Monkey Forums/Monkey Beginners/fixing screen orientation on mobile devices

abakobo(Posted 2015) [#1]
Is it possible to set and fix through mojo the screen orientation (to landscape in my case) so it works x-platform without using config of ios and android separately? Can't find it tough it seems pretty basic to me!

thx


Soap(Posted 2015) [#2]
AFAIK not built in, but you could add native externs for each target to handle it with just code, or edit the templates to how you want and reuse them.

http://stackoverflow.com/questions/18409310/force-landscape-for-one-view-controller-ios

http://stackoverflow.com/questions/2150287/force-an-android-activity-to-always-use-landscape-mode


abakobo(Posted 2015) [#3]
I'm very confused with this...
So how people usualy do? Because nearly all games have a fixed screen orientation.
And I suppose that not every body is using external function!
Is there something already done available.
Don't people think this should be implemented in mojo?


Soap(Posted 2015) [#4]
It's easier to edit the xcode project and android manifest files, and what people normally do, but I interpreted your original post as you not wanting to do this. There is nothing coded into mojo for changing screen orientation for all targets in once place but it would be possible to add.


Danilo(Posted 2015) [#5]
For Android -> App config settings:
#ANDROID_SCREEN_ORIENTATION="portrait"              'one of: user, portrait, landscape



ImmutableOctet(SKNG)(Posted 2015) [#6]
At least for Android, you can just use the 'ANDROID_SCREEN_ORIENTATION' preprocessor variable ("user", "portrait", and "landscape" are your options). Not sure about iOS, don't have a Mac to work with currently. From the "CONFIG.monkey" file for the target, I can assume the lack of something like this means it's based on the XCode project itself.

EDIT: Danilo beat me to the punch.


Soap(Posted 2015) [#7]
For Mac, there is a screen like this in xcode:

You will need to open your iOS project in xcode anyway when doing builds, and you only need to change the orientation setup once per clean build.

A forward should be setup to send http://www.monkey-x.com/docs/ to http://www.monkey-x.com/docs/html/Home.html

Who ever is doing the web admin for the site right now should set it up with http://www.google.com/intl/en/webmasters so that it is being indexed correctly for searching, because right now it's not setup right.


abakobo(Posted 2015) [#8]
Great!

It's indeed fairly simple to config... but googling gave me nothing fast and clear! If I had RTFM I would have known! ;P
It's the first time I need to go outside of my monkey code... and it's the only thing that was missing to build the releases of my monkey-x first games. So i was surprised that mojo can't do EVERYTHING! But i suppose it's normal and that Pro's go further in config and preprocessors setups (I supose that with adds there's a lot of config... and i don't have my apple developper account so i'm not testing on real ios devices..)

So if I want to change orientation during the games I would then need to fake it using matrix(for example) or use external function if I undestand well...

thx everybody


Soap(Posted 2015) [#9]
If you do not want to add any native code then yes you would need to "fake" it. But adding native code might be better.