Changing the Android Orientation In-game?
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
- Jackkel Dragon
- Veteran
- Posts: 269
- Joined: Mon Mar 31, 2014 7:17 pm
- Organization: Nightshade, Team Despair
- itch: jackkel-dragon
- Location: USA
- Contact:
Changing the Android Orientation In-game?
Is there any means by which a Ren'Py game running on an Android device could change the AndroidManifest.xml's orientation property? Right now, I have a few games that are set to use the device's sensor to determine where to orient the screen, but this can lead to odd behavior if the device is held at an angle. Therefore, I'd like to lock the screen into a sensible position while still allowing the player to pick which orientation to use. Is this possible, or does that value get baked-in once it's compiled into binary code to package the APK?
Main Website
Includes information about and links to many of my current and past projects.
Major Game Projects
[Nightshade] Eldritch Academy, Eldritch University, Blooming Nightshade, Flowering Nightshade, Life as Designed
[Team Despair] Corpse Party D2 series
Includes information about and links to many of my current and past projects.
Major Game Projects
[Nightshade] Eldritch Academy, Eldritch University, Blooming Nightshade, Flowering Nightshade, Life as Designed
[Team Despair] Corpse Party D2 series
- Ocelot
- Eileen-Class Veteran
- Posts: 1883
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: Changing the Android Orientation In-game?
You can usually disable automatic orientation on Android phones in Notification Panel. Applications should respect that property. This is what generally used to lock screen in certain orientation.
< < insert Rick Cook quote here > >
- Jackkel Dragon
- Veteran
- Posts: 269
- Joined: Mon Mar 31, 2014 7:17 pm
- Organization: Nightshade, Team Despair
- itch: jackkel-dragon
- Location: USA
- Contact:
Re: Changing the Android Orientation In-game?
That doesn't seem to be how Samsung Galaxy phones work, in my experience. Even when playing games that are exclusively in landscape mode with the orientation locked, the phone will try to swap between the two potential landscape orientations if it thinks the phone is "upside-down". I'm starting to get the impression that there are multiple roadblocks to offering multiple orientation layouts in an Android game, Ren'Py or otherwise...
As for Ren'Py itself, I currently have the game with the issue using "autoSensor", which always picks based on the phone's gyroscope and not which in-game layout is being used. The only alternative I can think of is to try to make one layout rotate 90 degrees so I can lock the orientation...
As for Ren'Py itself, I currently have the game with the issue using "autoSensor", which always picks based on the phone's gyroscope and not which in-game layout is being used. The only alternative I can think of is to try to make one layout rotate 90 degrees so I can lock the orientation...
Main Website
Includes information about and links to many of my current and past projects.
Major Game Projects
[Nightshade] Eldritch Academy, Eldritch University, Blooming Nightshade, Flowering Nightshade, Life as Designed
[Team Despair] Corpse Party D2 series
Includes information about and links to many of my current and past projects.
Major Game Projects
[Nightshade] Eldritch Academy, Eldritch University, Blooming Nightshade, Flowering Nightshade, Life as Designed
[Team Despair] Corpse Party D2 series
- PyTom
- Ren'Py Creator
- Posts: 15893
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Changing the Android Orientation In-game?
Ren'Py doesn't do anything special, other than react to the changes in screen size reported to it by Android. I don't know how to accomplish what you want, but it might be possible to do so using pyjnius to access the Activity. (Which is available as the mActivity field on the org.renpy.android.PythonSDLActivity class. It might also be possible to do something with the AndroidManifest.xml file to accomplish this.
Normally, all of these files are overwritten when an Android project is created. There is an option to prevent this in the configuration if you want to update the files yourself.
Normally, all of these files are overwritten when an Android project is created. There is an option to prevent this in the configuration if you want to update the files yourself.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom
- Jackkel Dragon
- Veteran
- Posts: 269
- Joined: Mon Mar 31, 2014 7:17 pm
- Organization: Nightshade, Team Despair
- itch: jackkel-dragon
- Location: USA
- Contact:
Re: Changing the Android Orientation In-game?
Would it be possible to edit the screenOrientation field on the activity class mid-game, using pyjnius? If so, that may be just what I need. I'll also take a look myself, if the documentation mentions how to affect attributes of the activity class...
Main Website
Includes information about and links to many of my current and past projects.
Major Game Projects
[Nightshade] Eldritch Academy, Eldritch University, Blooming Nightshade, Flowering Nightshade, Life as Designed
[Team Despair] Corpse Party D2 series
Includes information about and links to many of my current and past projects.
Major Game Projects
[Nightshade] Eldritch Academy, Eldritch University, Blooming Nightshade, Flowering Nightshade, Life as Designed
[Team Despair] Corpse Party D2 series
Who is online
Users browsing this forum: Google [Bot]