Skip to content
Chico edited this page Jan 18, 2020 · 6 revisions

To get started quick and easy with Luven this page is what you want to read. The first thing is to import Luven to your project.

Put the luven folder in your project folder (for exemple your lib/ folder) :

Luven = require "lib/luven/luven"

Next in your love.load() function :

function love.load()
    Luven.init()
end

Then you need to initialize the Luven camera's position and scale based on your needs :

Luven.camera:init(love.graphics.getWidth() / 2, love.graphics.getHeight() / 2) -- center the camera.
Luven.camera:setScale(2) -- set a x2 zoom on the camera.

In order to create a light it's simple :

lightID = Luven.addNormalLight(x, y, Luven.newColor(1.0, 0.75, 0.5), 0.9)

In the love.update(dt) function there is something to call too :

function love.update(dt)
    Luven.update(dt)
end

And in love.draw() function :

function love.draw()
    Luven.drawBegin()

    -- everything drawn here will be affected by lights and Luven's camera setup.

    Luven.drawEnd()

    -- draw UI here in general.
end

In order to be a nice person for the memory of your players you can use Luven.dispose() when you don't need it anymore.

One more thing, if you are using the integrated camera you should check what's available here : Integrated camera

Clone this wiki locally