Porting Your LÖVE to Zero Point Six Point Zero [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
appleide
Party member
Posts: 323
Joined: Fri Jun 27, 2008 2:50 pm

Porting Your LÖVE to Zero Point Six Point Zero [0.6.0]

Post by appleide »

Between LÖVE 0.5.0 to LÖVE 0.6.0 there have been alot of changes, breaking many .love files!!! This is a thread for everyone to post what to change in a .love file needs to have changed for it to work in the new LÖVE!

I'll start:

love.filesystem.require has been changed to just require.

Help everyone!!
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Porting Your LÖVE to Zero Point Six Point Zero [0.6.0]

Post by nevon »

Well, all the old callbacks like update(), load(), draw() etc. are now going to have to be prefixed with love.
So update() will now be written love.update()
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Porting Your LÖVE to Zero Point Six Point Zero [0.6.0]

Post by Robin »

A difference we noticed much when porting LBP was the following:

Old Colors are gone. You can only use setColor(r, g, b) or setColor(r, g, b, a) anymore. You can emulate old Colors by putting the color values in a table, and doing setColor(unpack(color_x)).
Help us help you: attach a .love.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Porting Your LÖVE to Zero Point Six Point Zero [0.6.0]

Post by bartbes »

Physics has inbuilt scaling now, so if you want it to be pixels again, create the world bigger and set the scaling to 1.
The default scale value is 30 px/m, so:

Code: Select all

world = love.physics.newWorld(xsize * 30, ysize * 30)
world:setMeter(1)
User avatar
Tenoch
Citizen
Posts: 76
Joined: Mon Jul 21, 2008 7:49 am

Re: Porting Your LÖVE to Zero Point Six Point Zero [0.6.0]

Post by Tenoch »

bartbes wrote:Physics has inbuilt scaling now, so if you want it to be pixels again, create the world bigger and set the scaling to 1.
The default scale value is 30 px/m, so:

Code: Select all

world = love.physics.newWorld(xsize * 30, ysize * 30)
world:setMeter(1)
That's a very bad idea. Unless you plan on having objects no bigger than 10 pixels big.

Box2D's documentation:
Box2D is tuned for MKS units. Keep the size of moving objects roughly between 0.1 and 10 meters. You'll need to use some scaling system when you render your environment and actors.
This setMeter() this is the scaling system they recommend. Don't stress a physics engine, it's a pretty delicate thing.
"When in doubt, use brute force." Ken Thompson
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Porting Your LÖVE to Zero Point Six Point Zero [0.6.0]

Post by bartbes »

It is bad, but if you rely on the current working, or, like me already scale before feeding it into the engine, you're going to need such code.
User avatar
The Burrito
Party member
Posts: 153
Joined: Mon Sep 21, 2009 12:14 am
Contact:

Re: Porting Your LÖVE to Zero Point Six Point Zero [0.6.0]

Post by The Burrito »

Constants just became strings.

example:

Code: Select all

--old
if love.keyboard.isDown(love.key_space) then
love.graphics.polygon(love.draw_line, shape:getPoints())
end
--new
if love.keyboard.isDown('space') then
love.graphics.polygon('line',shape:getPoints())
end
User avatar
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

Re: Porting Your LÖVE to Zero Point Six Point Zero [0.6.0]

Post by bmelts »

Actually it's ' ', not 'space'. But yeah.

To quit, you need to call love.event.push('q').
User avatar
kalle2990
Party member
Posts: 245
Joined: Sat Sep 12, 2009 1:17 pm
Location: Sweden

Re: Porting Your LÖVE to Zero Point Six Point Zero [0.6.0]

Post by kalle2990 »

What is the string for the default font?
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Porting Your LÖVE to Zero Point Six Point Zero [0.6.0]

Post by bartbes »

The default font used to be love._vera_ttf... poking around in the source makes it appear it still is.
Post Reply

Who is online

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