Search code examples
libgdxscene2d

Set position inside Window libgdx


I'm trying to position actors inside a Window, but when trying to set a fixed position, the settings to seem to affect the ui properly.

I've tried putting a Table inside the window, which works as you would expect, but when trying to call

myactor.setPosition(10,10);
window.add(myactor);

the actor is not affected by the position. Is there any way to do that, or do widgets in window have to be added as in a table?


Solution

  • Window is table that can be dragged and act as a modal window. Table is a WidgetGroup that sets the position and size of its children using a logical table, similar to HTML tables.

    Table-based layouts don't rely on absolute positioning and therefore automatically adjust to different widget sizes and screen resolutions.

    Take a look of Table to set position of your Actor.