suggested callback initialize()

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
u9_
Citizen
Posts: 54
Joined: Thu Oct 23, 2008 7:12 am

suggested callback initialize()

Post 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 ;)
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: suggested callback initialize()

Post 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. ;)
User avatar
boypink
Prole
Posts: 10
Joined: Sat Nov 15, 2008 5:40 am
Location: Canada

Re: suggested callback initialize()

Post 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()
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: suggested callback initialize()

Post 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()
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 7 guests