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.
- View is a clipped rectangular area where the scene is rendered. Views can be transformed like a camera and can be easily shaded
- 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.
Code: Select all
love.scene = require("scene.main") 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