Thursday, December 14, 2017

java - Libgdx: Aligning buttons inside dialog



I have the following dialog, semi circle shape. I want to position buttons in it.


enter image description here


        dialog.button(closeButton, false);
dialog.getContentTable().add(buttonS);
dialog.getContentTable().add(button);
dialog.getContentTable().add(hwTo);

The only way I am able to move a button is by using for a example


    dialog.getContentTable().add(hwTo).pad(300);


But I don't want to pad anything, since it affects other buttons, I tried align, button.setPosition and whatnot, nothing works.


I was told to remove the table and ise Custom WidgetGroup. I removed the table, still having the same problem, nothing works except padding.



Answer



Your Dialog extends from Group, which means you can do dialog.addActor(myActor). Using addActor, you have a full control of the actor positions. You should go this way.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...