Basic scene graph library for LÖVE game engine.
Please read the wiki page for more details on usage.
Just copy amour
into the root folder of your game.
- No support for z-index: child nodes added later will be drawn later.
- Although transform properties like
x
,y
,r
, etc. can be read directly, they must be set viaupdateXXX()
functions or the transforms won't be updated. - Usage of
flux
on transform properties must be done vianode:flux()
instead offlux.to(node, ...)
to make sure node transform is updated.
local Scene = require 'amour.scene'
local Rect = require 'amour.rect'
local Text = require 'amour.text'
local scene
function love.load()
scene = Scene(480, 320)
local bg = Rect(scene.w * 0.5, scene.h * 0.5, scene.w, scene.h, { 0.2, 0.2, 0.2, 1 })
scene:addChild(bg)
local title = Text(scene.w * 0.5, 10, 14, "Je t'aime!", { 1, 0, 0, 1})
title:updateAnchor(0.5, 0)
scene:addChild(title)
end
function love.draw()
scene:draw()
end