Page 1 of 2

Running java SDLActivity without androidx

Posted: Fri May 14, 2021 11:56 am
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)

Re: Any luaj/Java love2d?

Posted: Fri May 14, 2021 4:53 pm
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

Re: Any luaj/Java love2d?

Posted: Fri May 14, 2021 6:49 pm
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?

Re: Any luaj/Java love2d?

Posted: Fri May 14, 2021 11:43 pm
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?

Re: Any luaj/Java love2d?

Posted: Sat May 15, 2021 9:59 am
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

Re: Running java SDLActivity without androidx

Posted: Tue May 18, 2021 12:21 pm
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?

Re: Running java SDLActivity without androidx

Posted: Mon May 24, 2021 3:24 pm
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.

Re: Running java SDLActivity without androidx

Posted: Mon May 24, 2021 6:35 pm
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.

Re: Running java SDLActivity without androidx

Posted: Tue May 25, 2021 12:34 pm
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.

Re: Running java SDLActivity without androidx

Posted: Tue May 25, 2021 8:44 pm
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.