Running java SDLActivity without androidx

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.
User avatar
Gunroar:Cannon()
Party member
Posts: 1142
Joined: Thu Dec 10, 2020 1:57 am

Running java SDLActivity without androidx

Post by Gunroar:Cannon() »

Heyo Everyo,

New question at the bottom/ later post
I was looking for a way to run a love2d like api on java, and I have a

few questions/ requests, pls.

ter
At first I thought to make it myself using luaj and libgdx.
1)Could that work(I am familiar in both java and lua now).
Then I found this(yae) and I don't know whether it's java or not, I see luaj there but it says it uses moonscript.
2) Is this what I'm looking for?
And
3) If there is anything like that out there I would like to know, no matter how old it is, just as long is it uses most of the graphic functions of love and reads lua(like love.draw)
Last edited by Gunroar:Cannon() on Tue May 18, 2021 12:18 pm, edited 1 time in total.
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
User avatar
tomxp411
Prole
Posts: 29
Joined: Thu Apr 08, 2021 5:41 pm

Re: Any luaj/Java love2d?

Post by tomxp411 »

Mostly, LÖVE is a binding between the standard Lua interpreter and SDL, which serves mostly to add graphics and sound to a language that doesn't actually have a native graphics or sound interface. I doubt you'll find "LOVE for Java", since Java already has a native graphics API, and porting LOVE on top of that is actually a bad idea. (Extra complexity always introduces more points of failure and usually causes slower execution.)

If you want to code games in Java, you should look at Java2D , SDLJava, or OpenGL.

Java2D is the native way of doing it: https://docs.oracle.com/javase/tutorial/2d/index.html
There is an SDL binding for Java, here: https://sourceforge.net/projects/sdljava/
JOGL is a binding for OpenGL: https://jogamp.org/jogl/www/

As to the sound and input stuff...

https://docs.oracle.com/javase/tutorial ... index.html

https://github.com/jinput/jinput
User avatar
Gunroar:Cannon()
Party member
Posts: 1142
Joined: Thu Dec 10, 2020 1:57 am

Re: Any luaj/Java love2d?

Post by Gunroar:Cannon() »

Thank you for the reply,
The main reason for this topic is so I can just make a love2d project run in java, even though it isn't necessarily a port. Like just a way to run lua files in java and then do the love,graphics module with another thing (like libgdx, and such) so I can just take a project I've already done in love2d, and with minimal changes, make it run on java(luajit not needed). love table here could just be a wrapper for that uses the graphics to löve style.
So is this possible? And how difficult is it?
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
User avatar
tomxp411
Prole
Posts: 29
Joined: Thu Apr 08, 2021 5:41 pm

Re: Any luaj/Java love2d?

Post by tomxp411 »

Are you saying you want to run the Lua code using the Java runtime?

Hmm... that's a completely different monster. Now I see why the reference to LuaJ.

Unless someone has already written a JavaLÖVE interface, then yes - you'd have to implement your own classes on the Java side to replace the LÖVE APIs. It would be time consuming, but it should certainly be possible, even if it's not a 100% perfect solution.

Out of curiosity, why Java? Is there an operating system you want to run stuff on that LÖVE doesn't support?
User avatar
Gunroar:Cannon()
Party member
Posts: 1142
Joined: Thu Dec 10, 2020 1:57 am

Re: Any luaj/Java love2d?

Post by Gunroar:Cannon() »

Thnx for the reply(again)
tomxp411 wrote: Fri May 14, 2021 11:43 pm Are you saying you want to run the Lua code using the Java runtime?

Hmm... that's a completely different monster. Now I see why the reference to LuaJ.

Unless someone has already written a JavaLÖVE interface, then yes - you'd have to implement your own classes on the Java side to replace the LÖVE APIs. It would be time consuming, but it should certainly be possible, even if it's not a 100% perfect solution.
So it is possible, and can be done with luaj, in a way that I just have to make it run my main.lua and it will run just like (or close to) love?

Will the speed still be okay, comparable to a love2d game without luajit?

And could I use libgdx or is there something better, because I'm competent in java but I don't know alot outside libgdx, you suprised me there with java2d.

tomxp411 wrote: Fri May 14, 2021 11:43 pm Out of curiosity, why Java? Is there an operating system you want to run stuff on that LÖVE doesn't support?

1)I want a quick way to compile a game on android, so I don't think that java2d would work. (I find the other way to difficult for me, yes, more difficult than coding a love2d like wrapper for a java gui lib). And with java I can easily add any function for android that I might randomly need(running app in background, notifications, the works)
2) also the run once deploy everywhere skeme
3) polish more on java
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
User avatar
Gunroar:Cannon()
Party member
Posts: 1142
Joined: Thu Dec 10, 2020 1:57 am

Re: Running java SDLActivity without androidx

Post by Gunroar:Cannon() »

New question
I dug into the code for an android love2d which I saw uses SDLActivity as the main thing. But it also uses the package androidx which I have many errors with when I install multiple versions(not at once). I tried to remove it and all code referencing to it but the app closes after I successfully compile it.

Anyway to run that SDL activity without androidx?
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
User avatar
AuahDark
Party member
Posts: 107
Joined: Mon Oct 23, 2017 2:34 pm
Location: Indonesia
Contact:

Re: Running java SDLActivity without androidx

Post by AuahDark »

Looks like you held broken versions? Since the GitHub Actions job compiles successfully then the problem is most likely on your end, give me the exact error message.
Profile. Do you encounter crashes in LÖVE Android and wanna send me logcats? Please hit me up in LÖVE Discord and send the full logcat file!
User avatar
Gunroar:Cannon()
Party member
Posts: 1142
Joined: Thu Dec 10, 2020 1:57 am

Re: Running java SDLActivity without androidx

Post by Gunroar:Cannon() »

AuahDark wrote: Mon May 24, 2021 3:24 pm Looks like you held broken versions? Since the GitHub Actions job compiles successfully then the problem is most likely on your end, give me the exact error message.
I don't have the exact errors due to me having changed the folder and things in it, but it said/says things like:
1) no package android.view.DisplayCutout, even when I try to update jar
2) it says variable is already defined. Not in java codem in an xml.(yes, this one isn't very helpful, sorry.)
3) It says openURL does not exist

I get androidx through maven but that's when I get the errors. I want to download the androidx.jar ,like how I updated android.jar manually, but I can't see it anywhere.
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
User avatar
AuahDark
Party member
Posts: 107
Joined: Mon Oct 23, 2017 2:34 pm
Location: Indonesia
Contact:

Re: Running java SDLActivity without androidx

Post by AuahDark »

You're using SDK API 30 right? android.view.DisplayCutout (not related to AndroidX) is available at SDK API 28, so if you don't have that then there's high chance you're using old SDK API version.
Profile. Do you encounter crashes in LÖVE Android and wanna send me logcats? Please hit me up in LÖVE Discord and send the full logcat file!
User avatar
Gunroar:Cannon()
Party member
Posts: 1142
Joined: Thu Dec 10, 2020 1:57 am

Re: Running java SDLActivity without androidx

Post by Gunroar:Cannon() »

Yes, thank you. I think I am, I got displaycutout working at some point but still couldn't find androidx update without maven. All links I got were expired. Androidx seems to be the problem now, and I'm not too confident in updating it either, that's why I wonder whether I can do it without Androidx even if it removes features.

And is DisplayCutout that important. I saw it used only once.
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot] and 5 guests