java - Position Actor Bottom Right Of Viewport -
i using scene2d, , want position custom actor created, extends image , allows me play animations. having problems keeping actor in bottom right of screen. when shrink window out of 16:9 ratio, actor goes side (up on y axis) instead of staying in bottom. actor animactor (i created), work same image. trying make loading symbol. resize view port correctly. here's code :
stage = new stage(viewport); animation anim = main.loadingsymbol; anim.setframesize(new vector2(camera.viewportwidth / 10, camera.viewportwidth / 10)); loadingsymbolactor = new animactor(anim); table = new table(new skin()); table.setbounds(0, 0, stage.getwidth(), stage.getheight()); table.add(loadingsymbolactor); table.pack(); table.align(align.bottomright); stage.addactor(table);
table
s static ui layout, since not easy add/remove or move actors once laid out. there isn't can tell libgdx wiki doesn't, has explanation on table
s here.
but if issue resizing, make sure update stage
camera correctly in resize method. maybe change table
bounds in resize method, , set table.setfillparent(true)
after initialising table
.
to fix actor
bottom right of table
, can try table.add(loadingsymbolactor).bottom().right();
.
Comments
Post a Comment