Hi! I’m new to LibGDX, and trying to make a game.
So, the problem is that I can’t get the actual size of the Group. Maybe I have just misunderstood its purpose.
Simplified parts of code:
// === init code (in custom Stage class)
menu = new Group();
logo = new Image(Assets.getTexture("logo"));
... other actors ...
menu.addActor(logo);
this.addActor(menu);
// === update code (on resizing window, for example) (in custom Stage class)
logo.setX((int) -logo.getWidth() / 2);
logo.setY(0);
... other actors ...
menu.setX((int) this.getWidth() / 2);
menu.setY((int) this.getHeight() / 2 - (int) menu.getHeight() / 2); // (!) menu.getHeight() is 0
this.draw();
So, the problem is that width and height of the group are 0. I can’t understand why.
And after hours of googling, I decided to ask here.
Thank you!