Page 3 of 4

Re: API Wars

Posted: Thu Jan 22, 2009 6:22 pm
by bartbes
How massive, you made me wanna get ALL details.

BTW, not like it's going to break any of my games (since I don't have any).

@myself: I should update LUBE, and I should continue working on it....

Re: API Wars

Posted: Fri Jan 30, 2009 9:48 am
by rude
Off the top of my head:
  • load, update, draw and so forth are moved to the love-table. Now everything is in the love table.
  • image:setCenter() goes bye-bye. Instead: love.graphics.draw(image, x, y, a, sx, sy, ox, oy)
  • love.graphics.draws(image, x, y, a, sx, sy, ox, oy, rx, ry, rw, rh) -- Changed param order to match love.graphics.draw.
  • love.graphics.draw can no longer be used to draw text. Love.graphics.print is the new way.
  • Appearently, it seems that people want top-left as the default local origin. So be it.
  • Radians. -- This will cause trouble, but is necessary.
  • The physics API will not change per-se, but the simulations will probably differ.
On the plus side, there will be new features. I'll post part of the "API" later.

Re: API Wars

Posted: Sat Jan 31, 2009 3:14 pm
by Inny
With my lua+sdl framework, "inmframe", I made a couple of design decisions along the lines of this thread that may or may not help:

There was no "load" callback as running the main script was a good enough entry point.

The global callback was actually one of two things. Either, the global table's "inm_oncycle" function, or a function passed to the function "inm.setcallback". That function reference was stored in the lua_state's registry table. It felt more flexible that way.

There was no "draw" callback, the entire video system was done after the oncycle callback was done up in C. This limited it to only tile and sprite based games. Speedy, but restrained.

Re: API Wars

Posted: Sat Jan 31, 2009 3:44 pm
by rude
Sneak-peak at some new stuff. This is not what's planned, but what's done. The list of planned things is much longer. :death:

You get no explanations/comments for great mystery. :neko:

Code: Select all

imageData = love.image.newImageData( file )
imageData = love.image.newImageData( width, height )
imageData:setPixel( x, y, r, g, b, a )
imageData:mapPixel( function (x, y, r, g, b, a) return b, g, r, a end )
r, g, b, a = imageData:getPixel( x, y )
image = love.graphics.newImage( imageData )

Code: Select all

vb = love.graphics.newVertexBuffer( image, size, type, usage )
vb:add( x, y, s, t )
vb:add( x, y, s, t, r, g, b, a )
love.graphics.draw( vertexBuffer, x, y, a, sx, sy, ox, oy )
vb:clear()

Code: Select all

sb = love.graphics.newSpriteBatch( image, size, usage )
sb:add( x, y, a, sx, sy, ox, oy )
sb:adds(x, y, a, sx, sy, ox, ox, rx, ry, rw, rh )
love.graphics.draw( spriteBatch, x, y, a, sx, sy, ox, oy )
sb:clear()

Code: Select all

channel = love.audio.newChannel( volume, pitch )
channel:setPitch( p )
channel:setVolume( v )
love.audio.play( audible, channel )
love.audio.play( audible, volume, pitch )

Code: Select all

function love.run()
	if love.load then love.load() end
	while true do
		love.timer.step()
		if love.update then love.update(love.timer.getDelta()) end
		love.graphics.clear()
		if love.draw then love.draw() end
		for e,a,b,c in love.system.events() do
			if e == love.event_quit then return end
			love.handlers[e](a,b,c)
		end
		love.graphics.present()
	end
end

Re: API Wars

Posted: Sat Jan 31, 2009 3:54 pm
by bartbes
what, you did all in lua? :P
I love the features, especially get/setPixel (don't know why, needed it just one). From what I understand you can also use your own love.run, thus you are going to be able to stop the screen from clearing?
Anyway, nice job, waiting for.. what? 0.6.0?

Re: API Wars

Posted: Sun Feb 01, 2009 3:56 am
by Kaze
Lookin' good.

Re: API Wars

Posted: Sun Feb 01, 2009 5:27 am
by osgeld
theres some really cool stuff in there, and i look forward to using it

get / set pixel will be a great improvement, ive been halfassing it with my own pbm / raw file reader, but (and i dunno if this is on your list) being able to do simmilar with whole images would be cool too (ie taking a subsprite, ploping it on a "blank" image and applying the players equipment on it, diablo style, without having to do it EVERY frame on the screen in realtime)

as far as the love.run, im kinda mixed ... ive spent most of my lua game creation life with blah blah blah.running, or a infinite while loop, so im not opposed to it, it would actually make life easier in some respects, but i have sorta grown accustom to the individual function callbacks, and it actually makes it easier to organize script, from a dumb humon aspect

but things like clearing the screen before drawing to it, having to type it in, and the general blob it tends to make, regarding noobies in the latter, ...maybe im just lazy now but i almost (note almost) like the old way better, but personally it doesnt effect me, cause i just stick function names in the main script and go about my biz with includes however i damn well please lol

Re: API Wars

Posted: Sun Feb 01, 2009 7:55 am
by osuf oboys
rude wrote:Ok, looks like top-left so far.
bartbes wrote:it will invalidate all previous-written games
Oh, hohohohoh. All games will be invalidated anyway. The next codename should be Chicxulub, because when I'm done with this version, all that's left of the API is an impact crater. The users that never use LÖVE again due to massive API break will be called Dinosaurs. (They eventually go extinct). :rofl: HAHAHAhahahha ... hah. ha.
petsagouris wrote:Did I mention that I totaly respect what you are doing here. Well done!
That's cool. :neko:
I would suggest that the origin parameters are values instead of only constants such Top-Right. These values would be from 0 (left) to 1 (right) or -1 (left) or 1 (right).

I'd like for text to drawn from its upper left corner instead of from the lower left corner of the first line. The behavior strikes me as somewhat odd for multiple lines. Will there be a parameter for choosing the location of string drawing in the same manner, although perhaps with respect to the entire text mass instead of the first line only?

Thanks for your hard work.

EDIT: right->left

Re: API Wars

Posted: Sun Feb 01, 2009 2:28 pm
by rude
osgeld wrote:but i have sorta grown accustom to the individual function callbacks
A default love.run will be provided. The callbacks will not be removed by default, but it will be possible to remove them (by overwriting love.run)

@osuf: There will not be any parameters to specify that sort of thing. There will be a default, and there will be a pixel offset. I agree that the default origin for Font should be top-left.

Re: API Wars

Posted: Tue Feb 03, 2009 12:20 am
by osgeld
what about print("foo") in windows when running from the command prompt?

in linux, where i spend most of my time, i run love from the command prompt, and any print statements show up there, while my scripts are running, where on windows if i do the same there is no output in the cmd window

which makes debugging something on my laptop a royal treat, any hopes on getting that fixed?