love-android-sdl2 (native, 0.9.2)

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

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

Post by Positive07 »

slime wrote:
Mermersk wrote:Does anybody know how resolution works ? If I set no resolution in config file, will it just readjust to each screen size? I guess what I am asking is: is resolution something I have to think about while developing for android ?
If it can't do the resolution you choose (or the default 800x600), then it'll pick the next highest available for the system. If you set 0 for width and height, it'll choose the full size possible.

However, DPI is an issue to be aware of on Android. Two devices might have the same screen size in real life, but one might be twice the resolution of the other - and the user expects content to look "normal" on the one with twice the resolution in the same physical space.

love.window.getPixelScale can help you with that (it's also a feature that will be in the official version of LÖVE 0.9.1.)
I had troubles when I set the height and width to 0... I dont remember why thought.
You also have DisplayMetrics, you can use that too

EDIT: I dont know if your proposal for a common api using getPixelScale() was implemented slime, That's why I am writing this

EDIT2: It was implemented, sorry
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
Ratchet
Citizen
Posts: 67
Joined: Mon Apr 08, 2013 10:32 am

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

Post by Ratchet »

Positive07 wrote:I made this test for love-android today, it could make many things possible.
I dont know if it works in every phone but it works in mine (LG Optimus L4 II)
Tell me if it does work on yours.

I wanted to test if I could use the accelerometer to detect whether the phone was on landscape or portrait mode. As I said, this works on my phone but I'm not sure if it works in others.

PS: There is other mode that can be detected, "default" mode (the commented out one). That one is when the phone is lying flat (in a table for example), but it makes the other two modes a little buggy.

PS3: I had some problems while running it in a tablet but couldnt find the error yet. I'll keep trying

workes fine on my Samsung Galaxy Tab 2 10.1
just what I was searching for
macOS 10.14 Mojave | LÖVE 11.2
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

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

Post by Positive07 »

Ratchet wrote: workes fine on my Samsung Galaxy Tab 2 10.1
just what I was searching for
Just don't expect it to run in every phone or tablet, It doesnt work in some, others dont have accelerometers, others have them in a different arrengement (if you think that the x axis aims to the front it may aim down, you dont know), others have the screen rotated (landscape is portrait? I dont really know if it is possible)... I'll try to make it more stable, thought right now I don't know how to do that...

I'll build a library from this so it is easier to integrate in projects and debug

EDIT: Here you are, turn.lua is a library you can use freely, check the main lua for some instructions and the comments on turn.lua for more information about it... grab this:
TURN.love
Orientation now made a library!
(3.65 KiB) Downloaded 151 times

EDIT2:
Setted up a little bitbucket repository so I could get familiar with Git :| here it is
I wrote some documentation in the readme.md file
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
Ratchet
Citizen
Posts: 67
Joined: Mon Apr 08, 2013 10:32 am

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

Post by Ratchet »

The turn lib workes fine but I got a problem:

I need the keyboard and use

Code: Select all

love.keyboard.setTextInput(true)
to show it. But in portrait mode the keyboard is still in landscape mode. Is there a solution for that?
macOS 10.14 Mojave | LÖVE 11.2
User avatar
tio
Citizen
Posts: 61
Joined: Thu Dec 12, 2013 1:04 pm
Location: BR BR?
Contact:

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

Post by tio »

Ratchet wrote:The turn lib workes fine but I got a problem:

I need the keyboard and use

Code: Select all

love.keyboard.setTextInput(true)
to show it. But in portrait mode the keyboard is still in landscape mode. Is there a solution for that?
You probably need to edit the manifest and repackage the apk.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

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

Post by Positive07 »

Yeah you cant turn the keyboard with my code since that is independant, you could implement your own keyboard thought

and as tio point it out you can change the manifest to open the app in portrait mode so that it displays the keyboard in portrait but then if you turn the screen into landscape with my lib then the keyboard would still be in landscape mode
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
tio
Citizen
Posts: 61
Joined: Thu Dec 12, 2013 1:04 pm
Location: BR BR?
Contact:

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

Post by tio »

Positive07 wrote:Yeah you cant turn the keyboard with my code since that is independant, you could implement your own keyboard thought

and as tio point it out you can change the manifest to open the app in portrait mode so that it displays the keyboard in portrait but then if you turn the screen into landscape with my lib then the keyboard would still be in landscape mode
Wouldn't "auto" screen mode solve this?
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

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

Post by Positive07 »

I don't know how that works, but maybe... I'll take a look
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
Ratchet
Citizen
Posts: 67
Joined: Mon Apr 08, 2013 10:32 am

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

Post by Ratchet »

Positive07 wrote:Yeah you cant turn the keyboard with my code
How?
I took you example for the turn lib from git and add love.keyboards.setTextInput(true) to the love.mousepressed event, so I can bring up the keyboard. But it's always in landscape mode. Do I have to do anything special?
Positive07 wrote:you could implement your own keyboard thought
I want to avaoid that. Why to reinvent the wheel and do a lot of extra work when I can get a full working keyboard from the system instead :3 Also I'm damn lazy :crazy:
macOS 10.14 Mojave | LÖVE 11.2
User avatar
fysx
Citizen
Posts: 97
Joined: Mon Jan 30, 2012 8:36 pm
Contact:

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

Post by fysx »

tio wrote:Just downloaded beta2, and couldn't do file association thing (it keeps opening with a text editor app).
Are you maybe using Firefox? The link + .love works for me when clicking on it using Chrome Mobile. Firefox Mobile is not working and I have no idea how to create intents from Firefox. :(
Bird thing: @fysxdotorg Blog thing: fysx.org
Locked

Who is online

Users browsing this forum: No registered users and 1 guest