love2d / love-android

Android build setup for LÖVE.
https://love2d.org
Other
198 stars 70 forks source link

Live wallpaper target #178

Closed slime73 closed 5 years ago

slime73 commented 5 years ago

Original report by Anonymous.


I would like to use visuals created in Love as live wallpaper for Android.

How much work would it be to add support for wallpaper apps?

slime73 commented 5 years ago

Original comment by Alex Szpakowski (Bitbucket: slime73, GitHub: slime73).


How much work would it be to add support for wallpaper apps?

From what I understand, you'll probably need to modify at least one of the Activity.java files, as well as the Manifest.xml file. It's out of the scope of what stock love is meant to do, but I'm not going to stop anyone from doing it themselves. :)

jmiskovic commented 1 year ago

Live wallpapers can receive touches and they are always open underneath the android launcher. They could effectively be a complete GUI app.

There are many opportunities here to enhance your daily interaction with phone, using the Love framework:

I appreciate this is out of scope for this repo. This issue comes up near top in search engines, so it's a good spot to discuss more about this?

I'd appreciate more details on how this could be implemented? Is any existing project running Love2D as a livewallpaper on Android?

MikuAuahDark commented 1 year ago

I don't think LOVE, or any game engine/framework is suitable for live wallpaper in general.

No one will stop you from adding live wallpaper support for LOVE but they won't be merged into upstream.

jmiskovic commented 1 year ago

Do you think so because of power drainage, or that the framework would take too much resources?

I'm currently running the ShaderEditor as a wallpaper. It's only draining battery when the launcher is on screen and it's pretty lightweight overall. It runs very smoothly.

By lowering the framerate through the vsync setting the framework could be slowed down a bit I think. Maybe even reduced to tap events. Can you say more why love2d is unsuitable here?

MikuAuahDark commented 1 year ago

Vsync ensures the game loop runs equivalent to the screen framerate, but currently LOVE doesn't support any vblank interval above 1 in Android, so it's either 60FPS on 60Hz monitor or no vsync (there's no support for 30FPS on 60Hz monitor for now). On heavy scenes, neither are good for the battery life. Also consider that LuaJIT runs in interpreter mode in Android by default due to memory allocator issue, so it's not as efficient as in desktops and CPU usage must also be considered.

Other than that, having LOVE support as live wallpaper target would be complicated and raises many questions. How will user specify the .love file? What if user just want to run the .love file not as live wallpaper but as game? How to differentiate if the LOVE file runs as live wallpaper or as game? and so on.