This is a tiny (~10K) scene graph compatible with Love2D 11.3. This library is used to power all of the games behind 2dengine.com so the code is generalized and fairly well tested.
Features
- View or a "viewport" is a clipped rectangular area where the scene is rendered.
- Cameras allow you to pan, zoom and transform the view
- Sprites are nodes in the scene which can be translated, scaled or rotated. Each sprite is assigned a drawable graphic, usually an image, quad or text. Sprites can also be assigned a specific color, alpha value and blending mode
- Layers are basically groups of nodes, containing either sprites or other nested layers. Layers are helpful in ordering nodes along the Z-axis. Layers are used to build things like parallax, huds, minimaps and so on.
Repository and docs
https://github.com/2dengine/love.scene
https://2dengine.com/?p=scene
Example
Code: Select all
love.scene = require("scene")
local view = love.scene.newView()
local sprite = view:newSprite(0, 0)
local image = love.graphics.newImage("myimage.png")
sprite:setGraphic(image)
function love.draw()
view:draw()
end