## love-android-sdl2 (native, 0.9.2)

A project to port LÖVE to Android handhelds
Positive07
Party member
Posts: 1006
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

### Re: love-android-sdl2 (native, 0.9.0)

TurtleP wrote: Thanks, I must have read the documentation wrong or something.
No problem, can happen to anyone, also that part of the docs where really confusing to me too, they are described right, but it is hard to imagine it hahaha. Good luck with that! It's looking rather nice
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(Github.com/Positive07)
TurtleP
Party member
Posts: 147
Joined: Thu Mar 22, 2012 9:20 pm
Contact:

### Re: love-android-sdl2 (native, 0.9.0)

Positive07 wrote:
TurtleP wrote: Thanks, I must have read the documentation wrong or something.
No problem, can happen to anyone, also that part of the docs where really confusing to me too, they are described right, but it is hard to imagine it hahaha. Good luck with that! It's looking rather nice
Thanks! Yeah I made my own touch screen controls (and used Hugo's android analog library too) for this. It's going to detect mobile mode (Android/iOS) or desktop mode (PC/Mac/Linux) and apply various settings when needed.

One other problem, however, is that enemies are spawned as such (and only breaks in fullscreen mode!) and thus the game does not position things correctly for each device during the online co-op due to the scale and screen resolutions. Any advice on how to fix that?
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

### Re: love-android-sdl2 (native, 0.9.2)

While your post doesn't quite make it clear exactly what the problem is, it sounds like you're sending positions (of enemies and such) in pixel coordinates. Don't do that! Anything going over a network should be in resolution-independent coordinates that work on any client.
TurtleP
Party member
Posts: 147
Joined: Thu Mar 22, 2012 9:20 pm
Contact:

### Re: love-android-sdl2 (native, 0.9.2)

T-Bone wrote:While your post doesn't quite make it clear exactly what the problem is, it sounds like you're sending positions (of enemies and such) in pixel coordinates. Don't do that! Anything going over a network should be in resolution-independent coordinates that work on any client.
Yeah, that's probably my issue. Any tips on how to fix the issue?

These are snippets of my code, I'm not asking for you to change it for me, but just let me know why it's wrong (obviously using l.w.getWidth is one thing) and all positions are scaled on drawing, never during update functions.

My code for enemies (using cron for the timer):

Code: Select all

enemyclock = cron.every(cron_time, function() newenemy(love.math.random(5, (love.window.getWidth()/scale)-32), 0) end)
and all bosses position themselves in the center of the screen, so for example the first boss:

Code: Select all

boss:new((love.window.getWidth())/2-(bossimg:getWidth()*scale)/2, -60)
who moves around left and right a lot.

Yeah the code looks pretty bad, but it's old from around the first few revisions of the game.
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

### Re: love-android-sdl2 (native, 0.9.2)

How to I change the screen's orientation ? I've tried changing it in AndroidManifest.xml but when I repack and install I get an error saying that the app couldn't be installed.
Can you compile version 0.9.2b in portrait mode and post it here ?
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping

Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

### Re: love-android-sdl2 (native, 0.9.2)

Weird, I remember changing the orientation (and other things, too!) in the file manually without issues. How and on what system are you doing this?
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
li = love.image
lg = love.graphics
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

### Re: love-android-sdl2 (native, 0.9.2)

I'm doing this on windows and I'm using apktool 2.0.1 with the following commands:

Code: Select all

apktool d LOVE_for_android_0.9.2a.apk
Then I change the orientation to portrait in the xml and run this command:

Code: Select all

apktool b LOVE_for_android_0.9.2a -o newlove0.9.2a.apk
After that I move newlove0.9.2a.apk to my phone but it fails to install.

Here's the modified apk.
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping

Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

### Re: love-android-sdl2 (native, 0.9.2)

Anyone ?
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping

Firstport
Prole
Posts: 3
Joined: Sat Sep 12, 2015 7:17 am

### Re: love-android-sdl2 (native, 0.9.2)

http://imgur.com/a/4mfpv

So ive followed the detailed step by step. Exact but the /tools/ant.build.xml
Fails my build everytime at 538. While running the .bat command in the correct sdl2 root folder

MinSdkVersionOut I believe is around that line using notepad++

Unable to resolve project target Android-19

Probably a simple mistake that needs changing of targets, ive only made hello worlds before
L13B3
Prole
Posts: 2
Joined: Tue Sep 29, 2015 3:46 pm

### Re: love-android-sdl2 (native, 0.9.2)

Hey you all!

I just jumped aboard the Lövetrain <3
After successfully running "official" Löve for Android on my phone and booting my game, I decided I'd rather portrait mode than landscape. So I changed the AndroidManifest setting and repacked and installed and the game ran again, but ran into a few small things.

First off, I couldn't run games from /sdcard/lovegame. It worked when I used adb to push it and then run the shell, but not when normally running the app on my phone, which is peculiar. It lieu of a quicker workflow, I've returned to the official so I can make some progress quicker, hoping someone here could potentially know what's wrong with that?

Second, when I put it in portrait mode, the touchpressed, released and moved seemed to return x and y in terms of pixels rather than the usual [0,1] and I cannot for the life of me guess why that is.

Any thoughts?
Thanks!

### Who is online

Users browsing this forum: No registered users and 3 guests