Page 15 of 33

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

Posted: Thu Mar 13, 2014 12:16 am
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

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

Posted: Thu Mar 13, 2014 9:19 pm
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

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

Posted: Fri Mar 14, 2014 2:56 am
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 146 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

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

Posted: Fri Mar 14, 2014 9:41 pm
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?

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

Posted: Fri Mar 14, 2014 11:17 pm
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.

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

Posted: Sat Mar 15, 2014 2:50 am
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

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

Posted: Sat Mar 15, 2014 3:49 am
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?

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

Posted: Sat Mar 15, 2014 4:29 am
by Positive07
I don't know how that works, but maybe... I'll take a look

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

Posted: Sat Mar 15, 2014 8:23 am
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:

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

Posted: Sat Mar 15, 2014 3:03 pm
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. :(