screen rotation

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Andlac028
Party member
Posts: 174
Joined: Fri Dec 14, 2018 2:27 pm
Location: Slovakia

Re: screen rotation

Post by Andlac028 »

I think, you are looking at this setting in either AndroidManifest.xml or gradle.properties. But note, that need to compile love-android for this purpose (however, if you would like to release your game to Play Store or as apk, you need to compile it anyway.
soytak111
Prole
Posts: 25
Joined: Sat Sep 17, 2022 1:00 am

Re: screen rotation

Post by soytak111 »

compile? and how do i lauch my game whit love-android?
lua,contrary to other language,give you as much space as moon :awesome:
Andlac028
Party member
Posts: 174
Joined: Fri Dec 14, 2018 2:27 pm
Location: Slovakia

Re: screen rotation

Post by Andlac028 »

soytak111 wrote: Wed Mar 15, 2023 12:04 pm compile? and how do i lauch my game whit love-android?
Please note, that when you are compiling, can take some time, but once you setup it and compile it for first time, it will be much faster.

The whole manual, how to compile, can be found at wiki: Game Distribution, under Android section. However it may be harder, if you didn’t compiled anything before, so feel free to ask in case of any questions / problems.
soytak111
Prole
Posts: 25
Joined: Sat Sep 17, 2022 1:00 am

Re: screen rotation

Post by soytak111 »

so my game work whit love-android if i compile my game?
lua,contrary to other language,give you as much space as moon :awesome:
User avatar
pgimeno
Party member
Posts: 3544
Joined: Sun Oct 18, 2015 2:58 pm

Re: screen rotation

Post by pgimeno »

According to some old posts, it used to be the case that setting a resolution where X > Y set fixed landscape mode and one with X < Y set fixed portrait mode. I don't know how current that is, because I never found any documentation about it. But maybe it's worth a try. You set the resolution with love.window.setMode().
User avatar
Bigfoot71
Party member
Posts: 287
Joined: Fri Mar 11, 2022 11:07 am

Re: screen rotation

Post by Bigfoot71 »

soytak111 wrote: Wed Mar 15, 2023 1:04 pm so my game work whit love-android if i compile my game?
Yes, basically you can embed your game in the löve-android APK. (as well as giving it the name and icon you want, etc.)

It's like when you embed your .love in the .exe of love2d.

Roughly there is the love.exe program (or the love-android application) which launches .love externally, and the possibility of embedding the source of your game directly in it so that it launches by itself.

I hope it's understandable said like this ^^
My avatar code for the curious :D V1, V2, V3.
soytak111
Prole
Posts: 25
Joined: Sat Sep 17, 2022 1:00 am

Re: screen rotation

Post by soytak111 »

So, I modify the android:screenOrientation to the parameter I want(i think it's landscape but there is also a locked mode?)Then i zip my project(with rar for me) and rename it .love, and finally, I use my file manager and I click on it and it would open the project with love-android

edit:doesnt work
lua,contrary to other language,give you as much space as moon :awesome:
User avatar
Bigfoot71
Party member
Posts: 287
Joined: Fri Mar 11, 2022 11:07 am

Re: screen rotation

Post by Bigfoot71 »

soytak111 wrote: Wed Mar 15, 2023 6:36 pm So, I modify the android:screenOrientation to the parameter I want(i think it's landscape but there is also a locked mode?)Then i zip my project(with rar for me) and rename it .love, and finally, I use my file manager and I click on it and it would open the project with love-android

edit:doesnt work
I'm not sure I follow you, where did you modify (and in what) "android:screenOrientation"?

Are you trying to compile your app? If not, where did you change it?

Specify what you are doing I lose myself personally ^^

And just in case, are you talking about WinRar and not the .rar format? Because it is necessary to compress in .zip to rename in .love and not in .rar (I specify it just by precaution). (Also you don't need .love when compiling your game for android)

State more precisely what you are trying to do, it is not very clear.
My avatar code for the curious :D V1, V2, V3.
soytak111
Prole
Posts: 25
Joined: Sat Sep 17, 2022 1:00 am

Re: screen rotation

Post by soytak111 »

in the gradle proprety file of love-android.I used Winrar but used .zip .I thought that when you said about compiling was to make my project to a .love file. Then what are you saying about compiling? And a step by step would help :)
lua,contrary to other language,give you as much space as moon :awesome:
User avatar
Bigfoot71
Party member
Posts: 287
Joined: Fri Mar 11, 2022 11:07 am

Re: screen rotation

Post by Bigfoot71 »

You need to compile love-android, ie rebuild the application. Compiling means very roughly (if you don't know) transcribing human language like C/C++ into machine language.

You have Lua which is an interpreted language (without going into detail with LuaJIT which is a just in time compiler, in short I don't want to lose you) which means that the computer interprets your scripts "live" (again it's an approximation) thanks to a program which in this case is Lua which itself was written in C and which had to be compiled to work. A program must be compiled for each target platform, so a program compiled for Windows will not work for Linux.

Well that's very basic theory, now regarding the compilation of love-android for Android, I don't know if I could explain it better than the wiki but let's go!

Installing GIT:

First of all, here's one thing that will help you a lot (now and later) and that's the git program. This will allow you to clone the love-android repository (the source) as well as the associated sub-modules.

For Windows: https://gitforwindows.org/
For MacOS: https://git-scm.com/download/mac
For Linux on a Debian-like distribution:

Code: Select all

sudo apt install git
If you are on Windows:

I don't really know how it works anymore but maybe you should check if the GIT executable is in the PATH environment variable.

To check this you can open the terminal (WIN+R then type "cmd").

Once in the terminal type "git". If the command is not recognized then git is not in the PATH environment variable. You can add it either by simply searching for PATH or "Environment variables" in the start menu, or use this command (replacing "<GIT_INSTALL_DIR>\bin" with the directory where you installed git and where is the file git.exe):

Code: Select all

setx /m PATH "%PATH%;<GIT_INSTALL_DIR>\bin"
Last preparations:

You will need the compilation tools for Android, the easiest way for you will be to install Android Studio directly, here is the link to download the installer: https://developer.android.com/studio

If you are on Linux you can use snap:

Code: Select all

sudo snap install android-studio --classic
During installation you should have the choice to download several SDK API versions, the different versions give you different functionality depending on the version of Android you are targeting.

In our case you will need API 33. Perhaps during the installation (or after) you will also have to select the NDK (this is what allows you to compile C/C++ for Android, don't panic, you won't need to code C/C++, just compile it ^^)

If this is not offered during the installation you will have to go to the "SDK manager" menu and select the NDK to install it.

You will also need to have set the ANDROID_SDK_ROOT environment variable to the location of your Android SDK and run.
Normally Android Studio did it on its own.

If in doubt it's explained here in the love-android wiki: https://github.com/love2d/love-android/ ... oid-studio

Clone love-android repository:

Now that you have GIT you can clone the repo, you will need to use this command which will include the love2d submodules:

Code: Select all

git clone --recurse-submodules https://github.com/love2d/love-android
This will clone the repository to the directory where the terminal is open. If you don't want to take the lead, open the folder in which you want to clone the directory and type "cmd" in the bar where the current directory is displayed, this should open a terminal directly in this folder.

Include your game source:

In the cloned repo folder, you go to "app/src/embed/assets" and put all your game source files there, no need to compress it to .love.

You must have understood how to edit the graddle.properties file to put the version of your app, name, etc...
You can also change the icon which are contained in several resolutions in "app/src/main/res"

Regarding the icons, I advise you to make an image of 1024x1024 and you can quickly obtain all sizes thanks to this site: https://www.appicon.co/

Time to compile!

Now that you can compile you can do it either from Android Studio if you want to do it without typing command lines. Many tutorials exist then on YouTube or other.

Otherwise (and if the installation of Android Studio went well) you can do it from the gradlew or gradlew.bat files present in the repository you cloned by typing these commands:

For Windows:

Code: Select all

gradlew.bat assembleEmbedNoRecordRelease
For Linux:

Code: Select all

./gradlew assembleEmbedNoRecordRelease
assemble: Means that we want to make an APK, you can change it to "bundle" if you want an AAB to publish on the playstore.
Embed: Means you compile with the "embed" folder which contains your game, you can compile it with "Normal" for the normal version.
NoRecord: Means you will not use the microphone with your app.
Release: Means that you compile in release, you can replace it with "Debug" if you want to compile in debug. Be aware that to run a debug app on an Android device you will need permissions.

So if you want to compile the "normal" version of love-android it will give this:

Code: Select all

gradlew assembleNormalRecord
If I explained this part badly, everything can be found again in the wiki: https://github.com/love2d/love-android/ ... -Packaging

Signed your app:

You will also need to sign your application for it to run on your device.

Either you compile with Android Studio and everything should be offered to you automatically, or you compiled on the command line then in this case uber-apk-signer if the app is for your personal use and you don't want to worry about it, otherwise you will have to create your personal keystore for signing it, here is an explanation on stackoverflow: https://stackoverflow.com/a/40064149

Endnote:

That's very rich, I hope you have all the keys now but don't get used to being given all this to you every time :death: :ultraglee:
I hope I was clear enough anyway, compiling a program is not easy when you start so don't hesitate at the slightest problem, also hoping that I haven't forgotten anything :monocle:

And especially if something is not clear either do not hesitate especially once again.
(and hoping that my English is decent enough to understand something so "technical")
My avatar code for the curious :D V1, V2, V3.
Post Reply

Who is online

Users browsing this forum: No registered users and 55 guests