Difference between revisions of "love.scene"
(Created page with "== love.scene == love.scene is a two-dimensional scene graph library written for the LÖVE game framework (compatible with LÖVE 11.3, 11.4 and 11.5). To install the scene gra...") |
|||
(One intermediate revision by the same user not shown) | |||
Line 40: | Line 40: | ||
{{#set:LOVE Version=11.3+}} | {{#set:LOVE Version=11.3+}} | ||
{{#set:Description=Small scene graph library written for the LÖVE framework using pure Lua}} | {{#set:Description=Small scene graph library written for the LÖVE framework using pure Lua}} | ||
− | {{#set:Keyword= | + | {{#set:Keyword=Framework}} |
[[Category:Libraries]] | [[Category:Libraries]] | ||
− | |||
− | |||
− |
Latest revision as of 09:16, 9 October 2024
love.scene
love.scene is a two-dimensional scene graph library written for the LÖVE game framework (compatible with LÖVE 11.3, 11.4 and 11.5). To install the scene graph, copy the "scene" folder to your game directory and use require:
love.scene = require("scene")
Usage
The scene graph is fairly minimal, relying on just four different types of objects. Scene nodes are created using two different methods:
local view = love.scene.newView()
-- object-oriented style
local s1 = view:newSprite(0, 0)
-- Love2D style
local s2 = love.scene.newSprite(0, 0)
s2:setParent(view)
Images, text and other types of drawable graphics are rendered as follows:
-- image
local image = love.graphics.newImage("mytexture.png")
s1:setGraphic(image)
-- text
local font = love.graphics.getFont()
local text = love.graphics.newText(font, "Hello world")
s2:setGraphic(text)
function love.draw()
view:draw()
end