love.scene (yet another scene graph library)
- yetneverdone
- Party member
- Posts: 448
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: love.scene (yet another scene graph library)
Hmm that would be harder as camera has been integrated in my game in a lot of scenes. I'll try moving to this library and do more test
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Re: love.scene (yet another scene graph library)
Just pushed an update featuring full HTML documentation:
https://2dengine.com/?p=scene
https://2dengine.com/?p=scene
-
- Prole
- Posts: 1
- Joined: Fri Mar 25, 2022 7:33 pm
Re: love.scene (yet another scene graph library)
I was just about to sit down and start working out a scene manager, thought I'd see if the work's already been done. I just perused the HTML docs for your Love.scene, @ivan, and I am impressed. It looks exactly like what I'm after. So complete, as well! I'm grateful you decided to put it up for other's to use, and documented it so well! I will definitely be checking it out.
Re: love.scene (yet another scene graph library)
Thank you. I use this library in almost all of my Love2d games and will be happy to help if you encounter any issues or if you have questions.
- yetneverdone
- Party member
- Posts: 448
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: love.scene (yet another scene graph library)
Hi, looking to try this lib again, looking at the source code, it doesn't seem to handle love.graphics.print and rectangle, and other primitives. What approach would one use to draw those using this lib?
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Re: love.scene (yet another scene graph library)
Hello and thank you for the question.yetneverdone wrote: ↑Wed Nov 16, 2022 1:00 am Hi, looking to try this lib again, looking at the source code, it doesn't seem to handle love.graphics.print and rectangle, and other primitives. What approach would one use to draw those using this lib?
Here is how to do text:
Code: Select all
local font = love.graphics.getFont()
local text = love.graphics.newText(font, "Hello world!")
local view = love.scene.newView()
local sprite = view:newSprite(0, 0)
sprite:setGraphic(text)
Code: Select all
local rect = { {0,0}, {100,0}, {100,100}, {0,100} }
local mesh = love.graphics.newMesh(rect, "fan", "static")
local view = love.scene.newView()
local sprite = view:newSprite(0, 0)
sprite:setGraphic(mesh)
This is usually faster and cleaner compared to using love.graphics.draw:
Code: Select all
function love.draw()
view:draw()
end
It is very easy to query the scene graph and find which sprite you have clicked on.
These are standard features to 2D scene graphs (see ActionScript, PIXI.js, etc).
love.scene documentation: https://2dengine.com/?p=scene
Re: love.scene (yet another scene graph library)
Regarding your previous question on cameras.
Here is how to offset the camera/scene to 200,100:
The position specified in "setScene" is always drawn in the center of the view(port).
Offsetting the "scene" is basically the same thing as moving the camera.
I agree that the function name "setScane" is somewhat misleading.
Here is how to offset the camera/scene to 200,100:
Code: Select all
view:setScene(200, 100)
Offsetting the "scene" is basically the same thing as moving the camera.
I agree that the function name "setScane" is somewhat misleading.
- yetneverdone
- Party member
- Posts: 448
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: love.scene (yet another scene graph library)
I see, thanks for the explanations. I was hoping of using love.graphics.rectangle/print instead of generating text and mesh objects. I can manage with those still.
Do you recommend using camera node as the parent/root node of all other nodes just like how it is structured in Unity and Godot (i think?)
Oh and another for confirmation, would the child node inherit the transformation of the parent node?
Do you recommend using camera node as the parent/root node of all other nodes just like how it is structured in Unity and Godot (i think?)
Oh and another for confirmation, would the child node inherit the transformation of the parent node?
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Re: love.scene (yet another scene graph library)
It is a little bit counter-intuitive at first.yetneverdone wrote: ↑Wed Nov 16, 2022 4:07 pm I see, thanks for the explanations. I was hoping of using love.graphics.rectangle/print instead of generating text and mesh objects. I can manage with those still.
Yes. Also, you can have multiple view objects rendering the same scene. I used this method to build the split screen feature in the game Skullmaster's Arena.yetneverdone wrote: ↑Wed Nov 16, 2022 4:07 pm Do you recommend using camera node as the parent/root node of all other nodes just like how it is structured in Unity and Godot (i think?)
I am not sure how it works in Unity or Godot.
Yes! If you move the parent node all of the child nodes will be offset too.yetneverdone wrote: ↑Wed Nov 16, 2022 4:07 pm Oh and another for confirmation, would the child node inherit the transformation of the parent node?
- yetneverdone
- Party member
- Posts: 448
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: love.scene (yet another scene graph library)
Awesome. Now im convinced to go with it. Just got to think how i will incorporate this with ecs
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Who is online
Users browsing this forum: No registered users and 10 guests