## Testing the new things in 0.9.0

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Santos
Party member
Posts: 379
Joined: Sat Oct 22, 2011 7:37 am

### Testing the new things in 0.9.0

So I thought it would be cool to have a thread when 0.9.0 is released to talk about and show examples of the new functionality, but then I thought, why wait, it could be useful to talk about what's new now so it can be documented and tested with the nightly builds.

A more complete list of new things is here, but here's a list of some of the new functions:

Font:getAscent
Font:getDescent
Font:getBaseline
Font:get/setFilter
Font:hasGlyph

love.graphics.newGeometry
[wiki]Geometry:setVertexColors[/wiki]
[wiki]Geometry:setVertex[/wiki]
[wiki]Geometry:getVertex[/wiki]
[wiki]Geometry:hasVertexColors[/wiki]
[wiki]Geometry:getVertexCount[/wiki]
[wiki]Geometry:flip[/wiki]

[wiki]Channel:push[/wiki]
[wiki]Channel:pop[/wiki]
[wiki]Channel:demand[/wiki]
[wiki]Channel:clear[/wiki]
[wiki]Channel:supply[/wiki]
[wiki]Channel:getCount[/wiki]

love.graphics.setBlendMode("replace")
love.graphics.setCanvases
love.graphics.setAlphaTest
love.graphics.origin
love.graphics.getRendererInfo

love.graphics.isSupported("mipmap")
love.graphics.isSupported("dxt")
love.graphics.isSupported("bc5")
love.graphics.isSupported("hdrcanvas")
love.graphics.isSupported("multicanvas")

love.image.newCompressedData
love.image.isCompressed
CompressedData:getMipmapCount

Image:isCompressed
Image:refresh
Image:getData
Image:get/setMipmapFilter

love.math.randomseed
love.math.random
love.math.randomnormal

love.math.newRandomGenerator
[wiki]RandomGenerator:randomseed[/wiki]
[wiki]RandomGenerator:random[/wiki]
[wiki]RandomGenerator:randomnormal[/wiki]

love.math.newBezierCurve
BezierCurve:getDegree
BezierCurve:setControlPoint
BezierCurve:getControlPoint
BezierCurve:insertControlPoint
BezierCurve:eval
BezierCurve:render

love.math.triangulate
love.math.isConvex
love.math.noise

love.timer.getAverageDelta

love.window.setMode
love.window.isVisible

love.mousefocus
love.window.hasMouseFocus

love.resize
love.visible

love.joystickaxis
love.joystickhat

Contact:getChildren

ParticleSystem:emit
ParticleSystem:setRelativeDirection

Here's an example showcasing [wiki]ParticleSystem:emit[/wiki], as well as some other changes:

Code: Select all

function love.load()
-- love.graphics.newImage can accept FileData.
image = love.graphics.newImage(

-- ParticleSystems have a default buffer size of 1000.
p = love.graphics.newParticleSystem(image)

p:setPosition(400, 300)
p:setSpeed(100, 200)

-- Colors as tables with optional alpha.
pink = {255, 0, 200}
blue = {0, 200, 255, 0}
p:setColors(pink, blue)

end

function love.keypressed()
-- Manually emitting particles.
p:emit(100)
end

function love.update(dt)
p:update(dt)
end

function love.draw()
love.graphics.draw(p)
end
So yeah, I guess, like, if anyone is feeling inspired at any time, we could make examples, and/or create and answer questions, or if you're a dev you could engage in a soliloquy about what inspired the new things, and tales about technical and design challenges, or you know, anything!

batatinha
Prole
Posts: 22
Joined: Mon Jun 24, 2013 3:49 am

### Re: Testing the new things in 0.9.0

To be honest i didn't liked the removal of setColorMode and Quads, i guess the new way is kinda less dynamic... But IDK, i'm new to this engine, i'm probably wrong... But the fix'd issues list is great!

slime
Solid Snayke
Posts: 2816
Joined: Mon Aug 23, 2010 6:45 am
Contact:

### Re: Testing the new things in 0.9.0

batatinha wrote:To be honest i didn't liked the removal of setColorMode and Quads, i guess the new way is kinda less dynamic... But IDK, i'm new to this engine, i'm probably wrong... But the fix'd issues list is great!
The ColorModes were mostly useless - if you want the "replace" ColorMode you can just do love.graphics.setColor(255, 255, 255). love.graphics.newQuad still exists for convenience, but it now returns a Geometry. Geometries are way more powerful and dynamic than Quads were.

raidho36
Party member
Posts: 1768
Joined: Mon Jun 17, 2013 12:00 pm

### Re: Testing the new things in 0.9.0

Will vertex shader only affect geometry, or it may apply to all render operations?

Automatik
Citizen
Posts: 57
Joined: Sun Feb 17, 2013 7:05 pm

### Re: Testing the new things in 0.9.0

If by "geometry", you mean the replacement for quad, then no. It's gonna be for everything.

Ref
Party member
Posts: 679
Joined: Wed May 02, 2012 11:05 pm

### Re: Testing the new things in 0.9.0

And don't forget love.graphics.setCaption is now love.window.setCaption.
Waiting for someone to write a simple thread example for Love 0.9 - would same me some head scratching and banging.

slime
Solid Snayke
Posts: 2816
Joined: Mon Aug 23, 2010 6:45 am
Contact:

### Re: Testing the new things in 0.9.0

raidho36 wrote:Will vertex shader only affect geometry, or it may apply to all render operations?
Anything that is drawn with a vertex shader active will be affected by it.

raidho36
Party member
Posts: 1768
Joined: Mon Jun 17, 2013 12:00 pm

### Re: Testing the new things in 0.9.0

Well then, how exactly text rendering will be affected by vertex shader?

Santos
Party member
Posts: 379
Joined: Sat Oct 22, 2011 7:37 am

### Re: Testing the new things in 0.9.0

Oh yeah, all the window related stuff is in love.window now. I think this is nice API-wise, but was there anything else which prompted this change?

Speaking of window related stuff, the new things you can do with love.window.setMode are so freaking cool!

Code: Select all

function love.load()
love.window.setMode(800, 600, {
fullscreen = false,
vsync = true,
fsaa = 0,
resizable = false,
borderless = false,
centered = true,
})
end

function love.draw()
width, height, flags = love.window.getMode()

love.graphics.print(
'resizable: '..tostring(flags.resizable)..'\n'..
'borderless: '..tostring(flags.borderless)..'\n'..
'centered: '..tostring(flags.centered),
10, 10)
end

function love.keypressed(key)
width, height, flags = love.window.getMode()

if key == 'r' then
flags.resizable = not flags.resizable
elseif key == 'b' then
flags.borderless = not flags.borderless
elseif key == 'c' then
flags.centered = not flags.centered
end

love.window.setMode(width, height, flags)
end


slime
Solid Snayke
Posts: 2816
Joined: Mon Aug 23, 2010 6:45 am
Contact:

### Re: Testing the new things in 0.9.0

raidho36 wrote:Well then, how exactly text rendering will be affected by vertex shader?
However you want. Each glyph character in a string you print has 4 vertices that form a bounding box around the glyph.

A simple pass-through vertex shader (does exactly the same thing as if no vertex shader were active) would look like this:

Code: Select all

shader = love.graphics.newShader[[
vec4 position(mat4 modelviewproj_matrix, vec4 vertex)
{
return modelviewproj_matrix * vertex;
}
]]

LÖVE sets the varying color and texture coordinate from the vertex information for you right before calling the position function you define, so you can also change that inside the position function by changing the VaryingColor and VaryingTexCoord vec4 variables.

Santos wrote:Oh yeah, all the window related stuff is in love.window now. I think this is nice API-wise, but was there anything else which prompted this change?
It makes sense API-wise as you said (especially with new functions like love.window.isVisible), and it also helps reduce the huge buildup of functions in the love.graphics module.

Also, everyone should keep in mind everything in 0.9.0 is subject to abrupt change - for example File objects just got a bunch of new additions last night, and there are a couple very useful/powerful/sweet things which haven't made it into the main repository yet but hopefully will soon, as long as there aren't major fundamental/API issues with them.

### Who is online

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