Page 1 of 1
suggested callback initialize()
Posted: Thu Nov 13, 2008 5:51 pm
by u9_
I must say i find the load() function name a little not-fitting. I would suggest renaming it to initialize(), which i think fits better. I believe any kind of initialization goes on in that function, not just loading
Which brings me to another thought. Is the function even necessary? Is it called when you do a love.system.restart() ? Because otherwise if i am not mistaken, all the code could just be put right into the file without the function?
What are people's thoughts about this?
I am not sure if such suggestions are wanted, and i'm not much for breaking compatibility, but i figured we haven't reached version 1.0 yet, so the api is bound to change
Re: suggested callback initialize()
Posted: Thu Nov 13, 2008 8:01 pm
by rude
It's not technically needed, no. Still, it will remain, because less experienced game developers will more quickly understand where to place their loading code.
In the next version, you can choose to not use load/update/draw altogether, and work directly on the main loop.
All kinds of suggestions are welcome, even after 1.0.
Re: suggested callback initialize()
Posted: Tue Nov 18, 2008 10:54 pm
by boypink
rude wrote:In the next version, you can choose to not use load/update/draw altogether, and work directly on the main loop.
Will we see LÖVE more like a library rather than a framework?
Code: Select all
local love = require"love"
love.dosomething()
Re: suggested callback initialize()
Posted: Wed Nov 19, 2008 6:42 am
by rude
Yes and no.
Yes: I'm structuring the next version so that it
should be possible to compile LÖVE as a DLL and use it in any Lua interpreter using normal library loading facilities.
No: An important part of LÖVE's simplicity is the embedded virtual machine, so we will by no means move towards a pure library oriented approach. The current setup will remain, but with more flexibility (i.e. optional control over the main loop and messages queue).
Having a DLL can be very useful for development purposes. It would allow us to use existing debuggers and specialized IDE's. Note that unless you want to do all setup code yourself, using LÖVE as library requires that you call a function which enters the main loop at the end of your script. Something like this:
Code: Select all
require("love")
-- standard code:
function load()
image = love.graphics.newImage("awesome.png")
end
function update(dt)
end
-- etc
-- This must be called at the end of the file.
love.init()