Hi guys, I have a problem, I want to force the rotation of the screen to just one side, I am not talking about orientation, I am using 11.3a version and fortunately I didn't have any problems with the orientation, the only problem is that when in landscape mode, when I open the screen and then rotate it to 180°(rotate not flip), then the landscape mode also rotates to that side.
Those who didn't understand, If I opened the game engine, while my charging port(it is located in the bottom of my phone) was facing right, If I rotate the screen and the charging ports gets to the left side, the screen rotates too in that direction, and I don't want that.
I hope you understood what I meant to say, If you guys got any solution, kindly tell me I will be very thankful
How to force rotation in Android
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 15
- Joined: Sat Aug 13, 2022 7:25 am
Re: How to force rotation in Android
There was discuttion recently, I think you can change it in manifest, forcing display orientation to landscape and then compile love-android
-
- Prole
- Posts: 15
- Joined: Sat Aug 13, 2022 7:25 am
Re: How to force rotation in Android
Sorry sir/ma'am, I didn't understand it well, I'm just a noob and I am making the game in a tablet and I don't have any computer, kindly make it more clear
Re: How to force rotation in Android
It's that you have to compile love apk yourself and change some code to be able to change orientation (to deny reverse landscape). I may try to compile it for you, but I cannot guarantee the result will work as expected, but you will also need to compile the apk and add .love file to it in compilation process, if you would want to distribute your apk as game.
But if you want only to not flip the screen for you, try to lock screen orientation in your phone settings.
But if you want only to not flip the screen for you, try to lock screen orientation in your phone settings.
-
- Prole
- Posts: 15
- Joined: Sat Aug 13, 2022 7:25 am
Re: How to force rotation in Android
So, it can't be done . Anyways, thanks a lot for helping me, Nothing can be done for this, because I don't have a computer to do compiling, messing with the source code and all and android as a devtool is really problematic. Thanks again. Have a nice day.
Re: How to force rotation in Android
I actually tried to build the apk (however I didn’t tested it), let me know, if you want to try it.
-
- Prole
- Posts: 15
- Joined: Sat Aug 13, 2022 7:25 am
Re: How to force rotation in Android
Yes sure! I'd love to try it out .
Re: How to force rotation in Android
Here you go, please let me know, if it worked (I changed display orientation to landscape in AndroidManifest.xml and added some code snippet from Stack overflow to GameActivity.java: to be more precise, I added setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); to onCreate method)
Also note, that I used some slightly modified version of love, and I forgot, what I changed, so I hope, there wouldn't be any significant differences (I think, I removed love logo somehow), but if it will work, I can try it with fresh copy of love2d-android
Also note, that I used some slightly modified version of love, and I forgot, what I changed, so I hope, there wouldn't be any significant differences (I think, I removed love logo somehow), but if it will work, I can try it with fresh copy of love2d-android
- Attachments
-
- app-normal-noRecord-universal-release-unsigned.zip
- (7.93 MiB) Downloaded 441 times
-
- Prole
- Posts: 15
- Joined: Sat Aug 13, 2022 7:25 am
Re: How to force rotation in Android
It's showing: "You can't download the apk in your device"....do you know why??
Re: How to force rotation in Android
Also look at this functions that could help you to draw the application depending on screen orientation:
* https://love2d.org/wiki/love.window.get ... rientation
* https://love2d.org/wiki/DisplayOrientation
Locking rotation, would be interesting also for me on GNU/Linux phone. Hope it will be implemented by default in futur version of LÖVE.
* https://love2d.org/wiki/love.window.get ... rientation
* https://love2d.org/wiki/DisplayOrientation
Locking rotation, would be interesting also for me on GNU/Linux phone. Hope it will be implemented by default in futur version of LÖVE.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 14 guests