Page 1 of 1

Love for Android

Posted: Thu Apr 16, 2020 4:52 am
by jdawg68421
Hello!

I plan on building a game for mobile and would like to use LOVE. I plan on using the APK tool here https://love2d.org/wiki/Game_Distribution/APKTool

I am struggling to find any relevant documentation on building games in LOVE for mobile and have some questions.

1. What LOVE APIs should be used for mobile specific features (e.g. Touch APIs)
2. What LOVE APIs should be avoided/don't work well with Mobile?
3. What are the common gotchas/pitfalls with LOVE for Mobile?

Thanks :)

Re: Love for Android

Posted: Sat Apr 18, 2020 11:57 am
by AuahDark
1. The only mobile-specific API is love.window.getSafeArea. It's used to retrieve areas which aren't obstructed by cutout. love.touch, love.touchpressed, and love.touchreleased aren't mobile-specific as it also work in Windows with multitouch-capable monitor.
2. Resizing window is not really possible in LOVE, but changing the screen orientation to portrait is possible by specifying portrait resolution (i.e. 9:16) and landscape orientation with landscape resolution (i.e. 16:9)
3. Android-specific: Canvas appear too big or image appear too big. This is because LOVE Android always have highdpi enabled and LOVE enables DPI scaling by default, which causes resolution returned by love.graphics.getDimensions() smaller than resolution returned by love.window.getMode(). You can workaround it by setting t.window.usedpiscale, but I personally prefer working with DPI-scaled units.