Automatically converting 0.5.0 games to 0.6.0

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.
User avatar
luisfcorreia
Prole
Posts: 4
Joined: Sun Jan 10, 2010 4:17 pm
Location: Belas, Portugal
Contact:

Re: Automatically converting 0.5.0 games to 0.6.0

Post by luisfcorreia »

sadly no, it didn't help at all.
matty
Prole
Posts: 3
Joined: Mon Feb 08, 2010 3:35 am

Re: Automatically converting 0.5.0 games to 0.6.0

Post by matty »

I'm curious if there is a list of differences that break LOVE filesn (I'm assuming differences from v0.5 to v0.6.x)? It is a bit frustrating trying to pick this up and look at samples from other users when 99% of them seem to either fail with an error or just come up with a black screen!

I've run this script (hand-holder.lua) on several programs, and other than finding game.conf and telling me it should be conf.lua, it doesn't find even simple things, like having love.filesystem.require() instead of just require(). Running against the game "NO", which works fine in v0.6.1, the script throws all sorts of errors. It is all quite confusing!

Thanks
Matty
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Automatically converting 0.5.0 games to 0.6.0

Post by Robin »

matty wrote:I'm curious if there is a list of differences that break LOVE filesn (I'm assuming differences from v0.5 to v0.6.x)? It is a bit frustrating trying to pick this up and look at samples from other users when 99% of them seem to either fail with an error or just come up with a black screen!
The Wiki page on 0.6.0 is pretty complete I'd say.
matty wrote:I've run this script (hand-holder.lua) on several programs, and other than finding game.conf and telling me it should be conf.lua, it doesn't find even simple things, like having love.filesystem.require() instead of just require().
Oh, right, I'll add that in the next version.
matty wrote:Running against the game "NO", which works fine in v0.6.1, the script throws all sorts of errors. It is all quite confusing!
I haven't tried it out on NO, I must confess. Will try, though.
Help us help you: attach a .love.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Automatically converting 0.5.0 games to 0.6.0

Post by Robin »

Made a whole lot of improvements for require()ing things, check the first post.

Oh, and I tested it with both NO for 0.5 and for 0.6. They both function correctly now, the one for 0.6.1 only warns

Code: Select all

main.lua:11: change require'lua/button.lua' to require'lua.button'
main.lua:12: change require'lua/states.lua' to require'lua.states'
Which should have been changed before release IMO.
Help us help you: attach a .love.
matty
Prole
Posts: 3
Joined: Mon Feb 08, 2010 3:35 am

Re: Automatically converting 0.5.0 games to 0.6.0

Post by matty »

Thanks for the link to the wiki.
So, if I look at a single program, let's say Militia Defense Q. I fix the missing conf.lua, I then fix the font issues - it uses love.graphics.newfont(love.default_font), which hand_holder reports as a constant, so I changed it to love._vera_ttf -- is there a replacement for love.default_font?
Next I fixed the requires lines. I re-run hand-holder, and I get this:
hand-holder (v0.5) for porting games for LÖVE 0.5.0 to 0.6.0
C:\Program Files (x86)\Lua\5.1\lua.exe: ...ew\love\
hand-holder.lua:128: attempt to index local 'k' (a number value)
stack traceback:
...ew\love\hand-holder.lua:128: in function
<...ew\love\hand-holder.lua:126>
[string "citymap.lua"]:37: in function 'initMap'
[string "main.lua"]:56: in function 'ff'
...ew\love\hand-holder.lua:255: in main chunk
[C]: ?

Any ideas?

Thanks
Matty
Attachments
mdq.love
(223.69 KiB) Downloaded 130 times
User avatar
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

Re: Automatically converting 0.5.0 games to 0.6.0

Post by bmelts »

I don't know anything about hand-holder, but as for love.default_font, it's been replaced with... nothing.

No, really. If you want to use the default font, just pass no font argument to love.graphics.newFont:

Code: Select all

bigFont = love.graphics.newFont(72) -- Default font, 72pt
Also, if you just need the default font at size 12, you don't even need to explicitly create a font - LÖVE will create that font automatically the first time it's needed.
Last edited by bmelts on Tue Feb 09, 2010 3:49 pm, edited 3 times in total.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Automatically converting 0.5.0 games to 0.6.0

Post by kikito »

anjo wrote:Also, if you just need the default font at size 12, you don't even need to explicitly create a font - LÖVE will create that font automatically the first time it's needed.
I would not recommend that. On the fonts thread we've been discussing about that feature, and it is likely to be changed, according to Rude(link).

So it will be more maintainable to do font = love.graphics.newFont(12), and then love.graphics.setFont(font).
When I write def I mean function.
User avatar
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

Re: Automatically converting 0.5.0 games to 0.6.0

Post by bmelts »

I'm not sure I follow?

Here's the code in graphics.lua, relevant to what I'm discussing:

Code: Select all

love.graphics.print = function (...)
	if not love.graphics.getFont() then 
		love.graphics.setFont(love._vera_ttf, 12)
	end
	love.graphics.print1(...)
	love.graphics.print = love.graphics.print1
end
If you don't explicitly set a font before a love.graphics.print(f) call, LÖVE does for you. Once. Once that font is set, it never automatically sets one again. So, you get the overhead of one setFont() in one love.draw() call, and after that, it never bothers you again.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Automatically converting 0.5.0 games to 0.6.0

Post by kikito »

Ah I see. I misunderstood. I thought you were talking about love.graphics.setFont(12).

Yes, if you just do love.graphics.print(), whithout creating/loaging any fonts before, then LÖVE will create a default font.
When I write def I mean function.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Automatically converting 0.5.0 games to 0.6.0

Post by Robin »

matty wrote:Any ideas?
Yes. I've fixed a few things now.

However, It's not completely fixed. I still get errors. I suggest you temporarily comment out the lines that give problems. I'll upload 0.5.1 soon.
Help us help you: attach a .love.
Post Reply

Who is online

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