How should phone/android specific api extensions be made accessible ?
things like multi-touch, sensors like accellerometer, magnetic field (compass?), orientation (gravity?), gps, light
and possibly stuff like phone specific popup notifcations, home/menu button overrides, maybe opening map and browser apps...
currently the love-android apk makes them available as love.phone.getSensorList() etc,
including new user-defined callbacks like
function love.phone.touch (action,data) ... end -- for multitouch
function love.phone.sensorevent (sensorid,data) ... end
is there interest/need to agree on common naming/api schemes now for possible future projects like iphone ?
are there maybe love2d ports for handheld devices that already have apis like that ?
possibly interesting links regarding sensor and multitouch abstraction in the android java sdk :
http://developer.android.com/reference/ ... Event.html
http://developer.android.com/reference/ ... ensor.html
http://developer.android.com/reference/ ... Event.html (touch)
api extensions: api discussion
- ghoulsblade
- Party member
- Posts: 111
- Joined: Sun Oct 31, 2010 6:11 pm
api extensions: api discussion
love-android - gamejams
- josefnpat
- Inner party member
- Posts: 955
- Joined: Wed Oct 05, 2011 1:36 am
- Location: your basement
- Contact:
Re: api extensions: api discussion
There also needs to be a way to test these functions on the computer.
Installing a Gyrometer on my computer does not sound like a cup of tea.
Installing a Gyrometer on my computer does not sound like a cup of tea.
Missing Sentinel Software | Twitter
FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
- Taehl
- Dreaming in associative arrays
- Posts: 1025
- Joined: Mon Jan 11, 2010 5:07 am
- Location: CA, USA
- Contact:
Re: api extensions: api discussion
Just as an initial suggestion...
One thing I think is very important is for Love-Android itself to maintain a best estimate for stuff like GPS data, and return the best estimate instead of raw data. This is not a wheel every Love game should have to reinvent.
Also, maybe it would be a good idea to have callbacks for onCreate, onStart, onRestart, onResume, onPause, onStop, and onDestroy events?
Also, should Love-Android expose the remapCoordinateSystem function? Food for thought.
Code: Select all
-- love sensor functions:
love.sensor.getTouches(n) -- returns the x and y coordinate of touch-point n (or nil,nil). If n is nil, returns a vararg of all touch point pairs
love.sensor.getCompass() -- returns the the compass sensor's numbers
love.sensor.getOrientation() -- returns the orientation sensor's numbers
love.sensor.getGPS() -- returns the coordinates from the GPS
love.sensor.getLight() -- returns the lightness level, from 0 to 1 (divide lux by 120000)
-- other functions:
love.android.showToast(message, long) -- displays a Toast of message. If long is true, then make the toast long, else short.
love.android.startActivity(n, ...) -- summons an Activity via an Intent. I have no idea what parameters this should have, honestly. Getting data to the Activity would be great.
love.android.getActivityResults(n) -- returns the results Activity n may have sent (vararg), or nil
-- new callbacks:
function love.androidHome() end -- called when the Home button is pressed (a good time for saving the game)
function love.androidMenu() end -- called when the Menu button is pressed
function love.androidBack() end -- called when the Back button is pressed (another good time for saving the game)
function love.androidFind() end -- called when the Find button is pressed
Also, maybe it would be a good idea to have callbacks for onCreate, onStart, onRestart, onResume, onPause, onStop, and onDestroy events?
Also, should Love-Android expose the remapCoordinateSystem function? Food for thought.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
- tentus
- Inner party member
- Posts: 1060
- Joined: Sun Oct 31, 2010 7:56 pm
- Location: Appalachia
- Contact:
Re: api extensions: api discussion
Shouldn't there be two functions for each of those, a pressed and a released version? That'd be more in keeping with Love, and more flexible.Taehl wrote:Code: Select all
function love.androidHome() end -- called when the Home button is pressed (a good time for saving the game) function love.androidMenu() end -- called when the Menu button is pressed function love.androidBack() end -- called when the Back button is pressed (another good time for saving the game) function love.androidFind() end -- called when the Find button is pressed
Kurosuke needs beta testers
- Taehl
- Dreaming in associative arrays
- Posts: 1025
- Joined: Mon Jan 11, 2010 5:07 am
- Location: CA, USA
- Contact:
Re: api extensions: api discussion
I would agree with that... But I don't think Android tells you pressed/released status, it just fires off a function when pressed.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Re: api extensions: api discussion
A callback for every button is stupid, imho.
Just tie it in with love.keyboard.
Just tie it in with love.keyboard.
Code: Select all
function love.keypressed(key)
if key == "android_home" then
...
end
end
- TechnoCat
- Inner party member
- Posts: 1612
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: api extensions: api discussion
I like this if a function that virtually presses the homekey is provided. Otherwise it might be hard to get the default function.thelinx wrote:A callback for every button is stupid, imho.
Just tie it in with love.keyboard.
Code: Select all
function love.keypressed(key) if key == "android_home" then ... end end
Code: Select all
function love.keypressed(key)
if key == "android_home" then
love.mobile.pressHome()
end
end
Re: api extensions: api discussion
???????????????
- ghoulsblade
- Party member
- Posts: 111
- Joined: Sun Oct 31, 2010 6:11 pm
Re: api extensions: api discussion
as expected the home key is on purpose left outside the control of the application :
http://groups.google.com/group/android- ... 3f5e8c8013
it might be possible to at least detect it or similar using (android) activity:onUserLeaveHint()
http://developer.android.com/reference/ ... Hint%28%29
http://groups.google.com/group/android- ... 3f5e8c8013
it might be possible to at least detect it or similar using (android) activity:onUserLeaveHint()
http://developer.android.com/reference/ ... Hint%28%29
love-android - gamejams
- Taehl
- Dreaming in associative arrays
- Posts: 1025
- Joined: Mon Jan 11, 2010 5:07 am
- Location: CA, USA
- Contact:
Re: api extensions: api discussion
Oh, I just realized: It would be really good to know what kind of a screen a game is on - QVGA or whatnot. So it's important that love.graphics.getHeight and and such all work. I guess you'd need to disable love.graphics.setMode, though.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Who is online
Users browsing this forum: No registered users and 8 guests