I’m trying to add to the screen a scrollbox that will be dynamically filled with text nodes (sort of a chat log). So, in the manual I see how to create a text node in a certain position with a certain text, but how to use clipping on this new node?
1 Like
First, you need a node to clip against. Create a node with clipping mode “STENCIL”:
Then you dynamically create text nodes and child them to the clipping node:
local pos = vmath.vector3(50,40,0)
local text_node = gui.new_text_node(pos,"HELLO WORLD!")
gui.set_font(text_node, hash("source_sans"))
local clipper = gui.get_node("clipper")
gui.set_parent(text_node, clipper)
You can create the clipping node dynamically as well with gui.new_box_node()
and gui.set_clipping_mode()
(see API reference (gui))
7 Likes