Add a background to a Vertical Group Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Add a background to a Vertical Group without wasting too much if your time.

The question is published on by Tutorial Guruji team.

How can one go about adding a background to a LibGDX Vertical Group?

I’ve checked the documentation for the class and it seems like there isn’t a clean way to do so.

Answer

You can add an Image actor to a Group, then add the Vertical Group to said Group. If you set the Group’s dimensions to that of the Image actor, then set the Vertical Group to fill its parent, then you have effectively added a background to a Vertical Group.

Example:

Group g = new Group();

Image i = new Image(new Texture("pathtosomeimage.png"));

VerticalGroup vg = new VerticalGroup();

g.setSize(i.getWidth(), i.getHeight());
vg.setFillParent(true);

g.addActor(i);
g.addActor(vg);

//add stuff to the Vertical Group
We are here to answer your question about Add a background to a Vertical Group - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji